/* ============================================================================
   ESTOPA SERVER PORTAL — Premium CSS
   ============================================================================
   A high-end glassmorphic dashboard with animated backgrounds, 
   four switchable color themes, and pixel-perfect icon centering.
   ============================================================================ */


/* ────────────────────────────────────────────────────────────────────────────
   §1  DESIGN TOKENS & CSS CUSTOM PROPERTIES
   ──────────────────────────────────────────────────────────────────────────── */

:root {
    /* ── Typography ─────────────────────────────────────────────────────── */
    --font-body:  'Roboto', system-ui, -apple-system, sans-serif;
    --font-brand: 'Outfit', 'Roboto', sans-serif;

    /* ── Surface & Glass ────────────────────────────────────────────────── */
    --glass-bg:            rgba(255, 255, 255, 0.035);
    --glass-bg-hover:      rgba(255, 255, 255, 0.065);
    --glass-border:        rgba(255, 255, 255, 0.06);
    --glass-border-hover:  rgba(255, 255, 255, 0.14);

    /* ── Elevation (Material 3 inspired) ────────────────────────────────── */
    --elevation-1:     0 2px 8px rgba(0, 0, 0, 0.18),
                       0 1px 3px rgba(0, 0, 0, 0.12);
    --elevation-2:     0 6px 16px rgba(0, 0, 0, 0.28),
                       0 3px 6px rgba(0, 0, 0, 0.16);
    --elevation-3:     0 12px 32px rgba(0, 0, 0, 0.4),
                       0 6px 12px rgba(0, 0, 0, 0.22);
    --elevation-hover: 0 16px 40px rgba(0, 0, 0, 0.45),
                       0 8px 16px rgba(0, 0, 0, 0.2);

    /* ── Text ───────────────────────────────────────────────────────────── */
    --text-primary:   #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.68);
    --text-muted:     rgba(255, 255, 255, 0.4);

    /* ── Semantic Colors ────────────────────────────────────────────────── */
    --danger:  #ff5252;
    --success: #00e676;

    /* ── Shape ──────────────────────────────────────────────────────────── */
    --radius-card:  20px;
    --radius-modal: 24px;
    --radius-pill:  50px;
    --radius-btn:   14px;

    /* ── Motion ─────────────────────────────────────────────────────────── */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --transition:    all 0.3s var(--ease-out-expo);

    /* ── Modal BG (solid, for select options) ───────────────────────────── */
    --modal-bg: #141020;
}


/* ────────────────────────────────────────────────────────────────────────────
   §2  THEME DEFINITIONS
   Each theme overrides 5 key variables that cascade through the entire UI.
   ──────────────────────────────────────────────────────────────────────────── */

