/* StyleGenie — статическая версия для GitHub Pages */
@font-face {
  font-family: 'NauryzRedKeds';
  src: url('../fonts/NauryzRedKeds.woff2') format('woff2'),
       url('../fonts/NauryzRedKeds.woff') format('woff'),
       url('../fonts/NauryzRedKeds.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-inter: 'Inter', system-ui, sans-serif;
  --font-nauryz: 'NauryzRedKeds', 'Oswald', sans-serif;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --black: #000000;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* Прелоадер */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.preloader-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-content {
  text-align: center;
}

.preloader-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--gray-900);
  border-radius: 50%;
  animation: preloader-spin 1s linear infinite;
  margin: 0 auto 16px;
}

.preloader-text {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--gray-600);
  font-family: var(--font-inter);
}

@keyframes preloader-spin {
  to {
    transform: rotate(360deg);
  }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-inter);
  font-size: 15px;
  color: var(--gray-900);
  background-color: #f2f3f5;
  background-image: linear-gradient(rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.85)), url('../images/background.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  transition: background-image 0.4s ease, background-color 0.4s ease;
}

/* Когда идёт диалог (чат виден) — убираем картинку с фона */
body.dialog-active {
  background-image: none;
  background-color: var(--white);
}

/* Header */
.header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);
}

.header-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-900);
}

.header-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--gray-600);
}


