/**
 * global.css — Codexar Shared Visual Base
 * Applies ambient aesthetics to all interior pages without
 * breaking layouts or adding unwanted spacing/overflow.
 */

/* ── Root tokens — DARK theme (default) ── */
:root {
    --glow-cyan:    rgba(0, 255, 204, 0.12);
    --glow-cyan-hi: rgba(0, 255, 204, 0.30);
    --accent-cyan:  #00ffcc;
    --accent-green: #39ff14;
    --accent-red:   #ff3366;
    --bg-dark:      #0a0a0e;
    --bg-deep:      #07070f;
    --bg-card:      #13131a;
    --bg-secondary: #1a1a24;
    --border-color: #1a1a28;
    --border-subtle: rgba(0, 255, 204, 0.10);
    --font-mono:    'JetBrains Mono', monospace;
    --font-body:    'Inter', sans-serif;
    --text-light:   #e8e8f0;
    --text-primary: #e8e8f0;
    --text-muted:   #e8e8f0;
    /* Auth.css aliases */
    --bg:           #0a0a0e;
    --text:         #e8e8f0;
    --muted:        #e8e8f0;
    --accent:       #00ffcc;
    --accent-dim:   rgba(0, 255, 204, 0.12);
    --border:       rgba(0, 255, 204, 0.1);
    /* Semantic tokens */
    --color-bg:         #0a0a0e;
    --color-surface:    #13131a;
    --color-border:     #1a1a28;
    --color-primary:    #00ffcc;
    --color-secondary:  rgba(0, 255, 204, 0.6);
    --color-text:       #e8e8f0;
    --color-text-muted: #e8e8f0;
    --color-success:    #39ff14;
    --color-danger:     #ff3366;
    --color-warning:    #ffcc00;
}

/* ── Body reinforcement (no extra margin/padding) ── */
body {
    background-color: var(--bg-dark) !important;
    background-image:
        radial-gradient(ellipse at 0% 100%, rgba(0,255,204,0.04) 0%, transparent 55%),
        radial-gradient(ellipse at 100% 0%, rgba(155,93,229,0.04) 0%, transparent 50%),
        linear-gradient(rgba(0,255,204,0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,255,204,0.018) 1px, transparent 1px) !important;
    background-size: 100% 100%, 100% 100%, 52px 52px, 52px 52px !important;
    /* do NOT set position relative here — it would fight the existing layout */
}

/* ── Canvas background (injected by globalBg.js) ── */
#globalBgCanvas {
    position: fixed !important;
    inset: 0 !important;
    z-index: 0 !important;
    pointer-events: none !important;
}

/* ── Floating code fragments (injected by globalBg.js) ── */
.g-code-float {
    position: fixed !important;
    z-index: 2 !important;
    font-family: var(--font-mono) !important;
    font-size: 0.67rem !important;
    line-height: 1.6 !important;
    color: rgba(0, 255, 204, 0.13) !important;
    background: rgba(0, 0, 0, 0.35) !important;   /* dark backing so it never bleeds onto text */
    border: 1px solid rgba(0, 255, 204, 0.05) !important;
    border-radius: 9px !important;
    padding: 10px 14px !important;
    pointer-events: none !important;
    white-space: pre !important;
    user-select: none !important;
    backdrop-filter: blur(1px) !important;
}
.g-code-float .kw  { color: rgba(0, 255, 204, 0.40) !important; }
.g-code-float .fn  { color: rgba(57, 255, 20, 0.35) !important; }
.g-code-float .num { color: rgba(255, 200, 40, 0.38) !important; }

/* ── Scan-line overlay removed — was causing purple rendering artifact ── */



/* ── All "cards" and content areas must sit ABOVE the canvas (z-index ≥ 4) ── */
.navbar,
.main-container,
.card, .card-row,
.profile-viewer,
.sidebar-card,
.welcome-banner,
.content-grid,
.left-column,
.lb-scene,
.lb-header,
.friends-container,
.exercises-container,
.profile-container,
.ranked-container,
.solve-container,
.story-container,
.battle-container,
.tutorial-container,
.onboarding-container {
    position: relative !important;
    z-index: 10 !important;
}

/* ── Cards and containers get an opaque dark backing ── */
/* This ensures floating code NEVER shows through readable text */
.card,
.sidebar-card,
.welcome-banner,
.profile-viewer {
    background-color: var(--bg-card) !important;
}

/* ── Navbar — full component (shared by all pages) ── */
.navbar {
    position: fixed !important;
    top: 0; left: 0;
    width: 100%;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    background: rgba(7, 7, 15, 0.94) !important;
    backdrop-filter: blur(20px) !important;
    border-bottom: 1px solid rgba(0, 255, 204, 0.08) !important;
    z-index: 1000 !important;
    box-sizing: border-box;
}

/* ── User pill ── */
.user-pill-container { position: relative; }
.user-pill {
    display: flex; align-items: center; gap: 10px;
    background: rgba(13, 13, 22, 0.8);
    padding: 5px 14px 5px 5px;
    border-radius: 50px;
    border: 1px solid rgba(0, 255, 204, 0.1);
    cursor: pointer;
    transition: border-color 0.18s, box-shadow 0.18s;
}
.user-pill:hover {
    border-color: rgba(0, 255, 204, 0.28);
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.06);
}
.avatar {
    width: 30px; height: 30px;
    background: rgba(0, 255, 204, 0.08);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 255, 204, 0.18);
    flex-shrink: 0;
}
.username-display {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-light);
    white-space: nowrap;
}

