/* ==========================================================================
   FLAT Интерьеры — Квиз-чат и быстрая бронь в карточке товара
   Изолированный namespace .fcc-* (без конфликтов со стилями сайта)
   ========================================================================== */

:root {
  --fcc-ink: #181818;
  --fcc-ink-soft: #59554f;
  --fcc-muted: #8a847b;
  --fcc-bg: #ffffff;
  --fcc-warm: #f7f4ef;
  --fcc-warm-2: #efeae2;
  --fcc-border: #e4dfd6;
  --fcc-accent: #3e7963;
  --fcc-accent-dark: #2f604e;
  --fcc-gold: #a98153;
  --fcc-radius: 12px;
  --fcc-shadow: 0 24px 64px rgba(18, 16, 14, 0.22);
}

/* ---------- Замена блока кнопок в карточке ---------- */

.fcc-hidden-legacy {
  display: none !important;
}

.fcc-actions {
  grid-column: 1 / -1;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
  font-family: inherit;
}

.fcc-actions-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 560px) {
  .fcc-actions-row--split {
    grid-template-columns: 1fr 1fr;
  }
}

.fcc-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 12px 18px;
  border-radius: 6px;
  border: 1px solid var(--fcc-ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
  box-sizing: border-box;
}

.fcc-btn:active {
  transform: translateY(1px);
}

.fcc-btn--primary {
  background: var(--fcc-ink);
  color: #ffffff;
  border-color: var(--fcc-ink);
}

.fcc-btn--primary:hover {
  background: #2c2a28;
  border-color: #2c2a28;
}

.fcc-btn--accent {
  background: var(--fcc-accent);
  color: #ffffff;
  border-color: var(--fcc-accent);
}

.fcc-btn--accent:hover {
  background: var(--fcc-accent-dark);
  border-color: var(--fcc-accent-dark);
}

.fcc-btn--chat {
  background: var(--fcc-warm);
  color: var(--fcc-ink);
  border-color: #d6cfc3;
  justify-content: center;
  text-align: center;
  padding: 11px 18px;
}

.fcc-btn--chat:hover {
  background: var(--fcc-warm-2);
  border-color: var(--fcc-ink);
}

.fcc-btn--outline {
  background: #ffffff;
  color: var(--fcc-ink);
  border-color: #cfc8bc;
}

.fcc-btn--outline:hover {
  background: var(--fcc-warm);
  border-color: var(--fcc-ink);
}

.fcc-btn-avatar-wrap {
  position: relative;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
}

.fcc-btn-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.fcc-online-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2ab673;
  border: 2px solid #ffffff;
  box-sizing: border-box;
}

.fcc-btn-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fcc-btn-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
}

.fcc-btn-sub {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.78;
  line-height: 1.2;
}

.fcc-trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--fcc-warm);
  border: 1px solid var(--fcc-border);
  font-size: 12.5px;
  color: var(--fcc-ink-soft);
  line-height: 1.35;
}

.fcc-trust-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.fcc-trust-item::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fcc-accent);
  flex: 0 0 5px;
}

/* Бейдж «через квиз-чат» на нижних сервисных кнопках */
.fcc-service-enhanced {
  position: relative;
}

/* ---------- Модальное окно квиз-чата и быстрой брони ---------- */

.fcc-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: rgba(18, 17, 15, 0.58);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  box-sizing: border-box;
}

.fcc-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.fcc-modal {
  width: 100%;
  max-width: 496px;
  max-height: min(88vh, 740px);
  background: var(--fcc-bg);
  border-radius: var(--fcc-radius);
  box-shadow: var(--fcc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(10px) scale(0.985);
  transition: transform 0.22s ease;
  color: var(--fcc-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  box-sizing: border-box;
}

.fcc-overlay.is-open .fcc-modal {
  transform: translateY(0) scale(1);
}

.fcc-modal--book {
  max-width: 460px;
}

/* Шапка модалки */
.fcc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--fcc-ink);
  color: #ffffff;
  flex-shrink: 0;
}

