/* ===========================================
   SMAPP · TOKENS · THEME
   =========================================== */

:root{
  --theme-name:"dark";

  /* базовые фоны */
  --bg:#0B0F14;
  --bg-soft:#0F141C;
  --card:#131922;
  --card-soft:#151C26;
  --bord:rgba(255,255,255,0.08);

  /* текст */
  --text:#E9EEF5;
  --muted:#9BA7B6;

  /* акценты */
  --accent-brand-1:#48F1FF;
  --accent-brand-2:#40CEFE;
  --accent-cta-1:#ff6989;
  --accent-cta-2:#ff8e4d;

  /* алиасы (для совместимости со старыми стилями/JS) */
  --a1:var(--accent-brand-1);
  --a2:var(--accent-brand-2);
  --a3:#ff6989;
  --a-ac1:var(--accent-brand-1);
  --a-ac2:var(--accent-brand-2);
  --a-err:var(--err);

  /* статусы */
  --ok:#22C55E;
  --err:#EF4444;
  --inf:#3B82F6;
  --warn:#F97316;

  /* радиусы/тени */
  --r-sm:10px;
  --r-md:14px;
  --r-lg:18px;
  --r-xl:22px;
  --r-pill:999px;
  --shadow-soft:0 18px 60px rgba(0,0,0,0.35);

  /* типографика */
  --font-sans-main:"Manrope",system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  --font-ui:15px/1.5 var(--font-sans-main);

  /* лейаут */
  --header-h:64px;
  --page-pad:22px;
  

}

:root[data-theme="light"]{
  --theme-name:"light";

  --bg:#F4F6FB;
  --bg-soft:#FFFFFF;
  --card:#FFFFFF;
  --card-soft:#F1F3F9;
  --bord:rgba(15,23,42,0.08);

  --text:#101828;
  --muted:#6B7280;

  --accent-brand-1:#40CEFE;
  --accent-brand-2:#48F1FF;
  --a1:var(--accent-brand-1);
  --a2:var(--accent-brand-2);
  --a3:#E11D48;

  --shadow-soft:0 16px 40px rgba(15,23,42,0.16);
  

}

/* ===========================================
   BASE / RESET
   =========================================== */

html{ color-scheme:dark; scroll-behavior:smooth; scroll-padding-top:calc(var(--header-h) + 8px); }
html[data-theme="light"]{ color-scheme:light; }

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior:auto; }
}

html,body{
  margin:0; padding:0; min-height:100vh;
  background:var(--bg); color:var(--text);
  font:var(--font-ui);
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}

*,*::before,*::after{ box-sizing:border-box; }