/* ── Dropdown ── */
.user-dropdown {
    position: absolute; top: 100%; right: 0;
    margin-top: 12px;
    background: rgba(9, 9, 18, 0.98);
    border: 1px solid rgba(0, 255, 204, 0.1);
    border-radius: 10px;
    padding: 6px 0;
    min-width: 180px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
    opacity: 0; visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.18s, visibility 0.18s, transform 0.18s;
    z-index: 2000;
    backdrop-filter: blur(20px);
}
.user-dropdown::before {
    content: '';
    position: absolute; top: -12px; left: 0; right: 0; height: 12px;
}
.user-pill-container:hover .user-dropdown {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.dropdown-item {
    display: block;
    padding: 9px 18px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    transition: background 0.15s, color 0.15s, padding-left 0.15s;
    border-left: 2px solid transparent;
    letter-spacing: 0.5px;
}
.dropdown-item:hover {
    background: rgba(0, 255, 204, 0.04);
    color: var(--accent-cyan);
    border-left-color: var(--accent-cyan);
    padding-left: 22px;
}
.dropdown-divider {
    height: 1px;
    background: rgba(0, 255, 204, 0.07);
    margin: 5px 0;
}
.dropdown-item-danger { color: #ff5566; }
.dropdown-item-danger:hover {
    color: #ff5566;
    border-left-color: #ff5566;
    background: rgba(255, 85, 102, 0.06);
}

/* Brand styling consistent */
.brand {
    font-family: var(--font-mono) !important;
    font-size: 1.2rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.5px !important;
    color: #fff !important;
    cursor: pointer;
    position: relative;
}
.brand span { color: var(--accent-cyan) !important; }
.brand::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--accent-cyan), transparent);
    opacity: 0.35;
}

/* ── Dropdown polish ── */
.user-dropdown {
    background: rgba(12, 12, 18, 0.98) !important;
    border: 1px solid rgba(0, 255, 204, 0.12) !important;
    border-radius: 12px !important;
    backdrop-filter: blur(20px) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8) !important;
    padding: 6px !important;
    z-index: 200 !important;
}
.dropdown-item {
    border-radius: 8px !important;
    font-family: var(--font-mono) !important;
    font-size: 0.8rem !important;
    letter-spacing: 0.5px !important;
    transition: background 0.15s !important;
}
.dropdown-item:hover {
    background: rgba(0, 255, 204, 0.06) !important;
}
.dropdown-divider {
    background: rgba(0, 255, 204, 0.08) !important;
    margin: 4px 0 !important;
}

/* ── Button shimmer effect ── */
.btn {
    position: relative !important;
    overflow: hidden !important;
    font-family: var(--font-mono) !important;
    transition: transform 0.18s, box-shadow 0.18s !important;
}
.btn::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.09) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.5s;
    pointer-events: none;
}
.btn:hover::before { transform: translateX(100%); }
.btn:hover { transform: translateY(-1px) !important; }

/* ── Input focus glow ── */
input:focus, textarea:focus, select:focus {
    border-color: rgba(0, 255, 204, 0.35) !important;
    box-shadow: 0 0 0 3px rgba(0, 255, 204, 0.06) !important;
    outline: none !important;
}

/* ── Headings ── */
h1, h2 {
    font-family: var(--font-mono) !important;
}

/* ── Matchmaking status inside navbar (centered) ── */
#mm-global-bar {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    pointer-events: auto;
    white-space: nowrap;
}
.mm-bar-dots { display: flex; gap: 5px; align-items: center; }
.mm-bar-dots span {
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent-cyan);
    animation: mm-pulse 1.4s infinite;
}
.mm-bar-dots span:nth-child(2) { animation-delay: 0.2s; }
.mm-bar-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mm-pulse {
    0%, 100% { opacity: 0.25; transform: scale(0.8); }
    50%       { opacity: 1;    transform: scale(1.2); }
}
.mm-bar-text  { color: var(--text-light); font-weight: 600; }
.mm-bar-timer { color: var(--text-muted); font-size: 0.72rem; }
.mm-bar-cancel {
    background: transparent;
    cursor: pointer;
    border: 1px solid rgba(255, 80, 80, 0.45);
    color: #ff6b6b;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}
.mm-bar-cancel:hover { background: rgba(255, 80, 80, 0.1); border-color: #ff6b6b; }

/* ── Matchmaking cancel confirmation modal ── */
.mm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 502;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mm-modal-box {
    background: var(--bg-card);
    border: 1px solid rgba(0, 255, 204, 0.2);
    border-radius: 12px;
    padding: 32px 44px;
    text-align: center;
    max-width: 420px;
}
.mm-modal-text {
    font-family: var(--font-mono);
    color: var(--text-light);
    font-size: 1rem;
    margin-bottom: 24px;
    line-height: 1.5;
}
.mm-modal-btns { display: flex; gap: 16px; justify-content: center; }
.mm-modal-btn {
    font-family: var(--font-mono);
    padding: 8px 30px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}
.mm-btn-yes {
    background: rgba(0, 255, 204, 0.12);
    color: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
}
.mm-btn-yes:hover { background: rgba(0, 255, 204, 0.22); }
.mm-btn-no {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.mm-btn-no:hover { color: var(--text-light); border-color: rgba(255, 255, 255, 0.4); }

/* ── Language switcher ── */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(0, 255, 204, 0.1);
    border-radius: 8px;
    padding: 3px 4px;
}
.lang-btn {
    background: transparent;
    border: none;
    padding: 3px 6px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.55;
}
.lang-btn:hover { background: rgba(0, 255, 204, 0.06); opacity: 0.85; }
.lang-btn.active { background: rgba(0, 255, 204, 0.10); opacity: 1; }

.flag-icon {
    width: 22px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    display: block;
}

/* Auth pages: switcher fixed top-right corner */
.lang-switcher--fixed {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 9999;
    background: rgba(10, 10, 14, 0.75);
    backdrop-filter: blur(10px);
    border-color: rgba(0, 255, 204, 0.14);
}

