/* ╔══════════════════════════════════════════════════════════╗
   ║   ANTIGRAVITY — DENDY/NES Edition Design System         ║
   ║   Fully Responsive: Mobile / Tablet / Desktop           ║
   ╚══════════════════════════════════════════════════════════╝ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=JetBrains+Mono:wght@400;700;800&family=Outfit:wght@300;400;600;800&display=swap');

/* ═══════════════════════════════════════════
   RESET & BOX MODEL
══════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ═══════════════════════════════════════════
   CSS VARIABLES
══════════════════════════════════════════ */
:root {
    --primary: #cc0000;
    --primary-bright: #ff3333;
    --primary-glow: rgba(204, 0, 0, 0.5);
    --primary-dim: rgba(204, 0, 0, 0.12);
    --secondary: #880000;
    --accent: #ff6666;

    --dark-bg: #040404;
    --card-bg: #0a0a0a;
    --panel-bg: #060606;
    --glass: rgba(6, 6, 6, 0.97);
    --glass-border: #200000;
    --pixel-grid-color: rgba(180, 0, 0, 0.045);

    --text-main: #e8e8e8;
    --text-dim: #444;
    --text-pixel: #cc0000;

    --font-pixel: 'Press Start 2P', monospace;
    --font-mono: 'JetBrains Mono', monospace;
    --font-main: 'Outfit', sans-serif;

    --radius: 0px;
    --grid-size: 8px;

    /* Sidebar */
    --sidebar-w: 260px;
    --topbar-h: 56px;
}

/* ═══════════════════════════════════════════
   BASE
══════════════════════════════════════════ */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--dark-bg);
    color: var(--text-main);
    font-family: var(--font-mono);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Pixel Grid */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(var(--pixel-grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--pixel-grid-color) 1px, transparent 1px);
    background-size: var(--grid-size) var(--grid-size);
    z-index: -2;
    pointer-events: none;
}

/* CRT vignette */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.88) 100%);
    z-index: -1;
    pointer-events: none;
}

/* Scanlines */
.scanlines {
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0, 0, 0, 0.1) 3px,
        rgba(0, 0, 0, 0.1) 4px
    );
    z-index: 9998;
    pointer-events: none;
}

/* ═══════════════════════════════════════════
   CURTAIN ANIMATION
══════════════════════════════════════════ */
.curtain-container {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    pointer-events: none;
}

.curtain-half {
    width: 50%;
    height: 100%;
    background: #000;
    transition: transform 0.6s cubic-bezier(0.86, 0, 0.07, 1);
    will-change: transform;
}

body.authorized .curtain-half.left { transform: translateX(-100%); }
body.authorized .curtain-half.right { transform: translateX(100%); }

/* ═══════════════════════════════════════════
   SIDEBAR — Desktop
══════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    background: #020202;
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 2.5rem 0;
    z-index: 200;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar right glow line */
.sidebar::after {
    content: "";
    position: absolute;
    top: 0; right: -1px; width: 1px; height: 100%;
    background: linear-gradient(180deg,
        transparent 0%,
        var(--primary) 15%,
        var(--primary) 85%,
        transparent 100%);
    opacity: 0.35;
}

.nav-logo {
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0 1.5rem;
    font-family: var(--font-pixel);
    text-align: center;
}

.nav-logo .logo-text {
    color: var(--primary);
    font-size: 0.6rem;
    letter-spacing: 2px;
    text-shadow: 2px 2px 0 #000, 0 0 10px var(--primary-glow);
    line-height: 1.8;
}

.nav-logo .logo-sub {
    color: #2a0000;
    font-size: 0.42rem;
    letter-spacing: 1px;
    font-family: var(--font-mono);
    text-transform: uppercase;
}

.nav-logo::before {
    content: "●";
    color: var(--primary);
    font-size: 0.5rem;
    animation: blink-power 2s ease-in-out infinite;
    display: block;
    text-shadow: 0 0 8px var(--primary);
}

