/* 
  Global Stylesheet for Educational Platform 
  Contains variables, reset, typography, and UI elements.
*/

/* Google Fonts загружаются через <link> в HTML для скорости */

:root {
  /* Colors */
  --bg-primary: #1592e6; /* Blue background */
  --bg-secondary: #0f87d4; /* Darker blue background */
  --card-bg: rgba(255, 255, 255, 0.2); /* Glassmorphism background */
  --card-border: rgba(255, 255, 255, 0.4);
  
  --primary-dark: #0A2B6A; /* Dark blue for primary buttons */
  --primary-light: #ffffff;
  
  --text-main: #ffffff;
  --text-dark: #000000;
  --text-muted: #e4e4e4;

  --success: #28a745;
  --danger: #dc3545;
  --danger-light: #fce8e8;

  --input-bg: #ffffff;
  --input-border: #cccccc;
  
  /* Fonts */
  --font-heading: 'Dela Gothic One', sans-serif;
  --font-body: 'DM Mono', monospace;

  /* Spacing & Radii */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  color: var(--text-main);
  background: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Место под фиксированную шапку (header.js) резервируется сразу — без «прыжка» страницы */
  padding-top: 60px;
}

/* Typography */
h1, h2, h3, h4, .font-heading {
  font-family: var(--font-heading);
  font-weight: 400;
}

.title-main {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  text-align: center;
}

.subtitle {
  font-size: 0.875rem;
  text-align: center;
  margin-bottom: 2rem;
  opacity: 0.9;
}

a {
  color: var(--text-main);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  flex: 1;
}

.flex {
  display: flex;
}
.align-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.justify-center {
  justify-content: center;
}
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }
.flex-column {
  flex-direction: column;
}

/* Glassmorphism Card */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn--primary {
  background-color: var(--primary-dark);
  color: var(--text-main);
}
.btn--primary:hover {
  background-color: #082150;
  transform: translateY(-2px);
}

.btn--secondary {
  background-color: var(--primary-light);
  color: var(--primary-dark);
}
.btn--secondary:hover {
  background-color: #f0f0f0;
  transform: translateY(-2px);
}

.btn--danger {
  background-color: var(--danger);
  color: var(--text-main);
}
.btn--danger:hover {
  filter: brightness(0.9);
}

.btn--icon {
  padding: 0.5rem;
  border-radius: 50%;
}

.btn-block {
  width: 100%;
  margin-bottom: 1rem;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1rem;
  position: relative;
}

.form-control {
  width: 100%;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-dark);
  background-color: var(--input-bg);
  outline: none;
}

.form-control::placeholder {
  color: #a0a0a0;
}

.form-control:focus {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.input-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #a0a0a0;
  cursor: pointer;
}

/* Checkbox */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  line-height: 1.4;
}

.checkbox-custom {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background-color: var(--primary-light);
  border: 1px solid var(--input-border);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  margin-top: 2px;
}

.checkbox-custom:checked {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
}

.checkbox-custom:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-label {
  cursor: pointer;
}

.checkbox-label a {
  text-decoration: underline;
}

/* Popups / Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--primary-light);
  color: var(--text-dark);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 90%;
  max-width: 400px;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  position: relative;
  /* Высокие модалки не обрезаются на низких экранах (телефон в ландшафте) */
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-title {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--text-dark);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  cursor: pointer;
  font-size: 1.5rem;
  color: #a0a0a0;
  border: none;
  background: transparent;
}

/* Красный круглый крестик белых модалок (раньше был только в class.html,
   поэтому в профиле крестики выглядели серыми) */
.modal-close-red {
  background: var(--danger);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  padding-bottom: 2px;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
  .glass-card {
    padding: 1.5rem;
  }
  .title-main {
    font-size: 1.75rem;
  }
}

/* ═══════════════════════════════════════════════════════════════
   MODERN UI v2 — анимации, утилиты, состояния, mobile-friendly
   ═══════════════════════════════════════════════════════════════ */

/* ── Глобальные плавные переходы ─────────────────────────────── */
html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* Поверх body — едва заметные «искры» (фон без картинок) */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(800px 400px at 10% -10%, rgba(255,255,255,.12), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(10,43,106,.35), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

/* Скроллбары */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.4); }

/* ── Focus-visible (для клавиатурной навигации) ─────────────── */
:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  border-radius: 4px;
}
.btn:focus-visible {
  outline: 3px solid rgba(255,255,255,.7);
  outline-offset: 3px;
}