a{
  color:var(--a1); text-decoration:none;
  transition:color .16s ease, opacity .16s ease, box-shadow .16s ease;
}
a:hover{ color:#9FE4FF; }
a:active{ opacity:.8; }

:where(button,a,input,select,textarea):focus-visible{
  outline:2px solid rgba(122,215,255,0.7);
  outline-offset:2px;
}

/* скроллбар */
::-webkit-scrollbar{ width:8px; height:8px; }
::-webkit-scrollbar-track{ background:#05070A; }
::-webkit-scrollbar-thumb{ background:rgba(120,140,160,0.8); border-radius:999px; }
::-webkit-scrollbar-thumb:hover{ background:rgba(160,180,200,0.9); }

/* интеграция с Tilda */
.t-body,.t-records,.t-rec,.t-container{ background-color:var(--bg); color:var(--text); }

/* Типографика */
h1,h2,h3,h4,h5,h6{
  margin:0 0 .6em; color:var(--text);
  font-family:var(--font-sans-main); font-weight:800;
}
p{ margin:0 0 .9em; }
.muted, small{ color:var(--muted); }

/* Шрифты SMAPP поверх Tilda */
body,
.t-body,
.t-rec,
.t-container,
.t-col,
.t-text,
.t-descr,
.t-name,
.t-title,
.t-heading,
.t-subtitle,
.t-uptitle,
.t-btn,
.t-btntext,
.t-input,
.t-input__field,
.t-form__inputsbox,
.t-form__title,
.t-form__descr{
  font-family:var(--font-sans-main);
}

/* ===========================================
   LAYOUT & GRID
   =========================================== */
.wrap{ max-width:var(--page-max); margin:0 auto; padding:0 var(--page-pad); }
.row{ display:flex; flex-wrap:wrap; gap:12px; }
.col{ flex:1 1 0; min-width:0; }

/* Кастомный футер-обёртка */
body > .kx-footer-wrap{ max-width:none; width:100%; margin:0; padding:0; }

/* ===========================================
   HEADER / NAVBAR (fixed как в Блоке 1)
   =========================================== */
.site-top{
  position:fixed; top:0; left:0; right:0; z-index:2000;
  height:var(--header-h);
  background:linear-gradient(180deg,rgba(11,15,20,0.96),rgba(11,15,20,0.88));
  backdrop-filter:blur(16px);
  border-bottom:1px solid rgba(255,255,255,0.06);
}
html[data-theme="light"] .site-top{
  background:linear-gradient(180deg,rgba(244,246,251,0.96),rgba(244,246,251,0.9));
  border-bottom-color:rgba(15,23,42,0.06);
}

/* чтобы контент не уезжал под фиксированную шапку */
body{ padding-top:var(--header-h); }

.site-top-inner{
  max-width:var(--page-max); margin:0 auto;
  padding:10px var(--page-pad);
  height:100%;
  display:flex; align-items:center; justify-content:space-between; gap:18px;
}

/* Лого */
.site-logo{
  display:inline-flex; align-items:baseline; gap:0; letter-spacing:0;
  font-size:16px; text-decoration:none;
}
.site-logo .logo-main{ font-weight:800; font-size:15px; color:var(--a1); }
.site-logo .logo-sub{ font-weight:600; font-size:15px; color:#EEF1F2; opacity:.98; }
html[data-theme="light"] .site-logo .logo-sub{ color:#0B2136; }

/* Навигация */
.site-nav{ display:flex; gap:14px; align-items:center; }
.site-nav a{ font-size:14px; color:#8A94A8; }
.site-nav a:hover, .site-nav a.active{ color:#F9FAFB; font-weight:600; }
html[data-theme="light"] .site-nav a{ color:#4B5563; }
html[data-theme="light"] .site-nav a:hover,
html[data-theme="light"] .site-nav a.active{ color:#111827; }

.site-auth{ display:flex; gap:8px; align-items:center; }

/* Бургер */
.burger{
  display:none; width:34px; height:30px; border-radius:10px;
  border:1px solid rgba(255,255,255,0.2); background:rgba(15,20,28,0.9);
  align-items:center; justify-content:center; gap:4px; flex-direction:column; padding:4px;
}
.burger span{ display:block; width:18px; height:2px; border-radius:999px; background:#fff; }
html[data-theme="light"] .burger{ border-color:rgba(15,23,42,0.18); background:rgba(255,255,255,0.9); }
html[data-theme="light"] .burger span{ background:#111827; }

@media (max-width:960px){
  .site-nav{ display:none; }
  .site-auth{ display:none; }
  .burger{ display:flex; }
}

/* ===========================================
   THEME TOGGLE
   =========================================== */
.theme-toggle{ display:inline-flex; align-items:center; gap:6px; }
.theme-toggle__icon,.theme-toggle__text{ position:relative; }
[data-theme-current="dark"]  .theme-toggle__icon::before{ content:"🌙"; }
[data-theme-current="dark"]  .theme-toggle__text::before{ content:"Тёмная"; }
[data-theme-current="light"] .theme-toggle__icon::before{ content:"☀️"; }
[data-theme-current="light"] .theme-toggle__text::before{ content:"Светлая"; }

/* добавить рядом со стилями табов */
.is-hidden { display: none !important; }


/* ===========================================
   CARDS
   =========================================== */
.c-card,.card,.lk-card{
  background:var(--card); border:1px solid var(--bord);
  border-radius:var(--r-lg); padding:18px 20px; box-shadow:var(--shadow-soft);
}
.c-card.soft,.card.soft,.lk-card.soft{ background:var(--card-soft); box-shadow:none; }
.card-ghost{ background:transparent; border:1px solid var(--bord); box-shadow:none; }

/* ===========================================
   BUTTONS
   =========================================== */
.btn,.btn-grad,.btn-ghost,.btn-cta{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 16px; border-radius:var(--r-md); border:1px solid transparent;
  font-weight:700; font-size:14px; cursor:pointer;
  background:rgba(255,255,255,0.04); color:var(--text);
  transition:background .16s, box-shadow .16s, transform .08s, opacity .16s;
}
.btn-grad,.btn-main{ background:linear-gradient(92deg,var(--accent-brand-1),var(--accent-brand-2)); color:#020617; }
.btn-cta{ background:linear-gradient(92deg,var(--accent-cta-1),var(--accent-cta-2)); color:#111827; }
.btn-ghost{ background:rgba(255,255,255,0.03); border-color:var(--bord); }
.btn:hover,.btn-grad:hover,.btn-ghost:hover,.btn-cta:hover{ box-shadow:0 0 0 1px rgba(72,241,255,0.35); transform:translateY(-1px); }
.btn:active,.btn-grad:active,.btn-ghost:active,.btn-cta:active{ transform:translateY(0); box-shadow:none; }

/* ===========================================
   STATUS CHIPS
   =========================================== */
.chip{
  display:inline-flex; align-items:center; gap:6px;
  padding:4px 8px; border-radius:999px; border:1px solid var(--bord);
  font-size:12px; color:var(--muted); background:rgba(15,23,42,0.4);
}
html[data-theme="light"] .chip{ background:rgba(255,255,255,0.7); }
.chip.ok{ border-color:rgba(34,197,94,0.6); color:var(--ok); }
.chip.err{ border-color:rgba(239,68,68,0.7); color:var(--err); }
.chip.inf{ border-color:rgba(59,130,246,0.7); color:var(--inf); }
.chip.warn{ border-color:rgba(249,115,22,0.7); color:var(--warn); }

/* ===========================================
   FORMS
   =========================================== */
.input, .select, textarea,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="tel"], select{
  width:100%; border-radius:var(--r-md); border:1px solid var(--bord);
  background:var(--bg-soft); color:var(--text); padding:9px 11px;
  font:inherit; outline:none;
}
.input::placeholder, textarea::placeholder, input::placeholder{ color:rgba(155,167,182,0.8); }
.input:focus, .select:focus, textarea:focus, input:focus, select:focus{
  border-color:rgba(72,241,255,0.7); box-shadow:0 0 0 1px rgba(72,241,255,0.3);
}

/* Подхват штатных кнопок Tilda */
.t-btn{
  border-radius:var(--r-pill); font-weight:700;
  background:linear-gradient(92deg,var(--accent-brand-1),var(--accent-brand-2));
  color:#020617 !important; border:none;
}
.t-btn:hover{ opacity:.95; }

/* ===========================================
   SECTIONS
   =========================================== */
.section-main{ background:var(--bg); color:var(--text); }
.section-soft{ background:var(--bg-soft); color:var(--text); }
.t-section{ background-color:var(--bg); color:var(--text); }

/* ===========================================
   FLOATING THEME TOGGLE (optional UI)
   =========================================== */
.floating-theme-toggle{
  position:fixed; right:24px; bottom:96px; z-index:2000;
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 10px; border-radius:999px; border:1px solid var(--bord);
  background:rgba(15,23,42,0.9); box-shadow:0 18px 40px rgba(0,0,0,0.45);
  cursor:pointer; transition:transform .12s, box-shadow .16s, background .16s, border-color .16s, opacity .16s;
}
html[data-theme="light"] .floating-theme-toggle{
  background:rgba(255,255,255,0.95); box-shadow:0 18px 40px rgba(15,23,42,0.18);
}
.floating-theme-toggle:hover{ transform:translateY(-1px); box-shadow:0 22px 50px rgba(0,0,0,0.55); }
.floating-theme-toggle__icon{
  position:relative; width:20px; height:20px; border-radius:50%;
  border:2px solid var(--muted); box-shadow:0 0 0 1px transparent; opacity:.7;
  transition:border-color .16s, box-shadow .16s, opacity .16s, background .16s;
}
.floating-theme-toggle__icon::before,
.floating-theme-toggle__icon::after{ content:""; position:absolute; inset:3px; border-radius:inherit; }
.floating-theme-toggle__icon--moon::before{ background:currentColor; }
.floating-theme-toggle__icon--moon::after{ background:var(--bg); transform:translateX(4px); }
.floating-theme-toggle__icon--sun::before{ background:currentColor; }
.floating-theme-toggle__icon--sun::after{ inset:-3px; border-radius:inherit; border:2px solid currentColor; }
html[data-theme="dark"]  .floating-theme-toggle__icon--moon{ border-color:var(--accent-brand-1); box-shadow:0 0 0 1px rgba(72,241,255,0.55); opacity:1; }
html[data-theme="dark"]  .floating-theme-toggle__icon--sun { opacity:.3; }
html[data-theme="light"] .floating-theme-toggle__icon--sun { border-color:var(--accent-brand-1); box-shadow:0 0 0 1px rgba(72,241,255,0.55); opacity:1; }
html[data-theme="light"] .floating-theme-toggle__icon--moon{ opacity:.3; }

/* ===========================================
   AUTH VISIBILITY HELPERS
   =========================================== */

/* По умолчанию: гостевые видимы, пользовательские скрыты */
[data-show="user"]{ display:none; }
[data-show="guest"]{ display:inline-flex; }

/* Когда авторизован — наоборот */
html[data-auth-state="in"] [data-show="user"]{ display:inline-flex; }
html[data-auth-state="in"] [data-show="guest"]{ display:none; }

/* Приватные блоки ЛК/загрузок/истории */
[data-requires-auth]{ display:none; }
html[data-auth-state="in"] [data-requires-auth]{ display:block; }

/* Вариант «блочный» */
[data-show="user"].block, [data-show="guest"].block{ display:none; }
html[data-auth-state="in"] [data-show="user"].block{ display:block; }
html[data-auth-state="in"] [data-show="guest"].block{ display:none; }

/* Вспомогательный гейт */
.auth-gate {
  display:none;
  margin:22px auto;
  max-width:780px;
  padding:20px 22px;
  border-radius:16px;
  border:1px solid var(--bord);
  background:linear-gradient(180deg, rgba(64,206,254,0.08), rgba(72,241,255,0.06));
  box-shadow: var(--shadow-soft);
}
.auth-gate__title { font-weight:800; font-size:18px; margin-bottom:6px; }
.auth-gate__text  { color:var(--muted); margin-bottom:12px; }
.auth-gate__actions { display:flex; gap:10px; flex-wrap:wrap; }