/* DEFAULT / SUNSET — warm purples → coral orange */
:root,
body.theme-sunset {
    --bg-gradient:  linear-gradient(135deg, #0e071a 0%, #290d2e 30%, #4a1532 60%, #681f2f 100%);
    --accent-1:     #ff7e5f;   /* coral-orange, primary accent */
    --accent-2:     #feb47b;   /* warm peach, secondary */
    --accent-3:     #9b5de5;   /* violet, tertiary */
    --glow-color:   rgba(255, 126, 95, 0.25);
}

/* DEEP SPACE — navy → electric blue, cyan highlights */
body.theme-space {
    --bg-gradient:  linear-gradient(135deg, #050812 0%, #0c1836 40%, #152754 70%, #1f376f 100%);
    --accent-1:     #00b4d8;
    --accent-2:     #90e0ef;
    --accent-3:     #48cae4;
    --glow-color:   rgba(0, 180, 216, 0.25);
}

/* FOREST MINT — dark teals → emerald, mint highlights */
body.theme-mint {
    --bg-gradient:  linear-gradient(135deg, #050a0b 0%, #102120 35%, #193833 65%, #255148 100%);
    --accent-1:     #2ec4b6;
    --accent-2:     #c7f9cc;
    --accent-3:     #80ed99;
    --glow-color:   rgba(46, 196, 182, 0.25);
}

/* CYBERPUNK NEON — pure black → deep purple, hot pink + cyan */
body.theme-neon {
    --bg-gradient:  linear-gradient(135deg, #000000 0%, #100018 30%, #230030 65%, #350044 100%);
    --accent-1:     #ff007f;
    --accent-2:     #00f0ff;
    --accent-3:     #e040fb;
    --glow-color:   rgba(255, 0, 127, 0.3);
}


/* ── Derived variables (auto-compute from theme accents) ────────────────── */
body {
    --primary-gradient: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 100%);
}


/* ────────────────────────────────────────────────────────────────────────────
   §3  CSS RESET
   ──────────────────────────────────────────────────────────────────────────── */

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

img, svg {
    display: block;
    max-width: 100%;
}

button {
    font: inherit;
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}


/* ────────────────────────────────────────────────────────────────────────────
   §4  CUSTOM SCROLLBAR (Webkit)
   ──────────────────────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.24);
}


/* ────────────────────────────────────────────────────────────────────────────
   §5  ANIMATED BACKGROUND
   ──────────────────────────────────────────────────────────────────────────── */

body {
    font-family: var(--font-body);
    background: var(--bg-gradient);
    background-size: 300% 300%;
    background-attachment: fixed;
    animation: bgShift 20s ease infinite;
    color: var(--text-primary);
    min-height: 100vh;
    padding: 2.5rem 1.5rem;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
    letter-spacing: 0.2px;
}

@keyframes bgShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}


/* ── Ambient Glow Spheres ───────────────────────────────────────────────── */

.ambient-glow {
    position: fixed;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    filter: blur(130px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.4;
    transition: background 1.2s ease;
}

.glow-1 {
    background: var(--accent-1);
    top: -12%;
    left: -8%;
    animation: drift 26s ease-in-out infinite;
}

.glow-2 {
    background: var(--accent-2);
    bottom: -15%;
    right: -10%;
    animation: drift 32s ease-in-out infinite reverse;
}

.glow-3 {
    background: var(--accent-3);
    top: 40%;
    left: 55%;
    width: 380px;
    height: 380px;
    animation: drift 22s ease-in-out infinite 5s;
}

@keyframes drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(100px, 80px) scale(1.12); }
    66%      { transform: translate(-50px, 120px) scale(0.92); }
}


/* ────────────────────────────────────────────────────────────────────────────
   §6  LAYOUT CONTAINER
   ──────────────────────────────────────────────────────────────────────────── */

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}


/* ────────────────────────────────────────────────────────────────────────────
   §7  HEADER — Glassmorphic top bar
   ──────────────────────────────────────────────────────────────────────────── */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--glass-border);
    padding: 1.5rem 2rem;
    border-radius: var(--radius-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: var(--elevation-1);
}


/* ── Left side: date tag + greeting ─────────────────────────────────────── */

.header-left .date-tag {
    font-family: var(--font-brand);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: var(--accent-1);
    margin-bottom: 0.3rem;
}

.header-left h1 {
    font-family: var(--font-brand);
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.8px;
    line-height: 1.15;
    background: linear-gradient(to right, #ffffff, rgba(255, 255, 255, 0.82));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}


/* ── Right side: flex bar with gap ──────────────────────────────────────── */

.header-right {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}


/* ────────────────────────────────────────────────────────────────────────────
   §8  THEME SELECTOR
   ──────────────────────────────────────────────────────────────────────────── */

.theme-selector-bar {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-pill);
}

.theme-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2.5px solid transparent;
    transition: var(--transition);
    flex-shrink: 0;
}

.theme-swatch:hover {
    transform: scale(1.2);
}

.theme-swatch.active {
    border-color: #ffffff;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.55),
                0 0 4px rgba(255, 255, 255, 0.3);
}

