/**
 * TypingWarriors — Shared Stylesheet (tw-main.css)
 * =================================================
 * Contains: CSS variables, reset, navbar, footer,
 *           ad slots, mobile menu, utility classes.
 *
 * Every page links this file. Page-specific styles
 * go in a <style> block inside that page's <head>.
 *
 * Edit ONLY this file to change navbar/footer styles.
 */

/* ── Google Fonts ───────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;600;700&display=swap');

/* ── Custom Font: KrutiDev 010 ──────────────────────────────────── */
/* NOTE: path is relative from assets/css/ → needs to go up two levels */
@font-face {
    font-family: 'Kruti Dev 010';
    src: url('../fonts/krutidev010.ttf') format('truetype');
    font-display: swap;
}

/* ── CSS Variables (Light Theme) ────────────────────────────────── */
:root {
    --bg:        #f4f7fe;
    --text:      #1a202c;
    --card:      #ffffff;
    --primary:   #4a51d4;
    --primary-dark: #3730a3;
    --accent:    #f97316;
    --nav-bg:    #ffffff;
    --border:    rgba(0, 0, 0, 0.1);
    --ad-bg:     #e2e8f0;
    --success:   #22c55e;
    --warning:   #f59e0b;
    --error:     #ef4444;
    --danger:    #ef4444;
    --hl:        rgba(74, 81, 212, 0.08);
    --hl-strong: rgba(74, 81, 212, 0.15);
    --muted:     #64748b;
    --radius:    14px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --shadow:    0 4px 16px rgba(74,81,212,0.08);
    --shadow-lg: 0 12px 40px rgba(74,81,212,0.14);
    --shadow-xl: 0 24px 60px rgba(74,81,212,0.18);
}

/* ── CSS Variables (Dark Theme) ─────────────────────────────────── */
[data-theme="dark"] {
    --bg:        #0d1117;
    --text:      #f1f5f9;
    --card:      #161b27;
    --primary:   #6366f1;
    --primary-dark: #4f46e5;
    --accent:    #fb923c;
    --nav-bg:    #161b27;
    --border:    rgba(255, 255, 255, 0.08);
    --ad-bg:     #1e293b;
    --success:   #4ade80;
    --warning:   #fbbf24;
    --error:     #f87171;
    --danger:    #f87171;
    --hl:        rgba(99, 102, 241, 0.12);
    --hl-strong: rgba(99, 102, 241, 0.22);
    --muted:     #94a3b8;
    --shadow:    0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
    --shadow-xl: 0 24px 60px rgba(0,0,0,0.5);
}

/* ── Reset ──────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background 0.3s, color 0.3s;
}

html { scroll-behavior: smooth; }

body {
    font-family: "Poppins", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ══════════════════════════════════════════════════════════════════
   NAVBAR
══════════════════════════════════════════════════════════════════ */
#tw-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4%;
    background: var(--nav-bg);
    height: 62px;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 0;
    height: 100%;
    min-width: 0;
    overflow: visible;
    flex: 1;
}

/* Logo */
.logo {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -0.5px;
    cursor: pointer;
    margin-right: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}
.logo-icon    { font-size: 18px; line-height: 1; }
.logo-accent  { color: #f97316; }

/* Nav links */
.nav-link {
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0 9px;
    height: 100%;
    display: flex;
    align-items: center;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}
.nav-link:hover,
.nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
/* Live Daily Test nav link */
.nav-live {
    color: #e53e3e !important;
    font-weight: 700 !important;
}
.nav-live:hover, .nav-live.active {
    color: #c53030 !important;
    border-bottom-color: #e53e3e !important;
}

/* Dropdown */
.nav-dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}
.nav-dropdown-btn {
    background: none;
    border: none;
    font-family: inherit;
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0 9px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.nav-dropdown-btn:hover { color: var(--primary); border-bottom-color: var(--primary); }
.nav-dropdown-btn svg   { width: 12px; height: 12px; transition: transform 0.22s; fill: currentColor; }
.nav-dropdown:hover .nav-dropdown-btn svg { transform: rotate(180deg); }

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--nav-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    min-width: 260px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s;
    padding: 10px;
    z-index: 2000;
}
.nav-dropdown:hover .dropdown-menu,
.nav-dropdown .dropdown-menu.open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}
.dropdown-header {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--primary);
    padding: 6px 12px 4px;
    opacity: 0.7;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}
.dropdown-item:hover       { background: var(--hl); color: var(--primary); }
.dropdown-item .di-icon    { width: 34px; height: 34px; border-radius: 8px; background: var(--hl); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.dropdown-item .di-text    { display: flex; flex-direction: column; }
.dropdown-item .di-title   { font-size: 13px; font-weight: 700; }
.dropdown-item .di-desc    { font-size: 11px; font-weight: 500; opacity: 0.55; margin-top: 1px; }
.dropdown-divider          { height: 1px; background: var(--border); margin: 6px 4px; }

/* Navbar right buttons */
.nav-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.theme-btn,
.lang-btn {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 6px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    font-family: inherit;
    white-space: nowrap;
}
.theme-btn:hover,
.lang-btn:hover { background: var(--primary); color: white; }

/* Hamburger — hidden on desktop */
.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}
.nav-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: 0.3s;
}