/* ── Кнопки: shimmer-эффект на hover ────────────────────────── */
.btn { position: relative; overflow: hidden; }
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.25) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform .55s ease;
  pointer-events: none;
}
.btn:hover::after { transform: translateX(100%); }
.btn:active { transform: translateY(0) scale(.98); }

.btn--ghost {
  background: rgba(255,255,255,.14);
  color: var(--text-main);
  border: 1px solid rgba(255,255,255,.28);
}
.btn--ghost:hover { background: rgba(255,255,255,.22); transform: translateY(-2px); }
.btn--sm { padding: .5rem .9rem; font-size: .85rem; }
.btn--xs { padding: .3rem .65rem; font-size: .75rem; }

/* ── Glass-card hover ────────────────────────────────────────── */
.glass-card {
  box-shadow: 0 8px 32px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.glass-card.is-interactive:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 50px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.28);
  border-color: rgba(255,255,255,.6);
}

/* ── Анимации появления ─────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop {
  0%   { transform: scale(.85); opacity: 0; }
  60%  { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,211,238,.55); }
  50%      { box-shadow: 0 0 0 10px rgba(34,211,238,0); }
}
@keyframes shimmer {
  0%   { background-position: -300px 0; }
  100% { background-position: 300px 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.anim-fadeup { animation: fadeInUp .45s ease both; }
.anim-fadein { animation: fadeIn .35s ease both; }
.anim-pop    { animation: pop .35s cubic-bezier(.4,1.5,.6,1) both; }
.anim-float  { animation: float 3s ease-in-out infinite; }
.anim-pulse  { animation: pulse 1.8s infinite; }

/* Каскадная задержка для списков */
.stagger > * { animation: fadeInUp .45s ease both; }
.stagger > *:nth-child(1)  { animation-delay: .04s; }
.stagger > *:nth-child(2)  { animation-delay: .08s; }
.stagger > *:nth-child(3)  { animation-delay: .12s; }
.stagger > *:nth-child(4)  { animation-delay: .16s; }
.stagger > *:nth-child(5)  { animation-delay: .20s; }
.stagger > *:nth-child(6)  { animation-delay: .24s; }
.stagger > *:nth-child(7)  { animation-delay: .28s; }
.stagger > *:nth-child(8)  { animation-delay: .32s; }
.stagger > *:nth-child(9)  { animation-delay: .36s; }
.stagger > *:nth-child(10) { animation-delay: .40s; }