/* Swatch gradient fills */
.swatch-sunset { background: linear-gradient(135deg, #ff7e5f, #feb47b); }
.swatch-space  { background: linear-gradient(135deg, #00b4d8, #90e0ef); }
.swatch-mint   { background: linear-gradient(135deg, #2ec4b6, #c7f9cc); }
.swatch-neon   { background: linear-gradient(135deg, #ff007f, #00f0ff); }


/* ────────────────────────────────────────────────────────────────────────────
   §9  BADGES
   ──────────────────────────────────────────────────────────────────────────── */

.badge {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-brand);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-admin {
    border-color: rgba(var(--accent-1), 0.3);
    border-color: color-mix(in srgb, var(--accent-1) 30%, transparent);
    color: var(--accent-1);
    background: color-mix(in srgb, var(--accent-1) 6%, transparent);
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    flex-shrink: 0;
}

.badge-admin .badge-dot {
    background: var(--accent-1);
    box-shadow: 0 0 8px var(--accent-1);
}


/* ────────────────────────────────────────────────────────────────────────────
   §10  LOGOUT BUTTON
   ──────────────────────────────────────────────────────────────────────────── */

.btn-logout {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-brand);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    position: relative;
    white-space: nowrap;
}

/* Size Lucide SVG icons inside logout button */
.btn-logout svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-logout:hover {
    background: rgba(255, 82, 82, 0.08);
    border-color: rgba(255, 82, 82, 0.3);
    color: var(--danger);
}


/* ────────────────────────────────────────────────────────────────────────────
   §11  SECTION HEADERS
   ──────────────────────────────────────────────────────────────────────────── */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
    margin-top: 0.75rem;
}

.section-header h2 {
    font-family: var(--font-brand);
    font-size: 1.05rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-secondary);
    border-left: 4px solid var(--accent-1);
    padding-left: 0.75rem;
    line-height: 1.3;
}

.btn-action {
    background: color-mix(in srgb, var(--accent-1) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-1) 25%, transparent);
    color: var(--accent-1);
    padding: 0.6rem 1.3rem;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-brand);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition);
    white-space: nowrap;
}

/* SVG icons inside action buttons */
.btn-action svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-action:hover {
    background: var(--primary-gradient);
    border-color: transparent;
    color: #0c0818;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--glow-color);
}


/* ────────────────────────────────────────────────────────────────────────────
   §12  APP CARDS GRID
   ──────────────────────────────────────────────────────────────────────────── */

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3.5rem;
}


/* ── Individual Card ────────────────────────────────────────────────────── */

.app-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-card);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--elevation-1);
}

.app-card:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: translateY(-4px);
    box-shadow: var(--elevation-hover),
                0 0 24px var(--glow-color);
}

/* Corner radial glow highlight */
.app-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, var(--glow-color) 0%, transparent 70%);
    opacity: 0.4;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.3s var(--ease-out-expo);
}

.app-card:hover::after {
    opacity: 0.7;
}


/* ── Card Header (icon + info row) ──────────────────────────────────────── */

.app-card-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    width: 100%;
}


/* ── App Icon — PERFECT CENTERING ───────────────────────────────────────── */
/* Rule: Container is sized, flex-centers children. SVG sized via selector. */

.app-icon {
    width: 56px;
    height: 56px;
    min-width: 56px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-1);
    transition: var(--transition);
    box-shadow: var(--elevation-1);
    overflow: hidden;
    flex-shrink: 0;
}

/* Lucide SVG icons inside .app-icon — sized here, NOT inline */
.app-icon svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Custom image icons */
.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

/* Icon hover state: filled gradient background */
.app-card:hover .app-icon {
    background: var(--primary-gradient);
    color: #0c0818;
    transform: scale(1.06);
    border-color: transparent;
    box-shadow: 0 4px 16px var(--glow-color);
}


/* ── App Info ───────────────────────────────────────────────────────────── */