@keyframes blink-power {
    0%, 85%, 100% { opacity: 1; }
    90% { opacity: 0.2; }
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    margin: 0;
    width: 100%;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.95rem 1.5rem;
    color: #444;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.68rem;
    transition: all 0.1s steps(1);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-left: 3px solid transparent;
    position: relative;
    white-space: nowrap;
    /* Touch friendly */
    min-height: 48px;
}

.nav-link i {
    font-size: 0.85rem;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.nav-link:hover {
    background: var(--primary-dim);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-link.active {
    color: var(--primary);
    background: rgba(180, 0, 0, 0.08);
    border-left-color: var(--primary);
    text-shadow: 0 0 8px var(--primary-glow);
}

.nav-link.active::after {
    content: "▶";
    position: absolute;
    right: 12px;
    font-size: 0.5rem;
    color: var(--primary);
    animation: blink-cursor 0.8s steps(1) infinite;
}

@keyframes blink-cursor {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.nav-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid #110000;
}

.logout-btn { color: #333; }
.logout-btn:hover {
    color: #ff4444;
    background: rgba(255, 0, 0, 0.05);
    border-left-color: #ff4444;
}

/* ═══════════════════════════════════════════
   MOBILE TOPBAR (hidden on desktop)
══════════════════════════════════════════ */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: #020202;
    border-bottom: 1px solid var(--glass-border);
    z-index: 300;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    gap: 1rem;
}

.mobile-logo {
    font-family: var(--font-pixel);
    font-size: 0.5rem;
    color: var(--primary);
    text-shadow: 0 0 8px var(--primary-glow);
    letter-spacing: 2px;
}

.hamburger {
    background: none;
    border: 1px solid #330000;
    color: var(--primary);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: all 0.1s steps(1);
}

.hamburger:hover {
    background: var(--primary);
    color: #000;
}

/* ═══════════════════════════════════════════
   MOBILE SIDEBAR OVERLAY
══════════════════════════════════════════ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 190;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.visible { display: block; }

/* ═══════════════════════════════════════════
   MAIN LAYOUT
══════════════════════════════════════════ */
.content-area, .main {
    padding: 2.5rem 3rem;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    position: relative;
}

/* ═══════════════════════════════════════════
   HEADER
══════════════════════════════════════════ */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1.5rem;
    position: relative;
}

header::after {
    content: "";
    position: absolute;
    bottom: -1px; left: 0; width: 80px; height: 1px;
    background: var(--primary);
}

h1.page-title {
    font-family: var(--font-pixel);
    font-size: clamp(0.5rem, 1.5vw, 0.8rem);
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin: 0;
    text-shadow: 2px 2px 0 #000, 0 0 12px rgba(204,0,0,0.5);
    line-height: 1.8;
}

/* ═══════════════════════════════════════════
   PANELS
══════════════════════════════════════════ */
.hacker-panel {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    position: relative;
    padding: 1.8rem;
    box-shadow: 0 0 0 1px rgba(180,0,0,0.08), inset 0 0 30px rgba(0,0,0,0.5);
    margin-bottom: 1.5rem;
}

.hacker-panel::before {
    content: "";
    position: absolute;
    top: -1px; left: 0; width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent 5%, var(--primary) 20%, var(--primary-bright) 50%, var(--primary) 80%, transparent 95%);
}

/* ═══════════════════════════════════════════
   TYPOGRAPHY
══════════════════════════════════════════ */
.text-futuristic, .text-pixel {
    font-family: var(--font-pixel);
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.15rem;
    text-shadow: 2px 2px 0 rgba(0,0,0,1), 0 0 10px var(--primary-glow);
    line-height: 1.6;
    font-size: clamp(0.55rem, 1.2vw, 0.8rem);
}

h1, h2, h3 { margin-top: 0; font-family: var(--font-mono); }

