/* ============================================================
   BASE STYLES  —  единый источник истины
   ============================================================ */

:root {
    --bg-deep:    #fbfdfd;
    --bg-surface: #ffffff;
    --bg-card:    #ffffff;
    --border:     #e5e7eb;
    --accent:     #20e8f2;
    --accent-2:   #f4c343;
    --accent-dark: #0bc4ce;
    --gold:       #f4c343;
    --text-main:  #011212;
    --text-muted: #5c7878;
    --success:      #bbf7d0;
    --success-text: #166534;
    --danger:       #f7778c;
    --danger-text:  #7a1f2b;
    --soft:       #e3fbfc;
    --nav-h:      68px;

    /* [FIX 1] Единый шрифт через переменную — больше нет конфликта */
    --font-body:  'Prompt', 'DM Sans', Arial, sans-serif;
    --font-head:  'Gantari', sans-serif;

    /* type scale — 1.333 (perfect fourth) */
    --fs-xs:  0.75rem;
    --fs-sm:  0.875rem;
    --fs-md:  1rem;
    --fs-lg:  1.333rem;
    --fs-xl:  1.777rem;
    --fs-2xl: 2.369rem;
    --fs-3xl: 3.157rem;
}

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

html { scroll-behavior: smooth; }

body {
    /* [FIX 1] Один font-family из переменной */
    font-family: var(--font-body);
    background-color: var(--bg-deep);
    color: var(--text-main);
    min-height: 100vh;
    padding-top: var(--nav-h);
    background-image:
        linear-gradient(rgba(32,232,242,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(32,232,242,0.05) 1px, transparent 1px);
    background-size: 40px 40px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-head);
    color: var(--text-main);
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4, h5, h6 { font-size: var(--fs-lg); }

.white { color: var(--text-main); }

/* ============ GLOW ORBS ============ */
body::before, body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}
body::before {
    width: 600px; height: 600px;
    top: -200px; left: -200px;
    background: radial-gradient(circle, rgba(32,232,242,0.06) 0%, transparent 70%);
}
body::after {
    width: 500px; height: 500px;
    bottom: -150px; right: -150px;
    background: radial-gradient(circle, rgba(244,195,67,0.06) 0%, transparent 70%);
}

/* ============================================================
   UTILITY — frozen / drag / exercise states
   ============================================================ */

/* frozen — элемент недоступен */
.frozen {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    transition: opacity .2s ease, filter .2s ease;
}

/* [FIX 3] input.frozen — успех-палитра */
input.frozen, textarea.frozen, select.frozen {
    background-color: rgba(187,247,208,0.35);
    border-color: var(--success);
    color: var(--success-text);
}

/* [FIX 4] drag-area */
.drag-area {
    min-height: 60px;
    background-color: var(--bg-card);
    border: 1px dashed var(--border);
    padding: 10px;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.drag-area.dragover {
    background-color: rgba(32,232,242,0.08);
    border-color: var(--accent);
}

/* [FIX 4] draggable */
.draggable {
    background-color: #ffffff;
    border: 1px solid var(--accent);
    color: var(--text-main);
    border-radius: 6px;
    padding: 8px 14px;
    cursor: grab;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    user-select: none;
    transition: transform 0.2s, background-color 0.2s, opacity .2s, box-shadow .15s, border-color .15s;
    box-shadow: 0 2px 8px rgba(1,18,18,0.08);
}

.draggable.dragging {
    opacity: 0.6;
    transform: scale(1.05);
    cursor: grabbing;
}

.draggable.tap-selected {
    border-color: var(--accent);
    background: rgba(33,184,166,.12);
    box-shadow: 0 0 0 2px var(--accent);
}

/* правильный ответ */
.correct-text {
    color: var(--success-text);
    font-weight: 600;
}

/* неправильный ответ */
.draggable.wrong, .error-anim, .option-btn.error-anim {
    border-color: var(--danger) !important;
    animation: shake 0.2s;
}

@keyframes shake {
    0%   { transform: translateX(0); }
    25%  { transform: translateX(-6px); }
    50%  { transform: translateX(6px); }
    75%  { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}

/* [FIX 5] option-btn */
.option-btn.selected {
    background-color: var(--accent);
    color: var(--text-main);
}

.check-task { display: inline-block; }

/* ============================================================
   NAVBAR
   ============================================================ */

.site-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    z-index: 1000;
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s ease;
}
.site-nav.scrolled {
    background: rgba(255,255,255,0.92);
}
.nav-inner-bar {
    max-width: 1100px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
}

/* Brand */
.nav-brand {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: var(--fs-lg);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.nav-brand .brand-logo {
    height: 40px;
    width: auto;
    display: block;
}

/* Nav links */
.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0; padding: 0;
    flex: 1;
}
.nav-links .nav-link-item a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: var(--fs-sm);
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 8px;
    position: relative;
    transition: color 0.2s, background 0.2s;
    display: block;
}
.nav-links .nav-link-item a::after {
    content: '';
    position: absolute;
    bottom: 2px; left: 50%; right: 50%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: 2px;
    transition: left 0.25s, right 0.25s;
}
.nav-links .nav-link-item a:hover {
    color: var(--text-main);
    background: rgba(1,18,18,0.045);
}
.nav-links .nav-link-item a:hover::after,
.nav-links .nav-link-item a.active-link::after {
    left: 14px; right: 14px;
}
.nav-links .nav-link-item a.active-link { color: var(--text-main); }