.app-info {
    flex: 1;
    min-width: 0;  /* prevent flex overflow */
}

.app-name {
    font-family: var(--font-brand);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    line-height: 1.3;
}

.app-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    line-height: 1.4;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
    display: inline-block;
    flex-shrink: 0;
}


/* ── Description stub ───────────────────────────────────────────────────── */

.app-description-stub {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.55;
}


/* ── Card Action Button ─────────────────────────────────────────────────── */

.app-card-action {
    width: 100%;
    padding: 0.8rem 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-btn);
    font-family: var(--font-brand);
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
    color: var(--accent-1);
    transition: var(--transition);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-top: auto;  /* push to bottom of flex column */
}

.app-card:hover .app-card-action {
    background: var(--primary-gradient);
    border-color: transparent;
    color: #0c0818;
    box-shadow: 0 4px 14px var(--glow-color);
}


/* ── Custom Background Cards ────────────────────────────────────────────── */

.app-card.custom-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
    transition: background 0.3s var(--ease-out-expo);
}

.app-card.custom-bg:hover::before {
    background: rgba(0, 0, 0, 0.6);
}

/* Elevate all children above the dark overlay */
.app-card.custom-bg .app-card-header,
.app-card.custom-bg .app-description-stub,
.app-card.custom-bg .app-card-action,
.app-card.custom-bg .card-admin-controls {
    position: relative;
    z-index: 2;
}


/* ── Admin Card Controls ────────────────────────────────────────────────── */

.card-admin-controls {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    display: flex;
    gap: 0.4rem;
    z-index: 10;
    opacity: 0;
    transform: translateY(-4px);
    transition: var(--transition);
}

.app-card:hover .card-admin-controls,
.game-card:hover .card-admin-controls {
    opacity: 1;
    transform: translateY(0);
}

.btn-card-ctrl {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

/* SVG icons inside admin control buttons */
.btn-card-ctrl svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.btn-card-ctrl:hover {
    background: var(--text-primary);
    color: #0c0818;
    transform: scale(1.1);
}

.btn-card-ctrl.delete:hover {
    background: var(--danger);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 12px rgba(255, 82, 82, 0.45);
}


/* ────────────────────────────────────────────────────────────────────────────
   §13  SECONDARY APPS (smaller variant)
   ──────────────────────────────────────────────────────────────────────────── */

.apps-grid.secondary {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.apps-grid.secondary .app-card {
    padding: 1.35rem;
    gap: 1rem;
    border-radius: 16px;
}

.apps-grid.secondary .app-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
}

.apps-grid.secondary .app-icon svg {
    width: 20px;
    height: 20px;
}

.apps-grid.secondary .app-name {
    font-size: 1.05rem;
}

.apps-grid.secondary .app-card-action {
    padding: 0.6rem 1rem;
    border-radius: 10px;
    font-size: 0.78rem;
}


/* ────────────────────────────────────────────────────────────────────────────
   §14  GAME STORE CARDS
   ──────────────────────────────────────────────────────────────────────────── */

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.75rem;
    margin-bottom: 3.5rem;
}

.game-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    position: relative;
    box-shadow: var(--elevation-1);
}

.game-card:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: translateY(-5px);
    box-shadow: var(--elevation-hover),
                0 0 24px var(--glow-color);
}

.game-cover-container {
    height: 180px;
    width: 100%;
    overflow: hidden;
    position: relative;
    background: #06040b;
}

.game-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--ease-out-expo);
}

.game-card:hover .game-cover {
    transform: scale(1.05);
}