/* ══════════════════════════════════════════════════════════════════
   MOBILE MENU
══════════════════════════════════════════════════════════════════ */
.mobile-menu {
    display: none;
    flex-direction: column;
    position: fixed;
    inset: 62px 0 0 0;
    background: var(--nav-bg);
    z-index: 999;
    padding: 16px;
    gap: 4px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    pointer-events: none;
}
.mobile-menu.open {
    transform: translateY(0);
    pointer-events: all;
}
.mobile-link {
    display: block;
    padding: 12px 16px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    transition: background 0.15s;
}
.mobile-link:hover { background: var(--hl); color: var(--primary); }
.mobile-divider    { height: 1px; background: var(--border); margin: 8px 0; }
.mobile-actions    { display: flex; gap: 10px; padding: 8px 0; }

/* ══════════════════════════════════════════════════════════════════
   AD SLOTS
══════════════════════════════════════════════════════════════════ */
.ad-slot  { overflow: hidden; }
.ad-banner {
    width: 100%;
    max-width: 900px;
    margin: 12px auto;
    background: var(--ad-bg);
    padding: 22px;
    text-align: center;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    opacity: 0.6;
    border: 1px dashed var(--border);
}

/* ══════════════════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════════════════ */
.tw-footer {
    background: var(--card);
    border-top: 1px solid var(--border);
    margin-top: 50px;
}
.footer-inner {
    text-align: center;
    padding: 40px 8%;
    max-width: 1200px;
    margin: 0 auto;
}
.footer-copy {
    font-size: 12px;
    opacity: 0.6;
    margin-bottom: 16px;
}
.footer-social {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    color: #fff;
    transition: opacity 0.2s, transform 0.2s;
}
.social-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.social-telegram  { background: #229ED9; }
.social-instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }

.footer-handles {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 16px;
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.footer-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}
.footer-link:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
══════════════════════════════════════════════════════════════════ */
@media (max-width: 960px) {
    .nav-left .nav-link,
    .nav-left .nav-dropdown { display: none; }
    .nav-hamburger { display: flex; }
    .mobile-menu   { display: flex; }
    #tw-navbar { padding: 0 5%; }
}

@media (max-width: 480px) {
    .footer-links { gap: 12px; }
    .footer-social { gap: 10px; }
    .social-btn { padding: 8px 14px; font-size: 12px; }
}

/* ══════════════════════════════════════════════════════════════════
   MOBILE LANDSCAPE
══════════════════════════════════════════════════════════════════ */
@media (max-height: 500px) and (orientation: landscape) {
    /* Shrink navbar so content isn't cut off */
    #tw-navbar { height: 48px; }

    /* Collapse mobile menu to fit smaller viewport */
    .mobile-menu {
        max-height: calc(100vh - 48px);
        overflow-y: auto;
    }

    /* Give main content room to breathe */
    .main-wrapper { padding-top: 8px; padding-bottom: 30px; }

    /* Footer compresses */
    #tw-footer { padding: 20px 5%; }
    .footer-links { gap: 10px; }
}

/* ══════════════════════════════════════════════════════════════════
   AUTH BUTTONS — Login / Sign Up in navbar
   ══════════════════════════════════════════════════════════════════ */
.nav-login-btn {
    padding: 6px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s, border-color .15s;
    border: 2px solid var(--border);
    color: var(--text);
    background: transparent;
}
.nav-login-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.nav-signup-btn {
    padding: 6px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity .15s, transform .15s;
    background: var(--primary);
    color: #fff;
    border: 2px solid var(--primary);
}
.nav-signup-btn:hover { opacity: .88; transform: translateY(-1px); }

/* ── User avatar menu ── */
.nav-user-menu {
    position: relative;
}
.nav-avatar-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 5px 10px 5px 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    transition: border-color .15s, background .15s;
}
.nav-avatar-btn:hover { border-color: var(--primary); background: var(--hl); }
.nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nav-username { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* User dropdown */
.nav-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity .15s, transform .15s;
}
.nav-user-dropdown.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.nud-header {
    padding: 12px 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nud-name  { font-weight: 700; font-size: 13px; color: var(--text); }
.nud-email { font-size: 11px; color: var(--muted); word-break: break-all; }
.nud-divider { height: 1px; background: var(--border); margin: 2px 0; }
.nud-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background .12s;
}
.nud-item:hover { background: var(--hl); }
.nud-logout { color: var(--error); }

/* ── Mobile auth ── */
.mobile-login,
.mobile-signup-link {
    font-weight: 800 !important;
}
.mobile-signup-link { color: var(--primary) !important; }
.mobile-logout { background: none; border: none; width: 100%; text-align: left;
    font-family: inherit; font-size: 14px; color: var(--error); cursor: pointer; }
.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
.mob-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary); color: #fff;
    font-size: 14px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
}
.mob-uname { font-weight: 700; font-size: 13px; color: var(--text); }

/* Leaderboard nav link — gold accent */
.nav-link[data-active-key="leaderboard"] { color: var(--text); }
.nav-link[data-active-key="leaderboard"]:hover,
.nav-link[data-active-key="leaderboard"].active { color: #f59e0b; }