.fcc-head-person {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.fcc-head-avatar-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}

.fcc-head-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid rgba(255, 255, 255, 0.25);
}

.fcc-head-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.fcc-head-role {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.74);
  margin-top: 2px;
}

.fcc-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.fcc-icon-btn {
  appearance: none;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.fcc-icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Мини-карточка товара внутри чата / брони */
.fcc-product-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--fcc-warm);
  border-bottom: 1px solid var(--fcc-border);
  flex-shrink: 0;
}

.fcc-product-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: #ffffff;
  border: 1px solid var(--fcc-border);
  flex: 0 0 48px;
}

.fcc-product-meta {
  min-width: 0;
  flex: 1;
}

.fcc-product-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fcc-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fcc-product-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--fcc-ink-soft);
}

.fcc-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.fcc-badge--sale {
  background: #3e7963;
  color: #ffffff;
}

.fcc-badge--stock {
  background: #e5efe9;
  color: #245342;
}

.fcc-badge--order {
  background: #efe6d5;
  color: #7c5828;
}

/* Лента сообщений */
.fcc-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  background: #faf8f5;
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-height: 190px;
}

.fcc-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 92%;
  animation: fccFadeUp 0.18s ease;
}

@keyframes fccFadeUp {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.fcc-msg--bot {
  align-self: flex-start;
}

.fcc-msg--user {
  align-self: flex-end;
  justify-content: flex-end;
}

.fcc-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 28px;
}

.fcc-bubble {
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
}

.fcc-msg--bot .fcc-bubble {
  background: #ffffff;
  color: var(--fcc-ink);
  border: 1px solid var(--fcc-border);
  border-bottom-left-radius: 4px;
}

.fcc-msg--user .fcc-bubble {
  background: var(--fcc-ink);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.fcc-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--fcc-muted);
  font-size: 12.5px;
}

.fcc-dots {
  display: inline-flex;
  gap: 3px;
}

.fcc-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fcc-muted);
  animation: fccBounce 1s infinite ease-in-out;
}

.fcc-dots i:nth-child(2) { animation-delay: 0.15s; }
.fcc-dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes fccBounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

/* Нижняя панель выбора / формы */
.fcc-controls {
  padding: 14px 16px 16px;
  background: #ffffff;
  border-top: 1px solid var(--fcc-border);
  flex-shrink: 0;
  max-height: 52vh;
  overflow-y: auto;
}

.fcc-step-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fcc-muted);
  margin-bottom: 9px;
}

.fcc-options {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.fcc-opt-btn {
  appearance: none;
  width: 100%;
  text-align: left;
  padding: 10px 13px;
  border-radius: 8px;
  border: 1px solid #d9d3c8;
  background: #ffffff;
  color: var(--fcc-ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 450;
  line-height: 1.3;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  box-sizing: border-box;
}

.fcc-opt-btn:hover {
  border-color: var(--fcc-accent);
  background: #f3f8f5;
}

.fcc-opt-btn::after {
  content: '→';
  color: var(--fcc-muted);
  font-size: 14px;
  flex-shrink: 0;
}

.fcc-opt-btn:hover::after {
  color: var(--fcc-accent);
}

.fcc-custom-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
}

.fcc-custom-input {
  flex: 1 1 auto;
  height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #d4cdc2;
  background: var(--fcc-warm);
  color: var(--fcc-ink);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.fcc-custom-input:focus {
  border-color: var(--fcc-accent);
  background: #ffffff;
}

.fcc-custom-send {
  appearance: none;
  flex: 0 0 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--fcc-ink);
  background: var(--fcc-ink);
  color: #ffffff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.fcc-custom-send:hover {
  background: var(--fcc-accent);
  border-color: var(--fcc-accent);
}

/* Множественный выбор 9 категорий */
.fcc-multi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 10px;
}

