/* Светлая тема: срабатывает только когда на html стоит data-theme="light" */

html[data-theme="light"] {
  --bg: #f5f5ff;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-card_c: #ffffff;
  --accent: #4457ff;
  --accent-soft: rgba(68, 87, 255, 0.16);
  --text: #0b1020;
  --muted: #6f6f8c;
  --error: #e0314b;
  --shadow-soft: 0 16px 40px rgba(15, 23, 42, 0.12);
}

/* фон и текст */

html[data-theme="light"] body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* запасной цвет + нормальный градиент */
  background-color: #f5f5ff;
background-image: radial-gradient(circle at top, #f5f5f5, #f5f5f5);

  color: var(--text);
  flex-direction: column;
  height: 100%;
  min-height: 100vh;
  display: flex;
}

/* шапка */

html[data-theme="light"] .site-header {
  background:
    radial-gradient(circle at top left, rgba(92, 107, 255, 0.08), rgba(255, 255, 255, 0.96));
  border-bottom-color: rgba(15, 23, 42, 0.06);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .logo-sub {
  color: var(--muted);
}

/* навигация */

html[data-theme="light"] .nav-link--ghost {
  background: rgb(207, 207, 207);
  border-color: rgba(15, 23, 42, 0.12);
  color: var(--muted);
}

html[data-theme="light"] .nav-link--ghost:hover {
  background: #6b6b6b;
  color: var(--text);
}

/* карточки / фон чата / hero */

html[data-theme="light"] .card,
html[data-theme="light"] .card_c,
html[data-theme="light"] .hero-card,
html[data-theme="light"] .chat-sidebar,
html[data-theme="light"] .free-answer {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.151);

}



/* бабблы */

html[data-theme="light"] .bubble-user {
  background: linear-gradient(135deg, rgba(68, 87, 255, 0.12), rgba(122, 92, 255, 0.25));
  color: #111827;
}

html[data-theme="light"] .bubble-ai {
  background: rgba(15, 23, 42, 0.05);
}

/* textarea / поля */

html[data-theme="light"] textarea,
html[data-theme="light"] .public-search-input {
  background: #ffffff;
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.12);
}

/* кнопки */

html[data-theme="light"] .btn-primary {
  background: linear-gradient(135deg, #4457ff, #7a5cff);
  box-shadow: 0 1px 2px rgba(68, 87, 255, 0.4);
}

html[data-theme="light"] .btn-primary:hover:not(.is-busy) {
  box-shadow: 0 3px 6px rgba(68, 87, 255, 0.6);
}

html[data-theme="light"] .btn-secondary {
  background: #ffffff;
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.14);
}

/* футер */

html[data-theme="light"] .site-footer {
  background: #f3f4ff;
  border-top-color: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .footer-inner {
  color: var(--muted);
}

/* мелкие элементы, чтобы не светились чёрным */

html[data-theme="light"] .chat-sidebar,
html[data-theme="light"] .public-card,
html[data-theme="light"] .public-sidebar-card {
  background: #f5f5f5;
}

html[data-theme="light"] .chat-list-item {
  background: rgba(249, 250, 255, 0.9);
  color: #000000d8;
}

html[data-theme="light"] .chat-list-item:hover {
  background: #eef0ff;
  color: #000000;
}

html[data-theme="light"] .chat-list-item.is-active {
  background: linear-gradient(
    135deg,
    rgba(68, 87, 255, 0.089),
    rgba(122, 92, 255, 0.062)
  );
}

/* Кнопка-карандаш */
html[data-theme="light"]  .chat-edit-toggle-btn {
  border-radius: 999px;
  border: 1px solid rgb(204, 204, 204);
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  cursor: pointer;
  padding: 6px 9px;
  font-size: 0.9rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.08s ease,
    box-shadow 0.12s ease,
    opacity 0.12s ease;
}

html[data-theme="light"]  .chat-edit-toggle-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(92, 107, 255, 0.35);
}

html[data-theme="light"]  .chat-edit-toggle-btn.is-active {
  border-color: var(--error);
  background: rgba(255, 75, 110, 0.12);
  color: #ffb9c9;
  box-shadow: 0 0 0 1px rgba(255, 75, 110, 0.45);
  opacity: 1;
}

/* нормальное состояние кнопки */
html[data-theme="light"]  .chat-sidebar-toggle {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(199, 199, 199, 0.9);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

html[data-theme="light"]  .chat-public-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(214, 214, 214, 0.8);
  padding: 4px 10px 4px 12px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--muted);
}