/* Nav actions */
.nav-actions {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0; padding: 0;
}

.nav-clock {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    color: var(--text-main);
    font-size: var(--fs-xs);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.nav-clock i {
    color: var(--accent-dark);
    font-size: 0.85rem;
}

.site-nav .nav-clock {
    background: var(--soft) !important;
    border-radius: 999px;
}


/* ============================================================
   BUTTONS
   ============================================================ */

/* [FIX 2] Навбарная кнопка — отдельный класс, нет конфликта */
.btn-enroll-nav {
    background: linear-gradient(135deg, var(--gold), #f4a13e);
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.82rem;
    padding: 7px 18px;
    border-radius: 8px;
    text-decoration: none;
    letter-spacing: 0.02em;
    border: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    display: inline-block;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    box-shadow: 0 0 14px rgba(244,195,67,0.35);
}
.btn-enroll-nav:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 22px rgba(244,195,67,0.5);
    opacity: 0.9;
    color: var(--text-main);
}
.btn-enroll-nav:focus,
.btn-enroll-nav:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(244,195,67,0.4);
}

/* [FIX 2] Кнопка в карточках курсов — отдельный класс */
.btn-enroll-course {
    background: var(--accent);
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.88rem;
    padding: 10px 22px;
    border-radius: 8px;
    text-decoration: none;
    letter-spacing: 0.02em;
    border: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    display: inline-block;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.btn-enroll-course:hover {
    background: var(--accent-dark);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(32,232,242,0.4);
}
.btn-enroll-course:focus,
.btn-enroll-course:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(32,232,242,0.35);
}

/* Ghost nav buttons */
.btn-nav-ghost {
    color: var(--text-muted);
    text-decoration: none;
    font-size: var(--fs-sm);
    font-weight: 500;
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.btn-nav-ghost:hover {
    color: var(--text-main);
    border-color: var(--border);
    background: rgba(1,18,18,0.04);
}
.btn-nav-ghost.outlined {
    border-color: rgba(32,232,242,0.45);
    color: var(--accent-dark);
}
.btn-nav-ghost.outlined:hover {
    background: rgba(32,232,242,0.08);
    border-color: var(--accent);
}

/* ============================================================
   USER DROPDOWN
   ============================================================ */

.user-trigger {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 14px 6px 6px;
    border-radius: 40px;
    border: 1px solid var(--border);
    cursor: pointer;
    text-decoration: none;
    color: var(--text-main);
    font-size: var(--fs-sm);
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
    background: rgba(1,18,18,0.03);
}
.user-trigger:hover {
    background: rgba(1,18,18,0.06);
    border-color: rgba(32,232,242,0.4);
    color: var(--text-main);
}
.user-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--text-main);
    flex-shrink: 0;
}

.custom-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 20px 60px rgba(1,18,18,0.12), 0 0 0 1px rgba(1,18,18,0.02);
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}
.user-dropdown-wrap { position: relative; }
.user-dropdown-wrap::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 10px;
}
.user-dropdown-wrap:hover .custom-dropdown,
.user-dropdown-wrap.open .custom-dropdown {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.custom-dropdown a,
.custom-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: var(--fs-sm);
    font-weight: 500;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: left;
}
.custom-dropdown a:hover,
.custom-dropdown button:hover {
    background: rgba(1,18,18,0.05);
    color: var(--text-main);
}
.custom-dropdown button.danger:hover {
    background: rgba(247,119,140,0.12);
    color: var(--danger-text);
}
.custom-dropdown .dropdown-sep {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}
.custom-dropdown .icon-wrap {
    width: 28px; height: 28px;
    border-radius: 7px;
    background: rgba(1,18,18,0.04);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* ============================================================
   MOBILE NAV
   ============================================================ */

.nav-toggler {
    display: none;
    background: rgba(1,18,18,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 38px; height: 38px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    margin-left: auto;
}
.nav-toggler span {
    display: block;
    width: 20px; height: 2px;
    background: var(--text-main);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: var(--nav-h); left: 0; right: 0;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px 24px;
    z-index: 999;
    flex-direction: column;
    gap: 4px;
}
.mobile-menu.open { display: flex; }
.mobile-menu a, .mobile-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background 0.15s, color 0.15s;
}
.mobile-menu a:hover { background: rgba(1,18,18,0.05); color: var(--text-main); }
.mobile-menu .mobile-sep { height: 1px; background: var(--border); margin: 8px 0; }
.mobile-menu .btn-enroll-m {
    background: linear-gradient(135deg, var(--gold), #f4a13e);
    color: var(--text-main);
    font-weight: 700;
    border-radius: 10px;
    text-align: center;
    justify-content: center;
    margin-top: 4px;
}

/* ============================================================
   CONTENT / SCROLLBAR
   ============================================================ */

.page-content { position: relative; z-index: 1; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .nav-links, .nav-actions { display: none !important; }
    .nav-toggler { display: flex; }
}