.fcc-multi-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d9d3c8;
  background: #ffffff;
  font-size: 12.5px;
  line-height: 1.25;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.fcc-multi-item input {
  accent-color: var(--fcc-accent);
  margin: 0;
  flex-shrink: 0;
}

.fcc-multi-item.is-checked {
  border-color: var(--fcc-accent);
  background: #f1f7f4;
  font-weight: 500;
}

/* Форма контакта */
.fcc-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fcc-channels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

@media (max-width: 440px) {
  .fcc-channels {
    grid-template-columns: repeat(2, 1fr);
  }
}

.fcc-channel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 6px;
  border-radius: 8px;
  border: 1px solid #d9d3c8;
  background: #ffffff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.fcc-channel input {
  accent-color: var(--fcc-accent);
  margin: 0;
}

.fcc-channel:has(input:checked) {
  border-color: var(--fcc-accent);
  background: #eef6f2;
  color: var(--fcc-accent-dark);
}

.fcc-inputs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 460px) {
  .fcc-inputs-row {
    grid-template-columns: 1fr;
  }
}

.fcc-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #cfc8bc;
  background: #ffffff;
  color: var(--fcc-ink);
  font-family: inherit;
  font-size: 14px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s ease;
}

.fcc-input:focus {
  border-color: var(--fcc-accent);
}

.fcc-input.is-error {
  border-color: #c73e3e;
  background: #fff7f7;
}

.fcc-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--fcc-ink-soft);
  cursor: pointer;
}

.fcc-consent input {
  margin-top: 2px;
  accent-color: var(--fcc-accent);
  flex-shrink: 0;
}

.fcc-consent a {
  color: var(--fcc-ink);
  text-decoration: underline;
}

.fcc-error-msg {
  font-size: 12.5px;
  color: #b93030;
  margin-top: -4px;
}

.fcc-done-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ---------- Модалка быстрой брони ---------- */

.fcc-book-body {
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.fcc-book-benefit {
  padding: 11px 13px;
  border-radius: 8px;
  background: #eef6f2;
  border: 1px solid #cbe0d5;
  font-size: 13px;
  line-height: 1.4;
  color: #1f4839;
}

.fcc-book-benefit strong {
  color: #143327;
}

.fcc-book-switch {
  padding: 12px 14px;
  border-radius: 9px;
  background: var(--fcc-warm);
  border: 1px solid #d8d0c3;
}

.fcc-book-switch-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.fcc-book-switch-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  min-width: 0;
}

.fcc-book-switch-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--fcc-ink);
}

.fcc-book-switch-cta {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fcc-accent-dark);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s ease;
}

.fcc-book-switch-cta span:first-child {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.fcc-book-switch-cta:hover {
  color: var(--fcc-ink);
}

/* ---------- Плашка режима предпросмотра (только ?flat_chat=preview) ---------- */

.fcc-preview-bar {
  position: fixed;
  right: 16px;
  bottom: 86px;
  z-index: 2147482000;
  max-width: 440px;
  background: rgba(24, 24, 24, 0.94);
  color: #ffffff;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  line-height: 1.35;
}

.fcc-preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.fcc-preview-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #8ee0be;
}

.fcc-preview-close {
  appearance: none;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
}

.fcc-preview-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}

.fcc-preview-link {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  text-decoration: none;
  font-size: 11.5px;
  transition: background-color 0.15s ease;
}

.fcc-preview-link:hover {
  background: rgba(255, 255, 255, 0.24);
}

.fcc-preview-link.is-active {
  background: var(--fcc-accent);
  font-weight: 600;
}

.fcc-preview-log {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 5px;
}

/* Мобильный bottom-sheet */
@media (max-width: 600px) {
  .fcc-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .fcc-modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }

  .fcc-multi-grid {
    grid-template-columns: 1fr;
  }

  .fcc-preview-bar {
    left: 10px;
    right: 10px;
    top: 10px;
    bottom: auto;
    max-width: none;
  }
}