.game-card-body {
    padding: 1.5rem 1.75rem 1.75rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.game-title {
    font-family: var(--font-brand);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.game-description {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-game-dl {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--accent-1);
    padding: 0.85rem;
    border-radius: var(--radius-btn);
    font-family: var(--font-brand);
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.82rem;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

/* SVG icons inside game download buttons */
.btn-game-dl svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.game-card:hover .btn-game-dl {
    background: var(--primary-gradient);
    color: #0c0818;
    border-color: transparent;
    box-shadow: 0 4px 14px var(--glow-color);
}


/* ────────────────────────────────────────────────────────────────────────────
   §15  MODALS
   ──────────────────────────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 4, 11, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-box {
    background: var(--modal-bg);
    border: 1px solid var(--glass-border-hover);
    border-radius: var(--radius-modal);
    width: 90%;
    max-width: 520px;
    padding: 2rem;
    transform: scale(0.92);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--elevation-3);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-box {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
}

.modal-header h3 {
    font-family: var(--font-brand);
    font-size: 1.45rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.3;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
}

.modal-close svg {
    width: 22px;
    height: 22px;
}

.modal-close:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}


/* ────────────────────────────────────────────────────────────────────────────
   §16  MODAL FORMS
   ──────────────────────────────────────────────────────────────────────────── */

.modal-form .form-group {
    margin-bottom: 1.35rem;
}

.modal-form label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.45rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-brand);
}

.modal-form input[type="text"],
.modal-form input[type="url"],
.modal-form select,
.modal-form textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    line-height: 1.5;
}

/* ── SELECT DROPDOWN FIX — visible options on dark backgrounds ──────────── */
.modal-form select {
    background-color: var(--modal-bg);
    cursor: pointer;
    appearance: auto;
}

.modal-form select option {
    background-color: var(--modal-bg);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* ── Focus states ───────────────────────────────────────────────────────── */
.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
    border-color: var(--accent-1);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-1) 15%, transparent),
                0 0 12px var(--glow-color);
}

.modal-form textarea {
    resize: vertical;
    min-height: 100px;
}


/* ── Checkbox Row ───────────────────────────────────────────────────────── */

.form-row-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.form-row-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-1);
    cursor: pointer;
    flex-shrink: 0;
}

.form-row-checkbox label {
    margin-bottom: 0;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.92rem;
}


/* ── Modal Action Buttons ───────────────────────────────────────────────── */

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-btn);
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-brand);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.82rem;
    transition: var(--transition);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border-color: var(--glass-border-hover);
}

.btn-save {
    background: var(--primary-gradient);
    border: none;
    color: #0c0818;
    padding: 0.8rem 1.75rem;
    border-radius: var(--radius-btn);
    font-weight: 800;
    cursor: pointer;
    font-family: var(--font-brand);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.82rem;
    transition: var(--transition);
    box-shadow: 0 4px 14px var(--glow-color);
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--glow-color);
}

.btn-save:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}


/* ────────────────────────────────────────────────────────────────────────────
   §17  SUGGESTION BOX
   ──────────────────────────────────────────────────────────────────────────── */

.suggestion-box-section {
    margin-top: 4rem;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-card);
    padding: 2rem;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: var(--elevation-1);
}

.suggestion-box-section h2 {
    font-family: var(--font-brand);
    font-size: 1.15rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    line-height: 1.3;
}

/* SVG icon inside suggestion heading */
.suggestion-box-section h2 svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.suggestion-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.25rem;
}

/* Textarea inside suggestion form (shares styles with modal form inputs) */
.suggestion-form textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    resize: vertical;
    min-height: 90px;
    line-height: 1.5;
}

.suggestion-form textarea:focus {
    border-color: var(--accent-1);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-1) 15%, transparent),
                0 0 12px var(--glow-color);
}

.btn-suggestion-submit {
    align-self: flex-end;
    background: var(--primary-gradient);
    border: none;
    color: #0c0818;
    padding: 0.8rem 1.75rem;
    border-radius: var(--radius-btn);
    font-weight: 800;
    cursor: pointer;
    font-family: var(--font-brand);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.82rem;
    transition: var(--transition);
    box-shadow: 0 4px 14px var(--glow-color);
}

.btn-suggestion-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--glow-color);
}