html[data-theme="light"]  .model-pill {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(207, 209, 221, 0.95);
  color: var(--text);
  padding: 7px 10px;
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease,
    opacity 0.12s ease,
    transform 0.08s ease;
}

html[data-theme="light"]  .icon-btn {
  background: rgba(255, 255, 255, 0.836);
  border-radius: 999px;

  padding: 2px 6px;
  color: inherit;
  cursor: pointer;
  font-size: 1.2rem;
}

html[data-theme="light"]  .hljs {
    color: #ffffff;
    background: #353535;
}

html[data-theme="light"]  .lang-btn {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  font-size: 0.8rem;
  padding: 4px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

html[data-theme="light"]  .chat-sidebar-bulk-actions {
  padding: 6px 10px;
  margin: 4px -4px 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #fff;
  font-size: 12px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* всё внутри кроме кнопки скрываем */
html[data-theme="light"]  .chat-layout.sidebar-collapsed html[data-theme="light"]  .chat-sidebar-title,
html[data-theme="light"]  .chat-layout.sidebar-collapsed html[data-theme="light"]  .btn-new-chat,
html[data-theme="light"]  .chat-layout.sidebar-collapsed html[data-theme="light"]  .chat-list,
html[data-theme="light"]  .chat-layout.sidebar-collapsed html[data-theme="light"]  .chat-edit-toggle-btn,
html[data-theme="light"]  .chat-layout.sidebar-collapsed html[data-theme="light"]  .chat-sidebar-bulk-actions {
  display: none;
}

/* в режиме выбора делаем фон чуть более нейтральным */
 
html[data-theme="light"] .chat-list.is-edit-mode 
html[data-theme="light"] .chat-list-item.is-active {
  background: rgba(102, 111, 141, 0.205);
}

html[data-theme="light"] .model-pill.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(92, 107, 255, 0.6);
  background: radial-gradient(circle at top left, rgba(117, 122, 163, 0.212), rgb(126, 136, 196));
  transform: translateY(-1px);
}

html[data-theme="light"] .hero-preview-body {
  background: rgba(255, 255, 255, 0.45);
  border-radius: 18px;
  padding: 14px;
}

html[data-theme="light"] #free-chat-form textarea {
  width: 100%;
  min-height: 110px;
  max-height: 260px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(4, 8, 25, 0.096);
  color: var(--text);
  padding: 10px 12px;
  resize: none;
  overflow-y: hidden;
  font-family: inherit;
}

html[data-theme="light"] .feature-card {
  background: rgba(5, 8, 26, 0.212);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

html[data-theme="light"] .lang-dropdown {
  position: absolute;
  right: 0;
  margin-top: 4px;
  background: rgba(5, 8, 26, 0.98);
  border-radius: 10px;
  border: 1px solid rgba(184, 184, 184, 0.14);
  padding: 4px;
  min-width: 90px;
  box-shadow: var(--shadow-soft);
  display: none;
  z-index: 100;
}

html[data-theme="light"] .public-sort-select {
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(81, 98, 184, 0.9);
  color: var(--text);
  padding: 4px 8px;
  font-size: 0.8rem;
}

html[data-theme="light"] .code-copy-btn {
  border: none;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  background: rgb(92, 108, 255);
  color: #fff;
  
}

html[data-theme="light"] .nav-link,
html[data-theme="light"] .nav a {
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  color:#000000;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease,
    transform 0.08s ease;
}

html[data-theme="light"] .header-burger {
  display: none;                  /* по умолчанию скрыт, покажем в @media */
  border: none;
  background: transparent;
  padding: 0;
  width: 32px;
  height: 24px;
  border-radius: 999px;
  cursor: pointer;
  outline: none;

  /* БЕЗ повторного display здесь */
  flex-direction: column;        
  justify-content: center;       
  align-items: center;           
}

/* показываем только на мобильных */
/* Светлая тема: гамбургер без фона, серые полоски */
html[data-theme="light"] .header-burger {
  background: transparent;
  box-shadow: none;
}

/* сами палочки делаем серыми */
html[data-theme="light"] .header-burger span {
  background: rgba(0, 0, 0, 0.55); /* можно заменить на var(--muted) */
}

html[data-theme="light"] .code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: rgb(160, 160, 160);
    font-size: 0.75rem;
    color: #CCC;
}

