/* kodislovo-ui.css — единый UI для kodislovo.ru / app.kodislovo.ru */
/* Версия: 2025-12-21 */

:root{
  --bg:#f7f7ff;
  --bg2:#ffffff;
  --header-bg:#ffffff;
  --card:#ffffff;
  --card-soft:#eef2ff;
  --card-2:#eef2ff;
  --text:#111827;
  --body-text:#1f2937;
  --muted:#1f2937;
  --muted-soft:#64748b;
  --muted-2:#64748b;

  --primary:#4f46e5;
  --accent:#7c3aed;
  --primary-hover:#7c3aed;
  --primary-soft:#eef2ff;
  --primary-soft-2:#e0e7ff;

  --border:#ddd6fe;
  --border-strong:#c4b5fd;
  --success:#22c55e;
  --warning:#f59e0b;
  --danger:#ef4444;
  --glow:#818cf8;
  --white:#ffffff;
  --shadow:0 18px 45px rgba(79,70,229,.12);
  --shadow-button:0 10px 22px rgba(79,70,229,.25);

  --radius:18px;
  --radius-btn:14px;

  --maxw:900px;
  --pad:24px;
}

html[data-theme="dark"],
body[data-theme="dark"],
:root[data-theme="dark"]{
  --bg:#0b1020;
  --bg2:#0b1020;
  --header-bg:#0f172a;
  --header:#0f172a;
  --card:#121a33;
  --card-soft:#1a2447;
  --card-2:#1a2447;
  --text:#e9ecff;
  --body-text:#e9ecff;
  --muted:#b8c0ff;
  --muted-soft:#7c86b5;
  --muted-2:#7c86b5;

  --primary:#4f46e5;
  --accent:#7c3aed;
  --primary-hover:#6366f1;
  --primary-soft:#202a52;
  --primary-soft-2:#263466;

  --border:#2b3a7a;
  --border-strong:#5865f2;
  --success:#22c55e;
  --warning:#f59e0b;
  --danger:#ef4444;
  --glow:#818cf8;
  --white:#ffffff;
  --shadow:0 18px 45px rgba(0,0,0,.35);
  --shadow-button:0 12px 28px rgba(129,140,248,.35);
}

html,body{height:100%}
*{box-sizing:border-box}

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:
    radial-gradient(circle at top, rgba(79,70,229,.14), transparent 38%),
    linear-gradient(180deg,var(--bg2),var(--bg) 42%,var(--bg2));
  color:var(--body-text);
}

a{color:inherit}
img{max-width:100%;height:auto}
h1,h2,h3{line-height:1.15}
p{color:var(--muted);line-height:1.6}

/* ===== Topbar / Theme ===== */
.site-topbar{
  position:sticky;
  top:0;
  z-index:20;
  background:color-mix(in srgb,var(--header-bg) 88%,transparent);
  border-bottom:1px solid var(--border);
  backdrop-filter:blur(14px);
}

.site-topbar-inner{
  width:min(1120px,100%);
  margin:0 auto;
  padding:10px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.site-brand{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
  color:var(--text);
  text-decoration:none;
}

.site-logo{
  flex:0 0 auto;
  width:36px;
  height:36px;
  border-radius:12px;
  background:linear-gradient(135deg,var(--primary),var(--primary-hover));
  box-shadow:0 10px 24px rgba(79,70,229,.25);
}

.site-brand b{
  display:block;
  color:var(--text);
  font-size:14px;
  line-height:1.2;
}

.site-brand span span{
  display:block;
  margin-top:2px;
  color:var(--muted);
  font-size:12px;
  line-height:1.2;
}

.theme-toggle{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--muted);
  font-size:13px;
}

.theme-toggle input{display:none}

.theme-switch{
  width:44px;
  height:26px;
  border-radius:999px;
  background:var(--card);
  border:1px solid var(--border);
  position:relative;
  display:inline-block;
}

.theme-knob{
  width:20px;
  height:20px;
  border-radius:50%;
  background:var(--primary);
  position:absolute;
  top:2px;
  left:2px;
  transition:left .2s ease,background .2s ease;
  box-shadow:0 8px 18px rgba(79,70,229,.3);
}

.theme-toggle input:checked+.theme-switch .theme-knob{left:22px}

/* ===== Layout ===== */
.container{
  max-width:var(--maxw);
  margin:0 auto;
  padding:var(--pad);
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:22px;
  box-shadow:var(--shadow);
  transition:transform .2s ease,border-color .2s ease,box-shadow .2s ease;
}

.card:hover{
  transform:translateY(-2px);
  border-color:var(--border-strong);
}

.spacer{height:18px}

/* ===== Buttons ===== */
.btns{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin-top:20px;
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;

  padding:12px 18px;
  border-radius:var(--radius-btn);

  background:linear-gradient(135deg,var(--primary),var(--primary-hover));
  color:var(--white) !important;
  text-decoration:none;

  border:1px solid transparent;
  box-shadow:var(--shadow-button);

  transition:transform .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
  user-select:none;
}