/* ═══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
.btn-hacker {
    background: #000;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 0.8rem 1.4rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.1s steps(1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 1px;
    box-shadow: 4px 4px 0 var(--secondary);
    min-height: 44px;
}

.btn-hacker:hover {
    background: var(--primary);
    color: #000;
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--secondary);
}

/* ═══════════════════════════════════════════
   STATS CARDS
══════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.8rem;
    margin: 1.2rem 0;
}

.stat-card {
    background: #040404;
    border: 1px solid #180000;
    padding: 1.2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 1px;
    background: var(--primary);
    opacity: 0.3;
}

.stat-card:hover { border-color: var(--secondary); }

.stat-card .value {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-weight: 900;
    color: var(--primary);
    font-family: var(--font-mono);
    line-height: 1;
    text-shadow: 0 0 15px var(--primary-glow);
    display: block;
    margin-bottom: 0.4rem;
}

.stat-card .label {
    font-size: 0.58rem;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-mono);
}

/* ═══════════════════════════════════════════
   COMPONENTS
══════════════════════════════════════════ */
.user-pill {
    background: #000;
    border: 1px solid #180000;
    padding: 0.5rem 1rem;
    font-size: 0.7rem;
    color: var(--primary);
    font-family: var(--font-mono);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    min-height: 40px;
}

.pills-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.pill.active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
}

/* ═══════════════════════════════════════════
   AVATAR BOX
══════════════════════════════════════════ */
.avatar-box {
    width: 70px;
    height: 70px;
    min-width: 70px;
    border: 2px solid var(--primary);
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--primary);
    box-shadow: 4px 4px 0 var(--secondary), 0 0 20px rgba(204,0,0,0.2);
    position: relative;
}

.avatar-box::after {
    content: "PWR";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #000;
    font-size: 0.42rem;
    padding: 1px 5px;
    font-family: var(--font-pixel);
    white-space: nowrap;
}

/* ═══════════════════════════════════════════
   FORMS
══════════════════════════════════════════ */
input, textarea, select {
    background: #000;
    border: 1px solid #1a0000;
    color: var(--text-main);
    padding: 0.8rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
    border-radius: 0;
    width: 100%;
    -webkit-appearance: none;
    min-height: 44px;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-dim);
}

/* ═══════════════════════════════════════════
   TABLE (responsive)
══════════════════════════════════════════ */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 400px;
}

th {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--primary);
    text-align: left;
    font-weight: 700;
    white-space: nowrap;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #0a0000;
    font-size: 0.78rem;
    color: #999;
}

tr:hover td { background: rgba(180,0,0,0.03); }