html[data-theme="light"] .icon-btn {
  background: rgba(182, 182, 182, 0.35);
  border-radius: 999px;
  border: 1px solid rgb(202, 202, 202);
  padding: 2px 6px;
  color: inherit;
  cursor: pointer;
  font-size: 0.8rem;
}

html[data-theme="light"] .icon-btn {
  background: rgb(255, 255, 255);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0. 42);
  padding: 4px 8px;
  color: inherit;
  cursor: pointer;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

html[data-theme="light"] .image-viewer-dialog {
  position: relative;
  padding: 10px;
  background: #ffffff;
}

html[data-theme="light"] #iv-marker-controls {
  display: none; /* показываем только в режиме редактирования */
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #000000;
}

html[data-theme="light"] .iv-edit-label {
  display: block;
  font-size: 13px;
  color: #000000;
  margin-bottom: 6px;
}

html[data-theme="light"] .image-viewer-title {
  font-size: 14px;
  color: #000000;
}

html[data-theme="light"] .chat-attachment-card {
  width: 120px;
  padding: 8px;
  border-radius: 8px;
  background: #25252518;
  border: 1px solid #33333328;
  font-size: 11px;
  line-height: 1.3;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

html[data-theme="light"] .attach-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(117, 117, 117, 0.24);
}

html[data-theme="light"] .chat-public-switch {
  position: relative;
  width: 40px;
  height: 20px;
  border-radius: 999px;
  background: rgba(128, 128, 128, 0.651);
  transition: background 0.15s ease;
}

html[data-theme="light"] .code-block-lang {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #000000;
}

/* было position: absolute */
html[data-theme="light"] .chat-list-menu-popup {
  background: #2b3942;
}

/* ===========================
   AUTH (login / register) — light
   =========================== */

html[data-theme="light"] .auth-section {
  padding: 32px 0;
}

html[data-theme="light"] .auth-card {
  background: var(--bg-card);
  border-color: rgba(15, 23, 42, 0.06);
  box-shadow: var(--shadow-soft);
}

html[data-theme="light"] .auth-title {
  color: var(--text);
}

html[data-theme="light"] .auth-subtitle {
  color: var(--muted);
}

html[data-theme="light"] .form-group label {
  color: var(--muted);
}

html[data-theme="light"] .form-group input {
  background: #ffffff;
  color: var(--text);
  border: 1px solid rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .form-group input::placeholder {
  color: rgba(0, 0, 0, 0.38);
}

html[data-theme="light"] .form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(68, 87, 255, 0.3);
}

/* Разделитель */

html[data-theme="light"] .auth-divider {
  color: var(--muted);
}

html[data-theme="light"] .auth-divider::before,
html[data-theme="light"] .auth-divider::after {
  background: rgba(15, 23, 42, 0.08);
}

/* Соц. кнопки в светлой теме */

html[data-theme="light"] .btn-social {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
  color: var(--text);
}

html[data-theme="light"] .btn-social:hover {
  background: #eef0ff;
  border-color: rgba(68, 87, 255, 0.28);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.18);
}

html[data-theme="light"] .btn-social-icon {
  background: rgba(245, 245, 255, 0.9);
}

/* Ошибка */

html[data-theme="light"] .alert-error {
  border-color: rgba(224, 49, 75, 0.7);
  background: rgba(224, 49, 75, 0.08);
  color: #a61b30;
}

/* Низ карточки */

html[data-theme="light"] .auth-alt {
  color: var(--muted);
}

html[data-theme="light"] .auth-alt a {
  color: var(--accent);
}

html[data-theme="light"] .pricing-auth-hint {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
  color: var(--text);
}

html[data-theme="light"] .chat-scroll-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgb(51, 51, 51);
  background: rgb(63, 68, 99);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color:#fff;
}

html[data-theme="light"] .chat-scroll-btn:hover {
  background: rgba(92, 107, 255, 0.3);
}

html[data-theme="light"] .profile-ref-input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 8, 26, 0.096);
  color: var(--text);
  font-size: 0.9rem;
  padding: 8px 12px;
  min-width: 0;
}

/* ===== 404 PAGE LIGHT ===== */

html[data-theme="light"] .error-card {
  background: #ffffff;
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 16px 40px rgba(15,23,42,0.12);
}

html[data-theme="light"] .error-code {
  background: linear-gradient(135deg, #4457ff, #7a5cff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

html[data-theme="light"] .error-title {
  color: #111827;
}

html[data-theme="light"] .error-text {
  color: #4b5563;
}