.btn:link,
.btn:visited{color:var(--white) !important}
.btn:hover{transform:translateY(-1px);box-shadow:0 14px 32px rgba(79,70,229,.35)}
.btn:active{transform:translateY(1px)}
.btn.secondary{background:var(--primary-soft); color:var(--primary) !important; border-color:var(--border); box-shadow:none}
.btn.secondary:link,
.btn.secondary:visited{color:var(--primary) !important}
:root[data-theme="dark"] .btn.secondary,
:root[data-theme="dark"] .btn.secondary:link,
:root[data-theme="dark"] .btn.secondary:visited{color:var(--text) !important}
.btn.secondary:hover{background:var(--primary-soft-2); border-color:var(--border-strong); box-shadow:none}
.btn.ghost{background:transparent; border:1px solid var(--border); color:var(--text)}
.btn.full{width:100%}

/* ===== Lists ===== */
ul{color:var(--muted);line-height:1.6;margin:10px 0 0}
li{margin:6px 0}

/* ===== Forms (на будущее, чтобы инпуты не "наезжали") ===== */
.field{display:flex;flex-direction:column;gap:6px}
.label{font-size:14px;color:var(--muted)}
.input, input[type="text"], input[type="number"], select, textarea{
  width:100%;
  max-width:100%;
  min-width:0;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  outline:none;
  background:var(--card);
  color:var(--text);
}
:root[data-theme="dark"] .input,
:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="number"],
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea{background:rgba(255,255,255,.06)}
.input::placeholder, input::placeholder, textarea::placeholder{color:var(--muted-2)}
input:focus, select:focus, textarea:focus{
  border-color:var(--border-strong);
  box-shadow:0 0 0 3px rgba(79,70,229,.18);
}

.grid2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
  align-items:start;
}

/* ===== Russian section pages ===== */
.kd-page{
  width:min(1120px,100%);
  margin:0 auto;
  padding:28px 16px 40px;
}

.kd-hero{
  padding:8px 0 18px;
}

.kd-hero h1{
  margin:8px 0 8px;
  font-size:clamp(30px,5vw,52px);
}

.kd-hero p{
  max-width:760px;
  margin:0;
}

.kd-back{
  display:inline-flex;
  align-items:center;
  min-height:34px;
  color:var(--muted);
  text-decoration:none;
  font-size:14px;
}

.kd-back:hover{text-decoration:underline}

.kd-section{
  margin-top:22px;
}

.kd-section-head{
  display:flex;
  align-items:end;
  justify-content:space-between;
  gap:18px;
  margin-bottom:12px;
}

.kd-section-head h2{
  margin:0;
  font-size:22px;
}

.kd-section-head p{
  margin:0;
  max-width:520px;
  text-align:right;
}

.kd-card-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(230px,1fr));
  gap:14px;
}

.kd-card-grid-compact{
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
}

.kd-card{
  min-height:170px;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:18px;
  border-radius:var(--radius);
  border:1px solid var(--border);
  background:var(--card);
  box-shadow:var(--shadow);
  text-decoration:none;
  transition:transform .2s ease,border-color .2s ease,box-shadow .2s ease;
}

.kd-card:hover{
  transform:translateY(-2px);
  border-color:var(--border-strong);
}

.kd-card-accent{
  background:linear-gradient(135deg,var(--primary-soft),var(--card));
}

.kd-card strong{
  font-size:18px;
  line-height:1.25;
}

.kd-card small{
  color:var(--muted);
  line-height:1.45;
}

.kd-kicker{
  width:max-content;
  max-width:100%;
  padding:5px 9px;
  border-radius:999px;
  color:var(--text);
  background:var(--primary-soft);
  border:1px solid var(--border);
  font-size:12px;
  font-weight:700;
}

.kd-panel{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:22px;
  box-shadow:var(--shadow);
}

.kd-panel h2{
  margin:0 0 10px;
}

.kd-list{
  margin:0 0 18px;
  padding-left:20px;
}

.kd-actions{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
}

.kd-button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:44px;
  padding:0 16px;
  border-radius:var(--radius-btn);
  border:1px solid transparent;
  background:linear-gradient(135deg,var(--primary),var(--primary-hover));
  color:var(--white) !important;
  text-decoration:none;
  box-shadow:var(--shadow-button);
  transition:transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.kd-button:link,
.kd-button:visited{color:var(--white) !important}

.kd-button:hover{
  transform:translateY(-1px);
  box-shadow:0 14px 32px rgba(79,70,229,.35);
}

.kd-button-secondary{
  background:var(--primary-soft);
  color:var(--primary) !important;
  border-color:var(--border);
  box-shadow:none;
}
.kd-button-secondary:link,
.kd-button-secondary:visited{color:var(--primary) !important}
:root[data-theme="dark"] .kd-button-secondary,
:root[data-theme="dark"] .kd-button-secondary:link,
:root[data-theme="dark"] .kd-button-secondary:visited{color:var(--text) !important}

@media (max-width: 820px){
  :root{ --pad:16px; }
  .grid2{grid-template-columns:1fr}
  .kd-section-head{
    display:block;
  }
  .kd-section-head p{
    text-align:left;
    margin-top:6px;
  }
  .kd-card{
    min-height:150px;
  }
}

/* ===== Theme hooks (если захочешь светлую тему позже) ===== */