.header-nav a {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.header-nav a:hover {
  color: var(--gray-900);
}

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.main.has-content {
  justify-content: flex-start;
}

.main:not(.has-content) {
  justify-content: center;
  align-items: center;
  padding: 32px 16px;
}

/* Empty state */
.empty-state {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  text-align: center;
  position: relative;
  overflow: visible;
}

.empty-state-content {
  position: relative;
  z-index: 1;
  max-width: 48rem;
  margin: 0 auto;
}

/* Фигурки по бокам — разведены в стороны от центральной панели */
.figurines-wrap {
  position: absolute;
  left: -24%;
  right: -24%;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.figurines-wrap.figurines-hidden {
  opacity: 0;
  visibility: hidden;
}

.figurine {
  flex-shrink: 0;
  width: 273px;
}

/* Мобильная версия: фигурки в центре над заголовком */
@media (max-width: 767px) {
  .figurines-wrap {
    left: 50%;
    right: auto;
    top: -35%;
    transform: translateX(-50%) translateY(0);
    justify-content: center;
    gap: 8px;
  }
  .figurine {
    width: 220px;
  }
  .figurine-left {
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;
  }
  .figurine-right {
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;
  }
}

@media (min-width: 768px) {
  .figurine {
    width: 364px;
  }
}

.figurine img {
  width: 100%;
  height: auto;
  display: block;
}

/* Девушка слева — приподнята, сдвинута вправо к строке поиска */
.figurine-left {
  align-self: flex-end;
  margin-bottom: 18%;
  margin-right: 0;
  margin-left: 4%;
  opacity: 0;
  animation: figurineFlyInLeft 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Парень справа — сдвинут вниз и влево к стеклянной панели */
.figurine-right {
  align-self: flex-end;
  margin-bottom: 4%;
  margin-left: 0;
  margin-right: -2%;
  opacity: 0;
  animation: figurineFlyInRight 1s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

@keyframes figurineFlyInLeft {
  from {
    opacity: 0;
    transform: translateX(-140px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes figurineFlyInRight {
  from {
    opacity: 0;
    transform: translateX(140px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* Общая стеклянная рамка: заголовок + подзаголовок + ввод + бегущая строка */
.empty-state-glass {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  padding: 28px 24px 24px;
  background: rgba(255, 255, 255, 0.35);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 12px 40px rgba(0, 0, 0, 0.08);
}

.empty-title {
  margin: 0 0 12px;
  font-family: var(--font-inter);
  font-size: 1.1rem;
  font-weight: 700;
  font-style: normal;
  color: var(--black);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

@media (max-width: 767px) {
  .empty-title {
    font-size: 1.3rem;
  }
  .empty-state-glass {
    margin-top: 40px;
  }
  .marketplaces-ticker-item {
    font-size: 1rem;
  }
  .input-form input[type="text"] {
    font-size: 16px;
  }
}

@media (min-width: 768px) {
  .empty-title {
    font-size: 1.5rem;
  }
}

.input-bar-wrap {
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
}

.empty-state-glass .input-bar-wrap {
  margin-top: 16px;
}

.empty-state-glass .input-form {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.03);
}

/* Бегущая строка названий маркетплейсов под полем ввода, плавно исчезает у фигур */
.empty-state-glass .marketplaces-ticker-wrap {
  margin-top: 20px;
}

.home-concept-link-wrap {
  margin: 20px 0 0;
  text-align: center;
}

.home-concept-link {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.4);
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.home-concept-link:hover {
  color: var(--gray-900);
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.12);
}

.footer a {
  color: var(--gray-500);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer a:hover {
  color: var(--gray-700);
}

.marketplaces-ticker-wrap {
  position: relative;
  width: 100%;
  max-width: 56rem;
  margin: 24px auto 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 20%, black 80%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 20%, black 80%, transparent 100%);
}

.marketplaces-ticker {
  overflow: hidden;
}

.marketplaces-ticker-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  width: max-content;
  animation: marketplaces-ticker-scroll 45s linear infinite;
}

.marketplaces-ticker-inner:hover {
  animation-play-state: paused;
}

.marketplaces-ticker-item {
  flex-shrink: 0;
  padding: 4px 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  white-space: nowrap;
}

@keyframes marketplaces-ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.preview-wrap {
  position: relative;
  display: inline-block;
  width: 64px;
  height: 64px;
  margin-bottom: 8px;
  border-radius: 8px;
  overflow: hidden;
}

.preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-remove {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--gray-700);
  color: var(--white);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-wrap-inline {
  margin-bottom: 8px;
}

/* Input form */
.input-form {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 1rem;
  border: 1px solid var(--gray-200);
  background: var(--white);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s;
}

/* Стеклянная рамка только на главной (empty state) */
.empty-state-content .input-bar-wrap .input-form:hover {
  border-color: rgba(255, 255, 255, 0.8);
}

.input-form:hover {
  border-color: var(--gray-300);
}

.input-form input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--gray-900);
  outline: none;
}

.input-form input[type="text"]::placeholder {
  color: var(--gray-400);
}

.hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.btn-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  color: var(--gray-500);
}

.btn-icon:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-icon svg {
  display: block;
}

.btn-send {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.btn-send svg {
  stroke: currentColor;
}

.btn-send:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Chat wrap */
.chat-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.messages-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px;
}

.messages-inner {
  max-width: 48rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Message bubble */
.msg {
  display: flex;
  max-width: 85%;
}

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

.msg.assistant {
  align-self: flex-start;
  justify-content: flex-start;
}

.msg-bubble {
  max-width: 100%;
  padding: 16px 20px;
  border-radius: 1rem;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
}

.msg.user .msg-bubble {
  background: var(--gray-900);
  color: var(--white);
}

.msg.assistant .msg-bubble {
  background: var(--gray-100);
  color: var(--gray-900);
  border: 1px solid var(--gray-200);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.msg-bubble .msg-image {
  width: 112px;
  height: 112px;
  margin-bottom: 8px;
  border-radius: 8px;
  overflow: hidden;
}

.msg-bubble .msg-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.msg-content {
  margin: 0;
}

/* Product / Master cards */
.cards-group {
  margin-top: 16px;
}

.cards-group + .cards-group {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-300);
}

.cards-group-title {
  margin: 0 0 12px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (min-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.card-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
}

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--white);
  font-size: 12px;
}

.card-link {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-700);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s;
}

.card-link:hover {
  background: var(--white);
}

.card-thumbs {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-top: 1px solid var(--gray-200);
  overflow-x: auto;
}

.card-thumb {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  padding: 12px;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
}

.card-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-900);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-brand {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--gray-500);
}

.card-price {
  margin: 4px 0 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
}

/* Quick replies */
.quick-replies {
  margin-top: 12px;
}

.quick-replies-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-reply-btn {
  padding: 8px 12px;
  border: none;
  border-radius: 12px;
  background: var(--gray-900);
  color: var(--white);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.quick-reply-btn:hover {
  background: var(--gray-800);
}

.quick-reply-discount-wrap {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--gray-300);
}

.quick-reply-discount-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 12px;
  background: var(--gray-900);
  color: var(--white);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
}

@media (min-width: 640px) {
  .quick-reply-discount-btn {
    width: auto;
  }
}

/* Loading */
.loading-bubble {
  display: flex;
  justify-content: flex-start;
  max-width: 48rem;
  margin: 0 auto 24px;
}

.loading-bubble-inner {
  padding: 12px 16px;
  border-radius: 1rem;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-top-color: var(--gray-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Input bar fixed */
.input-bar-fixed {
  flex-shrink: 0;
  padding: 16px;
  border-top: 1px solid rgba(229, 231, 235, 0.8);
  background: var(--white);
}

.input-bar-fixed .input-form {
  max-width: 48rem;
  margin: 0 auto;
}

/* Footer */
.footer {
  flex-shrink: 0;
  padding: 8px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--gray-400);
}

/* Line clamp helper */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Модальное окно маркетплейсов */
.marketplaces-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.marketplaces-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.marketplaces-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.marketplaces-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: auto;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  padding: 24px;
}

.marketplaces-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.marketplaces-panel-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
}

.marketplaces-close {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.marketplaces-close:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

.marketplaces-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 480px) {
  .marketplaces-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.marketplaces-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  text-decoration: none;
  color: var(--gray-800);
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.marketplaces-item:hover {
  border-color: var(--gray-300);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.marketplaces-item-icon-wrap {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  position: relative;
}

.marketplaces-item-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--gray-100);
  object-fit: contain;
  padding: 4px;
  display: block;
}

.marketplaces-item-icon.fallback {
  position: absolute;
  left: 0;
  top: 0;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--gray-200);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
}
