/* Shared navbar — the ONE source of truth for the menu on every page.
   Pages with their own inline <style> load this so the nav is identical
   everywhere. The markup itself is built by assets/site.js.
   Edit the menu ITEMS in site.js (NAV / COURSES / EXTRAS), not here. */

/* Self-contained: nav.css is loaded by pages that have their own inline
   <style> and may not reset link styling, so the nav resets its own. */
header a, .mobile-menu a { text-decoration: none; }
header *, .mobile-menu * { box-sizing: border-box; }

/* ─── HEADER / NAV ──────────────────────────────────────────────────────── */
/* Floating rounded pill, matching the hand-built pages. */
header {
    position: fixed; top: 20px; left: 0; right: 0; z-index: 1000;
    display: flex; justify-content: center; padding: 0 20px; pointer-events: none;
}
.glass-nav {
    pointer-events: auto;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 12px 30px;
    width: 100%; max-width: 1060px; margin: 0 auto;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.logo { font-weight: 800; font-size: 1.2rem; color: #fff; letter-spacing: -0.5px; }
.logo span { color: var(--primary); }
.nav-links { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; }
.nav-item {
    padding: 8px 13px; border-radius: 20px; font-size: 0.9rem;
    font-weight: 600; color: var(--text-muted); white-space: nowrap;
}
.nav-item:hover, .nav-item.active { color: #fff; background: rgba(255,255,255,0.06); }
.nav-btn-contact {
    background: var(--primary-gradient); color: #fff !important;
    padding: 11px 18px; line-height: 1.2; border-radius: 50px; font-weight: 700;
}
.nav-btn-contact:hover { background: var(--primary-dark); }
.nav-btn-logout {
    background: rgba(239, 68, 68, 0.15); color: #f87171 !important;
    padding: 10px 18px; border-radius: 50px; font-weight: 700;
    /* The border is drawn INSIDE the box: with the default outside border this
       button measured 45px against 39px for every sibling, and bulged out of a
       pill that has only 13px of vertical clearance. */
    border: 1px solid rgba(239, 68, 68, 0.2);
    box-sizing: border-box;
    /* Matches .nav-item: 8px padding top+bottom over a 1.2 line-height. */
    padding: 10px 18px; line-height: 1.2;
}
.nav-btn-logout:hover { background: rgba(239, 68, 68, 0.25); color: #fca5a5 !important; }

.dropdown { position: relative; }
.dropbtn { cursor: pointer; }
.dropdown-content {
    /* visibility, not display: display:none cannot be transitioned, so the menu
       vanished the instant the pointer left the button. */
    visibility: hidden; opacity: 0;
    position: absolute; top: 100%; left: 0; min-width: 220px;
    background: #1e293b; border: 1px solid var(--glass-border);
    border-radius: 14px; padding: 8px; margin-top: 6px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    /* Closing waits 220ms, so crossing the gap or moving diagonally towards a
       link no longer dismisses the menu. Opening is immediate. */
    transition: visibility 0s linear 0.22s, opacity 0.15s ease 0.07s;
}
/* The 6px margin-top above is a dead zone where the pointer is over neither
   the button nor the menu — that is what made the dropdown unusable. This
   bridges it with an invisible strip so the hover never breaks. */
.dropdown-content::before {
    content: ''; position: absolute;
    top: -10px; left: 0; right: 0; height: 10px;
}
.dropdown:hover .dropdown-content,
.dropdown:focus-within .dropdown-content {
    visibility: visible; opacity: 1;
    transition: visibility 0s, opacity 0.15s ease;
}
.dropdown-content a {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    border-radius: 10px; font-size: 0.9rem; color: var(--text-muted);
}
.dropdown-content a:hover { background: rgba(255,255,255,0.06); color: #fff; }

/* ─── MOBILE NAV ────────────────────────────────────────────────────────── */
/* Matches the design the hand-built pages used: a 44px tappable button and a
   floating rounded panel, rather than a flat bar stuck under the header. */
.hamburger {
    display: none; flex-direction: column; gap: 5px; cursor: pointer;
    justify-content: center; align-items: center;
    width: 44px; height: 44px; padding: 0; border-radius: 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border); transition: background 0.2s;
}
.hamburger:hover { background: rgba(255,255,255,0.1); }
.hamburger span {
    display: block; width: 22px; height: 2px;
    background: #fff; border-radius: 2px; transition: all 0.3s ease;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Positioned against .glass-nav, which is position:relative under 900px. */
.mobile-menu {
    display: none; position: absolute;
    top: calc(100% + 12px); left: 0; right: 0;
    background: rgba(10, 18, 38, 0.97);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border); border-radius: 24px;
    padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    flex-direction: column; gap: 4px; z-index: 999;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
    color: #cbd5e1; font-size: 1rem; font-weight: 600;
    padding: 14px 18px; min-height: 48px;
    display: flex; align-items: center;
    border-radius: 14px; transition: all 0.2s;
}
.mobile-menu a:hover { background: rgba(59,130,246,0.12); color: #fff; }
.mobile-divider { height: 1px; background: var(--glass-border); margin: 6px 0; }
.mobile-section-title {
    color: var(--text-muted); font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.5px; padding: 8px 18px 4px;
}
.mobile-cta {
    background: var(--primary-gradient); color: #fff !important;
    justify-content: center; margin-top: 6px; font-weight: 700; border-radius: 14px;
}

/* 1120px, not 900: the logged-in menu (with Сертификати) needs ~1010px and
   overflowed the pill between 900 and 1120, which is what made it look
   it look cramped. Below this width everything moves into the hamburger. */
@media (max-width: 1120px) {
    .nav-links { display: none; }
    .hamburger { display: flex; }
    /* relative, so the absolutely-positioned .mobile-menu hangs off the pill. */
    .glass-nav { position: relative; border-radius: 20px; }
}

/* ─── FOOTER ────────────────────────────────────────────────────────────── */
/* Same source of truth as the nav: the markup comes from site.js
   (renderFooter), these are its styles. Edit footer LINKS in site.js. */
footer { border-top: 1px solid var(--glass-border); padding: 46px 0 30px; margin-top: 40px; }
/* 5 columns on desktop (the footer has 5), collapsing down by breakpoint.
   auto-fit with minmax(200px) capped it at 4 and wrapped Контакти alone. */
.footer-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 32px; }
@media (max-width: 1100px) { .footer-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px)  { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .footer-grid { grid-template-columns: 1fr; gap: 28px; } }
.footer-col .footer-brand { font-size: 1.3rem; font-weight: 800; color: #fff; margin-bottom: 12px; display: block; }
.footer-col h2, .footer-col h3 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 1px; color: #fff; margin-bottom: 14px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 9px; }
.footer-col a { color: var(--text-muted); font-size: 0.9rem; }
.footer-col a:hover { color: var(--primary); }

/* Social icons — 44px, the minimum comfortable touch target.
   .socials is the older class name some pages used; both are supported. */
.socials, .social-links-footer {
    display: flex; justify-content: flex-start; gap: 12px; margin-top: 10px;
}
/* The .footer-col selector is repeated so these win over `.footer-col a`. */
.footer-col ul li .socials a, .footer-col ul li .social-links-footer a,
.socials a, .social-links-footer a {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0; border-radius: 50%;
    background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border);
    color: var(--text-muted); flex: 0 0 auto;
}
.socials a svg, .social-links-footer a svg { display: block; }
.socials a:hover, .social-links-footer a:hover {
    background: var(--primary); color: #fff; border-color: var(--primary);
}
.footer-bottom {
    margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--glass-border);
    text-align: center; color: #64748b; font-size: 0.85rem;
}

/* ─── COOKIE NOTICE ─────────────────────────────────────────────────────── */
/* A notice, not a consent gate — see the comment in site.js for why there is
   no Reject button. Sits bottom-left so it never covers the footer CTA, and
   is narrow enough on desktop to leave the page usable while it is up. */
.cookie-notice {
    position: fixed; z-index: 1200;
    left: 20px; bottom: 20px; right: auto;
    max-width: 420px;
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px;
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border); border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    /* Starts off-screen; .shown slides it in once it has painted. */
    transform: translateY(140%); opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.cookie-notice.shown  { transform: translateY(0); opacity: 1; }
.cookie-notice.hiding { transform: translateY(140%); opacity: 0; }
.cookie-notice p {
    margin: 0; font-size: 0.85rem; line-height: 1.5; color: var(--text-muted);
}
.cookie-notice a { color: var(--primary); font-weight: 600; text-decoration: underline; }
.cookie-notice a:hover { color: #60a5fa; }
.cookie-ok {
    flex: 0 0 auto; cursor: pointer;
    padding: 10px 18px; border: none; border-radius: 50px;
    background: var(--primary-gradient); color: #fff;
    font-family: inherit; font-size: 0.85rem; font-weight: 700;
    line-height: 1.2;
    transition: transform 0.2s, box-shadow 0.2s;
}
.cookie-ok:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -4px rgba(59, 130, 246, 0.5); }

@media (max-width: 560px) {
    /* Full width on phones, and the button drops below the text so neither
       gets squeezed to an unreadable width. */
    .cookie-notice {
        left: 12px; right: 12px; bottom: 12px; max-width: none;
        flex-direction: column; align-items: stretch; gap: 10px;
    }
    .cookie-ok { width: 100%; padding: 12px 18px; }
}