/* ── Suggestions List (Admin Inbox) ─────────────────────────────────────── */

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.suggestion-item {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--glass-border);
    padding: 1.15rem 1.35rem;
    border-radius: 14px;
    position: relative;
    transition: var(--transition);
}

.suggestion-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--glass-border-hover);
}

.suggestion-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-family: var(--font-brand);
    font-weight: 700;
}

.suggestion-user {
    color: var(--accent-1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.suggestion-user svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.suggestion-msg {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.55;
    white-space: pre-wrap;
    padding-right: 2rem;  /* space for delete button */
}

.btn-delete-suggestion {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
}

.btn-delete-suggestion svg {
    width: 16px;
    height: 16px;
}

.btn-delete-suggestion:hover {
    color: var(--danger);
    transform: scale(1.15);
}


/* ────────────────────────────────────────────────────────────────────────────
   §18  OFFLINE BANNER
   ──────────────────────────────────────────────────────────────────────────── */

.offline-banner {
    background: rgba(255, 82, 82, 0.07);
    border: 1px solid rgba(255, 82, 82, 0.22);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.1rem 1.5rem;
    border-radius: var(--radius-card);
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 2rem;
    font-weight: 600;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    box-shadow: var(--elevation-1);
    line-height: 1.4;
}

.offline-banner svg {
    width: 20px;
    height: 20px;
    color: var(--danger);
    flex-shrink: 0;
}

/* Legacy: if using <i> with lucide data-attr */
.offline-banner i {
    color: var(--danger);
}


/* ────────────────────────────────────────────────────────────────────────────
   §19  RESPONSIVE — Mobile-first adjustments
   ──────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    body {
        padding: 1.25rem 0.85rem;
    }

    /* Stack header vertically */
    header {
        flex-direction: column;
        gap: 1.25rem;
        align-items: stretch;
        padding: 1.25rem;
    }

    .header-left h1 {
        font-size: 2rem;
    }

    .header-right {
        justify-content: space-between;
        gap: 0.75rem;
    }

    /* Single column grids */
    .apps-grid,
    .apps-grid.secondary,
    .games-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Reduce card padding */
    .app-card {
        padding: 1.35rem;
    }

    .apps-grid.secondary .app-card {
        padding: 1.15rem;
    }

    .suggestion-box-section {
        padding: 1.35rem;
        margin-top: 2.5rem;
    }

    .modal-box {
        padding: 1.5rem;
    }

    .modal-header h3 {
        font-size: 1.2rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .game-card-body {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .header-left h1 {
        font-size: 1.7rem;
    }

    .header-left .date-tag {
        font-size: 0.7rem;
    }

    .badge {
        font-size: 0.72rem;
        padding: 0.4rem 0.85rem;
    }

    .btn-logout {
        font-size: 0.72rem;
        padding: 0.4rem 0.85rem;
    }
}


/* ────────────────────────────────────────────────────────────────────────────
   §20  UTILITY / COMPATIBILITY
   ──────────────────────────────────────────────────────────────────────────── */

/* Alias for login page compatibility */
:root {
    --font-family: var(--font-body);
    --accent-orange: var(--accent-1);
    --accent-pink: var(--accent-2);
    --accent-purple: var(--accent-3);
}

/* Empty state large icons */
.empty-inbox-icon,
.empty-store-icon {
    display: block;
    margin: 0 auto 1rem;
}

.empty-inbox-icon svg,
.empty-store-icon svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin: 0 auto;
}

/* Store page subtitle */
.store-subtitle {
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-size: 0.95rem;
}

/* Suggestion delete button positioning */
.suggestion-item .btn-card-ctrl.delete.btn-delete-suggestion {
    position: absolute;
    top: 1rem;
    right: 1rem;
    opacity: 1;
    transform: scale(1);
}

/* Suggestion badge */
#suggestions-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.68rem;
    font-weight: 800;
    border: 1.5px solid var(--modal-bg);
    line-height: 1.2;
}
