/* ──────────────────────────────────────────────────────────────────────
   THEME PALETTES
   :root = LIGHT (default).  [data-theme="dark"] = DARK.
   The same variable names carry different values per theme so the rest of
   the stylesheet (and inline styles using var(--…)) work in both modes.
   ────────────────────────────────────────────────────────────────────── */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;

    /* Light palette — clean, neutral, crisp (no pink wash, solid cards) */
    --bg-dark: #f5f6f8;                 /* calm near-white page background */
    --bg-page-gradient: none;
    --bg-card: #ffffff;
    --text-light: #1e293b;             /* primary text */
    --text-dim: #5b6472;               /* dim/secondary text (stronger contrast) */

    --success: #16a34a;
    --error: #ef4444;
    --warning: #d97706;

    /* Surface helpers (so dark-only hard-codes can be themed everywhere) */
    --surface: #ffffff;
    --surface-soft: #ffffff;
    --surface-faint: #f3f4f8;
    --surface-hover: #eef0f6;
    --nav-bg: rgba(255, 255, 255, 0.9);
    --modal-bg: #ffffff;
    --modal-scrim: rgba(16, 24, 40, 0.4);
    --input-bg: #ffffff;
    --border: #e3e6ee;
    --border-soft: rgba(16, 24, 40, 0.08);
    --border-faint: rgba(16, 24, 40, 0.05);
    --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px -12px rgba(16, 24, 40, 0.12);
    --globe-opacity: 0.04;
    --on-accent: #ffffff;              /* text sitting on a primary surface */
}

[data-theme="dark"] {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;

    /* Dark palette (original values) */
    --bg-dark: #0f172a;
    --bg-page-gradient: none;
    --bg-card: #1e293b;
    --text-light: #f8fafc;
    --text-dim: #94a3b8;

    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;

    --surface: rgba(30, 41, 59, 0.7);
    --surface-soft: rgba(30, 41, 59, 0.6);
    --surface-faint: rgba(255, 255, 255, 0.05);
    --surface-hover: rgba(255, 255, 255, 0.1);
    --nav-bg: rgba(15, 23, 42, 0.85);
    --modal-bg: rgba(30, 41, 59, 0.98);
    --modal-scrim: rgba(10, 15, 30, 0.9);
    --input-bg: rgba(15, 23, 42, 0.5);
    --border: rgba(255, 255, 255, 0.1);
    --border-soft: rgba(255, 255, 255, 0.08);
    --border-faint: rgba(255, 255, 255, 0.05);
    --shadow-card: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --globe-opacity: 0.4;
    --on-accent: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    background-image: var(--bg-page-gradient);
    background-attachment: fixed;
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

/* Background Animation */
.background-globes {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: var(--globe-opacity);
    animation: float 20s infinite ease-in-out;
}

.globe-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
}

.globe-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary);
    bottom: -150px;
    right: -150px;
    animation-delay: -5s;
}

.globe-3 {
    width: 300px;
    height: 300px;
    background: #8b5cf6;
    top: 40%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    33% {
        transform: translate(30px, -50px);
    }

    66% {
        transform: translate(-20px, 20px);
    }
}

/* Main Container & Card */
.container {
    width: 100%;
    max-width: 575px;
    padding: 1rem;
    z-index: 10;
}

.game-card {
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2rem;
    width: 100%;
    box-shadow: var(--shadow-card);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Navigation Overlays */
.nav-overlay {
    position: fixed;
    z-index: 50;
    padding: 1rem;
}

.top-left {
    top: 1rem;
    left: 1rem;
}

.top-right {
    top: 1rem;
    right: 1rem;
}

.top-center {
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
}

.bottom-right {
    bottom: 1rem;
    right: 1rem;
}

.nav-btn,
.icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-soft);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-btn:hover,
.icon-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Stats Board */
.score-board {
    display: flex;
    gap: 1.5rem;
    background: var(--surface-soft);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    border: 1px solid var(--border-faint);
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-item .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.05em;
}

