/* Virtex Market — чат «Ночная касса» */

.bob-chat-launcher {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10100;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border: 2px solid var(--ink, #1a1510);
  border-radius: var(--radius, 3px);
  background: var(--bg-paper, #f3ece2);
  color: var(--ink, #1a1510);
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  cursor: pointer;
  box-shadow: var(--shadow-stamp, 4px 4px 0 rgba(0, 0, 0, 0.45));
  transition: transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
}

.bob-chat-launcher:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

.bob-chat-launcher__stamp {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.5rem;
  font-family: var(--font-display, "Russo One", sans-serif);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--stamp, #c62828);
  color: var(--bg-paper, #f3ece2);
  border-right: 2px solid var(--ink, #1a1510);
}

.bob-chat-launcher__main {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem 0.55rem 0.65rem;
}

.bob-chat-launcher__icon {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  color: var(--ink, #1a1510);
}

.bob-chat-launcher__label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
  text-align: left;
}

.bob-chat-launcher__label small {
  display: block;
  font-size: 0.58rem;
  font-weight: 500;
  opacity: 0.55;
  letter-spacing: 0.04em;
}

.bob-chat-launcher__badge {
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.25rem;
  margin-left: 0.15rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius, 3px);
  background: var(--virt, #c62828);
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
}

.bob-chat-launcher__badge.hidden {
  display: none;
}

/* Панель — чек */

.bob-chat-panel {
  position: fixed;
  right: 1rem;
  bottom: 4.75rem;
  z-index: 10101;
  width: min(368px, calc(100vw - 2rem));
  height: min(520px, calc(100vh - 6.75rem));
  display: flex;
  flex-direction: column;
  border: 2px solid var(--ink, #1a1510);
  border-radius: var(--radius, 3px);
  background: var(--bg-paper, #f3ece2);
  color: var(--ink, #1a1510);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.55);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) rotate(0.5deg);
  transition: opacity 0.22s, transform 0.22s, visibility 0.22s;
}

.bob-chat-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) rotate(0.5deg);
}

.bob-chat-perf {
  flex-shrink: 0;
  height: 7px;
  background: repeating-linear-gradient(
    90deg,
    var(--bg-paper, #f3ece2) 0,
    var(--bg-paper, #f3ece2) 5px,
    var(--ink, #1a1510) 5px,
    var(--ink, #1a1510) 7px
  );
}

.bob-chat-panel__head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: start;
  gap: 0.5rem 0.65rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 2px dashed rgba(255, 255, 255, 0.22);
  background: var(--virt, #c62828);
  color: #ffffff;
}

.bob-chat-receipt-no {
  display: block;
  grid-column: 1 / -1;
  font-family: var(--font-mono, monospace);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

.bob-chat-panel__title {
  margin: 0;
  font-family: var(--font-display, "Russo One", sans-serif);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.1;
  text-transform: uppercase;
  color: #ffffff;
}

.bob-chat-panel__sub {
  margin: 0.1rem 0 0;
  font-family: var(--font-mono, monospace);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}

.bob-chat-live {
  align-self: center;
  padding: 0.2rem 0.4rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius, 3px);
  animation: chat-blink 1.4s step-end infinite;
}

@keyframes chat-blink {
  50% {
    opacity: 0.55;
  }
}

.bob-chat-panel__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid var(--ink, #1a1510);
  border-radius: var(--radius, 3px);
  background: var(--bg-paper, #f3ece2);
  color: var(--ink, #1a1510);
  cursor: pointer;
  transition: transform 0.15s;
}

.bob-chat-panel__close:hover {
  transform: scale(1.05);
}

.bob-chat-panel__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 0.65rem 0.75rem 0.5rem;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 23px,
      rgba(26, 21, 16, 0.06) 23px,
      rgba(26, 21, 16, 0.06) 24px
    );
}

.bob-chat-panel__intro {
  flex-shrink: 0;
  margin: 0 0 0.6rem;
  padding: 0.5rem 0.6rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  line-height: 1.45;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px dashed rgba(26, 21, 16, 0.3);
  background: rgba(255, 255, 255, 0.45);
}

.bob-chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.25rem 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.bob-chat-messages::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.bob-chat-input-row textarea {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.bob-chat-input-row textarea::-webkit-scrollbar {
  display: none;
}

/* Пустое место сверху — короткая переписка внизу, при переполнении — нормальный скролл */
.bob-chat-messages::before {
  content: "";
  flex: 1 1 auto;
  min-height: 0;
}

.bob-chat-msg {
  position: relative;
  max-width: 90%;
  padding: 0.45rem 0.6rem 0.5rem;
  font-size: 0.82rem;
  line-height: 1.45;
  border: 1px solid rgba(26, 21, 16, 0.25);
  border-radius: var(--radius, 3px);
}

.bob-chat-msg--visitor {
  align-self: flex-end;
  background: var(--virt, #c62828);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.bob-chat-msg--visitor::before {
  content: "→";
  position: absolute;
  left: -1rem;
  top: 0.35rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.55);
  opacity: 1;
}

.bob-chat-msg--visitor .bob-chat-msg__meta {
  color: rgba(255, 255, 255, 0.72);
  border-bottom-color: rgba(255, 255, 255, 0.22);
}

.bob-chat-msg--operator {
  align-self: flex-start;
  background: #fff;
  border-left: 3px solid var(--stamp, #e60000);
}

.bob-chat-msg--operator::before {
  content: "←";
  position: absolute;
  right: -1rem;
  top: 0.35rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.65rem;
  opacity: 0.4;
}

.bob-chat-msg__meta {
  display: block;
  margin-bottom: 0.2rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px dotted rgba(26, 21, 16, 0.2);
  font-family: var(--font-mono, monospace);
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.5;
}

.bob-chat-compose {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem 0.7rem;
  border-top: 2px solid var(--ink, #1a1510);
  background: var(--bg-paper-dim, #e6ddd0);
}

.bob-chat-compose__label {
  margin: 0;
  font-family: var(--font-mono, monospace);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.55;
}

.bob-chat-name-row input {
  width: 100%;
  padding: 0.5rem 0.6rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.75rem;
  border: 2px solid var(--ink, #1a1510);
  border-radius: var(--radius, 3px);
  background: #fff;
  color: var(--ink, #1a1510);
}

.bob-chat-name-row input::placeholder,
.bob-chat-input-row textarea::placeholder {
  color: rgba(26, 21, 16, 0.38);
}

.bob-chat-input-row {
  display: flex;
  gap: 0.4rem;
  align-items: flex-end;
}

.bob-chat-input-row textarea {
  flex: 1;
  min-height: 40px;
  max-height: 110px;
  padding: 0.55rem 0.6rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.76rem;
  line-height: 1.4;
  border: 2px solid var(--ink, #1a1510);
  border-radius: var(--radius, 3px);
  background: #fff;
  color: var(--ink, #1a1510);
  resize: none;
}

.bob-chat-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  padding: 0;
  border: 2px solid var(--ink, #1a1510);
  border-radius: var(--radius, 3px);
  background: var(--stamp, #c62828);
  color: var(--bg-paper, #f3ece2);
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.12s;
}

.bob-chat-send:hover:not(:disabled) {
  transform: translate(-1px, -1px);
}

.bob-chat-send:disabled {
  opacity: 0.55;
  cursor: wait;
}

.bob-chat-send .icon {
  width: 1rem;
  height: 1rem;
}

.bob-chat--compact .bob-chat-panel__intro,
.bob-chat--compact .bob-chat-name-row {
  display: none;
}

.bob-chat-status {
  margin: 0;
  min-height: 0.9rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(26, 21, 16, 0.45);
}

.bob-chat-status.is-error {
  color: var(--stamp, #e60000);
  font-weight: 700;
}

.bob-chat-empty {
  margin: 0;
  padding: 0.85rem 0.5rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(26, 21, 16, 0.42);
  border: 1px dashed rgba(26, 21, 16, 0.22);
  background: rgba(255, 255, 255, 0.35);
}

/* Страницу не блокируем — чат сбоку, сайт можно листать */

body.bob-chat-open .bob-chat-launcher {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
}

@media (max-width: 768px) {
  .bob-chat-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow: none;
    transform: none;
  }

  .bob-chat-panel.is-open {
    transform: none;
  }

  .bob-chat-launcher {
    right: 0.65rem;
    bottom: 0.65rem;
  }

  .bob-chat-launcher__stamp {
    padding: 0.45rem 0.65rem;
    border-right: none;
    border-bottom: 2px solid var(--ink, #1a1510);
  }

  .bob-chat-launcher {
    flex-direction: column;
  }

  .bob-chat-launcher__main {
    padding: 0.5rem 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bob-chat-live {
    animation: none;
  }

  .bob-chat-panel,
  .bob-chat-launcher {
    transition: none;
  }
}

.bob-chat-panel__body {
  position: relative;
}

.bob-chat-closed {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 8;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  pointer-events: none;
}

.bob-chat-panel.bob-chat--banned .bob-chat-closed {
  display: flex;
}

.bob-chat-closed__sign {
  position: relative;
  padding: 1rem 1.75rem 1.05rem;
  min-width: 11rem;
  background: linear-gradient(165deg, #c62828 0%, #9b1c1c 48%, #7f1515 100%);
  color: #f3ece2;
  border: 3px solid #f3ece2;
  border-radius: 3px;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.25),
    inset 0 0 0 5px rgba(243, 236, 226, 0.12),
    5px 6px 14px rgba(0, 0, 0, 0.42);
  transform: rotate(-10deg);
  font-family: var(--font-display, "Russo One", sans-serif);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  line-height: 1.15;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.bob-chat-closed__sign::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 2px solid rgba(243, 236, 226, 0.55);
  border-radius: 1px;
  pointer-events: none;
}

.bob-chat-panel.bob-chat--banned .bob-chat-panel__intro,
.bob-chat-panel.bob-chat--banned .bob-chat-messages {
  visibility: hidden;
}

.bob-chat-live--off {
  background: var(--ink, #1a1510);
  color: var(--bg-paper, #f3ece2);
}

.bob-chat-compose.hidden {
  display: none;
}