/* ── Skeleton-загрузка ──────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,.10) 25%,
    rgba(255,255,255,.22) 50%,
    rgba(255,255,255,.10) 75%);
  background-size: 300px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-sm);
  color: transparent !important;
  pointer-events: none;
}

/* ── Бейджи / пиллы ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .65rem;
  border-radius: 999px;
  background: rgba(255,255,255,.16);
  font-size: .75rem;
  font-family: var(--font-body);
  white-space: nowrap;
  border: 1px solid rgba(255,255,255,.18);
}
.badge--success { background: rgba(34,197,94,.22); border-color: rgba(34,197,94,.45); color: #d1fae5; }
.badge--warn    { background: rgba(245,158,11,.22); border-color: rgba(245,158,11,.45); color: #fde68a; }
.badge--danger  { background: rgba(239,68,68,.22); border-color: rgba(239,68,68,.45); color: #fecaca; }
.badge--info    { background: rgba(34,211,238,.22); border-color: rgba(34,211,238,.45); color: #a5f3fc; }

/* ── Подсказки (info-tip / callout) ─────────────────────────── */
.tip {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .85rem 1rem;
  background: linear-gradient(90deg, rgba(34,211,238,.18) 0%, rgba(34,211,238,.05) 100%);
  border-left: 4px solid #22d3ee;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: rgba(255,255,255,.95);
  line-height: 1.5;
  animation: fadeInUp .4s ease both;
}
.tip .tip-icon { font-size: 1.05rem; line-height: 1.2; flex-shrink: 0; }
.tip--warn { background: linear-gradient(90deg, rgba(245,158,11,.18) 0%, rgba(245,158,11,.05) 100%); border-left-color: #f59e0b; }
.tip--ok   { background: linear-gradient(90deg, rgba(34,197,94,.18) 0%, rgba(34,197,94,.05) 100%); border-left-color: #22c55e; }
.tip--err  { background: linear-gradient(90deg, rgba(239,68,68,.18) 0%, rgba(239,68,68,.05) 100%); border-left-color: #ef4444; }

/* ── Хедер-подзаголовок (страница хеппи-херо) ───────────────── */
.page-hero {
  display: flex; flex-direction: column; gap: .5rem;
  margin-bottom: 1.5rem;
  animation: fadeInUp .4s ease both;
}
.page-hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  line-height: 1.15;
}
.page-hero .hero-sub {
  font-size: .92rem;
  color: rgba(255,255,255,.85);
  max-width: 780px;
  line-height: 1.5;
}
.stat-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .25rem; }
.stat-chips .badge { font-size: .8rem; padding: .35rem .8rem; }

/* ── Прогресс-бар ───────────────────────────────────────────── */
.progress {
  position: relative; width: 100%; height: 8px;
  background: rgba(255,255,255,.16);
  border-radius: 999px; overflow: hidden;
}
.progress > span {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, #22d3ee, #a78bfa);
  border-radius: 999px;
  transition: width .6s cubic-bezier(.4,1.3,.6,1);
}
.progress--lg { height: 12px; }

/* ── Toast (всплывающее уведомление) ────────────────────────── */
.toast-host {
  position: fixed; bottom: 1.2rem; right: 1.2rem;
  display: flex; flex-direction: column; gap: .5rem;
  z-index: 2000; pointer-events: none;
}
.toast {
  background: rgba(10,43,106,.94);
  color: #fff;
  padding: .85rem 1.1rem;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  font-size: .85rem;
  animation: fadeInUp .3s ease both;
  pointer-events: auto;
  min-width: 220px;
  display: flex; align-items: center; gap: .55rem;
}
.toast--ok   { border-left: 4px solid #22c55e; }
.toast--err  { border-left: 4px solid #ef4444; }
.toast--info { border-left: 4px solid #22d3ee; }

/* ── Onboarding-инструкция (тонкая полоска под хедером) ─────── */
.onboard-banner {
  background: linear-gradient(90deg, rgba(255,215,0,.18), rgba(34,211,238,.18));
  border: 1px solid rgba(255,215,0,.35);
  border-radius: var(--radius-md);
  padding: .75rem 1rem;
  display: flex; align-items: center; gap: .6rem;
  margin-bottom: 1.25rem;
  font-size: .85rem;
  animation: fadeInUp .4s ease both;
}
.onboard-banner .close-btn {
  margin-left: auto;
  background: transparent; border: none; color: rgba(255,255,255,.7);
  font-size: 1.1rem; cursor: pointer; padding: 0 .25rem;
}
.onboard-banner .close-btn:hover { color: #fff; }

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  animation: fadeInUp .4s ease both;
}
.empty-state-emoji { font-size: 3rem; margin-bottom: .75rem; animation: float 3s ease-in-out infinite; }
.empty-state-title { font-family: var(--font-heading); font-size: 1.2rem; margin-bottom: .4rem; }
.empty-state-text  { font-size: .9rem; color: rgba(255,255,255,.75); max-width: 420px; margin: 0 auto 1rem; line-height: 1.5; }

/* ── Утилитные классы ───────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: rgba(255,255,255,.7); }
.text-dim    { color: rgba(255,255,255,.5); }
.text-accent { color: #ffd700; }
.text-cyan   { color: #22d3ee; }
.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}.mt-3{margin-top:1.5rem}.mt-4{margin-top:2rem}
.mb-1{margin-bottom:.5rem}.mb-2{margin-bottom:1rem}.mb-3{margin-bottom:1.5rem}.mb-4{margin-bottom:2rem}
.hidden { display: none !important; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.w-100 { width: 100%; }

/* ── Mobile (≤640px) ────────────────────────────────────────── */
@media (max-width: 640px) {
  .container { padding: 1rem .85rem; }
  .glass-card { padding: 1.15rem; border-radius: var(--radius-md); }
  .title-main { font-size: 1.4rem; }
  .subtitle   { font-size: .8rem; margin-bottom: 1rem; }
  .btn { padding: .7rem 1.05rem; font-size: .92rem; }
  .modal-content { padding: 1.25rem; max-height: 90vh; overflow-y: auto; }
  .toast-host { right: .6rem; bottom: .6rem; left: .6rem; }
  .toast { min-width: 0; }
}

/* ── Tablet ─────────────────────────────────────────────────── */
@media (min-width: 641px) and (max-width: 1023px) {
  .container { padding: 1.5rem 1.25rem; }
}

/* ── prefers-reduced-motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