.score-item .value {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Toggle Switch */
/* Standardized Toggle Switch (Reusable) */
.toggle-switch {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: relative;
    cursor: pointer;
    width: 44px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Game Over (Legacy - to be cleaned) */
.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    padding: 0.85rem 2.5rem;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.primary-btn:hover {
    transform: scale(1.05);
}

/* =========================================
   Overview Page Styles (Consolidated)
   ========================================= */
.overview-container {
    width: 95%;
    max-width: 1600px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 24px;
    min-height: 80vh;
}

.overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-box {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    color: var(--text-light);
    width: 300px;
    outline: none;
    transition: border-color 0.3s;
}

.search-box:focus {
    border-color: var(--primary);
}

.employees-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.emp-card {
    background: var(--surface-faint);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.3s, background 0.3s;
}

.emp-card:hover {
    transform: translateY(-5px);
    background: var(--surface-hover);
    border-color: var(--primary);
}

.emp-card img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    border: 3px solid var(--border);
}

.emp-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.emp-card .role {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    display: block;
}

.emp-card .dept {
    font-size: 0.75rem;
    background: rgba(99, 102, 241, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    color: var(--primary);
    display: inline-block;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--primary);
}


/* =========================================
   Media Queries for Responsiveness
   ========================================= */

/* Tablet & Large Phones (max-width: 1024px) */
@media (max-width: 1024px) {
    .container {
        max-width: 700px;
    }

    .overview-container {
        width: 100%;
        border-radius: 0;
        margin: 0;
        min-height: 100vh;
    }
}

/* Mobile Devices (max-width: 768px) */
@media (max-width: 768px) {

    /* --- Game Page --- */
    .container {
        max-width: 100%;
        padding: 0.5rem;
        padding-top: 80px;
        /* Space for top nav */
    }

    .game-card {
        padding: 1.5rem 1rem;
        border-radius: 16px;
    }

    /* Stack Navigation on Mobile */
    .nav-overlay {
        position: absolute;
        /* Change fixed to absolute relative to something or stick to top */
        padding: 0.5rem;
    }

    .top-left {
        top: 0.5rem;
        left: 0.5rem;
    }

    .top-right {
        top: 0.5rem;
        right: 0.5rem;
    }

    /* Score board moves to top center but smaller */
    .top-center {
        top: 4rem;
        /* Below the nav/filter */
        width: 100%;
        display: flex;
        justify-content: center;
        pointer-events: none;
        /* Let clicks pass through if overlapping */
    }

    .score-board {
        transform: scale(0.9);
        background: var(--surface);
        padding: 0.25rem 1rem;
    }

    /* Bottom controls */
    .bottom-right {
        bottom: 1rem;
        right: 1rem;
        position: fixed;
    }

    /* Game Elements */
    .image-wrapper {
        width: 140px;
        height: 140px;
        margin-bottom: 1rem;
    }

    .prompt-value {
        font-size: 1.5rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
        /* 1 column on mobile */
        gap: 0.75rem;
    }

    button.name-btn {
        padding: 0.75rem;
        min-height: 50px;
        font-size: 0.95rem;
    }

    /* --- Overview Page --- */
    .overview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .search-box {
        width: 100%;
    }

    .employees-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        /* Smaller cards */
        gap: 1rem;
    }

    .emp-card {
        padding: 1rem;
    }

    .emp-card img {
        width: 80px;
        height: 80px;
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .options-grid {
        grid-template-columns: 1fr;
    }

    .employees-grid {
        grid-template-columns: 1fr;
        /* Single column list for very small screens */
    }

    .container {
        padding-top: 70px;
    }

    .top-center {
        top: 3.5rem;
    }
}

.office-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 2rem;
    width: 100%;
}

.office-card {
    background: var(--surface-faint);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 2rem;
    text-align: left;
    width: 100%;
}

.office-card:hover {
    background: var(--surface-hover);
    transform: translateY(-5px);
    border-color: var(--primary);
}

.office-card h2 {
    margin: 0;
    font-size: 1.5rem;
}

.office-icon {
    width: 120px;
    height: 120px;
    border-radius: 16px;
    object-fit: cover;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.office-card:hover .office-icon {
    border-color: var(--primary);
    transform: scale(1.1);
}

.action-icon {
    width: 64px;
    height: 64px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.office-card:hover .action-icon {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-dim);
}

.form-group input {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-light);
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input:focus {
    border-color: var(--primary);
}

.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.secondary-btn {
    background: var(--surface-faint);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 0.85rem 2.5rem;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.secondary-btn:hover {
    background: var(--surface-hover);
    color: var(--text-light);
    border-color: var(--primary);
}

.hidden {
    display: none !important;
}

.error-message {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    padding: 1rem;
    border-radius: 12px;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--surface-soft);
    backdrop-filter: blur(10px);
    color: #f43f5e;
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.logout-btn:hover {
    background: rgba(244, 63, 94, 0.1);
    border-color: rgba(244, 63, 94, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.1);
}

.logout-btn svg {
    width: 20px;
    height: 20px;
}

/* ── Theme toggle button (shared across pages) ── */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: var(--surface-faint);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* ── Madrid location chip (5th office) ── */
.location-madrid {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}
[data-theme="dark"] .location-madrid {
    color: #f87171;
}

/* ── Reaction bar (feed completion posts) ── */
.reaction-bar { display: inline-flex; gap: 0.3rem; flex-wrap: wrap; }
.reaction-chip {
    display: inline-flex; align-items: center; gap: 0.25rem;
    background: var(--surface-faint); border: 1px solid var(--border);
    border-radius: 50px; padding: 0.25rem 0.6rem; font-size: 0.9rem;
    cursor: pointer; transition: all 0.15s; color: var(--text-light); font-family: inherit; line-height: 1;
}
.reaction-chip span { font-size: 0.78rem; color: var(--text-dim); font-weight: 700; }
.reaction-chip:hover { border-color: var(--primary); background: var(--surface-hover); transform: translateY(-1px); }
.reaction-chip.reacted { background: rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.4); }
.reaction-chip.reacted span { color: var(--primary); }

/* ── Emoji picker popover (comment + chat inputs) ── */
.emoji-picker-wrap { position: relative; flex-shrink: 0; display: inline-flex; }
.emoji-picker {
    position: absolute; bottom: calc(100% + 8px); left: 0;
    background: var(--modal-bg); border: 1px solid var(--border);
    border-radius: 14px; box-shadow: var(--shadow-card);
    padding: 0.5rem; display: grid; grid-template-columns: repeat(6, 1fr);
    gap: 0.15rem; z-index: 600; width: max-content;
}
.emoji-picker button {
    background: none; border: none; cursor: pointer;
    font-size: 1.25rem; padding: 0.3rem; border-radius: 8px; line-height: 1;
    transition: background 0.12s;
}
.emoji-picker button:hover { background: var(--surface-hover); }