/* ═══════════════════════════════════════════
   LIVE FEED
══════════════════════════════════════════ */
.live-feed-list {
    max-height: 450px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.live-feed-list::-webkit-scrollbar { width: 4px; }
.live-feed-list::-webkit-scrollbar-track { background: #000; }
.live-feed-list::-webkit-scrollbar-thumb { background: var(--secondary); }

.event-entry {
    display: grid;
    grid-template-columns: 55px minmax(80px, 110px) 1fr;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid #0a0000;
    font-size: 0.68rem;
    font-family: var(--font-mono);
    animation: event-slide-in 0.2s ease;
}

.event-entry:hover { background: rgba(204,0,0,0.03); }

@keyframes event-slide-in {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}

.ev-time { color: #333; }
.ev-user { color: var(--primary); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-text { color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ═══════════════════════════════════════════
   BADGES
══════════════════════════════════════════ */
.badge-admin {
    background: var(--primary);
    color: #000;
    font-size: 0.52rem;
    padding: 2px 6px;
    font-family: var(--font-pixel);
    display: inline-block;
}

.badge-active {
    background: #003300;
    color: #00cc00;
    font-size: 0.58rem;
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-weight: 700;
    border: 1px solid #005500;
}

.badge-expired {
    background: #110000;
    color: #880000;
    font-size: 0.58rem;
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-weight: 700;
    border: 1px solid #220000;
}

/* ═══════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════ */
@keyframes blink-power {
    0%, 85%, 100% { opacity: 1; }
    90% { opacity: 0.2; }
}

@keyframes pixel-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.blink { animation: pixel-blink 1s steps(1) infinite; }

/* ═══════════════════════════════════════════
   ╔══════════════════════════════════╗
   ║     RESPONSIVE BREAKPOINTS       ║
   ╚══════════════════════════════════╝
══════════════════════════════════════════ */

/* ─────────────── TABLET (≤ 1024px) ─────────────── */
@media screen and (max-width: 1024px) {
    :root {
        --sidebar-w: 240px;
    }

    .content-area, .main {
        padding: 2rem;
    }
}

/* ─────────────── MOBILE BREAKPOINT (≤ 768px) ─────────────── */
@media screen and (max-width: 768px) {
    :root {
        --topbar-h: 52px;
    }

    /* Show mobile topbar */
    .mobile-topbar {
        display: flex;
    }

    /* Hide desktop sidebar, show as slide-in drawer */
    .sidebar {
        transform: translateX(-100%);
        top: 0;
        padding-top: calc(var(--topbar-h) + 1rem);
        box-shadow: 4px 0 20px rgba(0,0,0,0.8);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Main content - full width + topbar offset */
    .content-area, .main {
        margin-left: 0;
        padding: 1.2rem;
        padding-top: calc(var(--topbar-h) + 1.2rem);
    }

    /* Header adjustments */
    header {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }

    h1.page-title {
        font-size: 0.55rem;
        letter-spacing: 1.5px;
        line-height: 2;
    }

    /* Stats grid - 2 per row on mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }

    .stat-card .value {
        font-size: 1.4rem;
    }

    /* Panel padding */
    .hacker-panel {
        padding: 1.2rem;
    }

    /* Avatar smaller */
    .avatar-box {
        width: 56px;
        height: 56px;
        min-width: 56px;
        font-size: 1.4rem;
    }

    /* Dashboard grid - single column */
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }

    /* Plans grid - 2 col on mobile */
    .plans-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.6rem;
    }

    .plan-card .price {
        font-size: 1.1rem !important;
    }

    /* Live feed grid columns smaller */
    .event-entry {
        grid-template-columns: 45px 85px 1fr;
        font-size: 0.62rem;
        padding: 0.5rem 0.6rem;
    }

    /* User pill wrap */
    .pills-row {
        gap: 6px;
    }

    .user-pill, .pill {
        font-size: 0.62rem;
        padding: 0.4rem 0.8rem;
    }

    /* Live feed height */
    .live-feed-list { max-height: 300px; }

    /* Countdown timer */
    .countdown-timer {
        font-size: 0.9rem !important;
        letter-spacing: 1px !important;
    }

    /* Ref box */
    .ref-box {
        font-size: 0.68rem !important;
        word-break: break-all;
    }
}

/* ─────────────── SMALL MOBILE (≤ 480px) ─────────────── */
@media screen and (max-width: 480px) {
    h1.page-title {
        font-size: 0.48rem;
    }

    .hacker-panel {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.8rem 0.6rem;
    }

    .stat-card .value {
        font-size: 1.2rem;
    }

    .stat-card .label {
        font-size: 0.5rem;
        letter-spacing: 0.5px;
    }

    /* Plans - 1 column on very small screens */
    .plans-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .plan-card .name {
        font-size: 0.42rem !important;
    }

    /* Event log - hide time column on tiny screens */
    .event-entry {
        grid-template-columns: 80px 1fr;
    }

    .ev-time { display: none; }

    /* Avatar + user info responsive */
    .user-info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .btn-hacker {
        font-size: 0.62rem;
        padding: 0.7rem 1rem;
    }
}

/* ─────────────── LARGE DESKTOP (≥ 1440px) ─────────────── */
@media screen and (min-width: 1440px) {
    :root {
        --sidebar-w: 280px;
    }

    .content-area, .main {
        padding: 3rem 4rem;
        max-width: 1400px;
    }

    h1.page-title {
        font-size: 0.85rem;
    }
}

/* ═══════════════════════════════════════════
   TOUCH IMPROVEMENTS
══════════════════════════════════════════ */
@media (hover: none) {
    /* On touch devices, remove hover effects that cause sticky states */
    .btn-hacker:hover {
        transform: none;
        box-shadow: 4px 4px 0 var(--secondary);
    }

    .nav-link.active::after { display: none; }

    /* Larger touch targets */
    .nav-link {
        min-height: 52px;
        padding: 1rem 1.5rem;
    }
}
