/**
 * Undead Carnival - Classic 2000s Horror Theme
 * 4:3 centered layout with beveled edges and classic web design
 */

/* ============================================
   CSS VARIABLES
   ============================================ */

:root {
    --blood: #cc0000;
    --blood-dark: #880000;
    --blood-darker: #550000;
    --blood-glow: rgba(200, 0, 0, 0.5);
    
    --bg-body: #1a1a1a;
    --bg-dark: #0d0d0d;
    --bg-panel: #1f1f1f;
    --bg-header: #2a2a2a;
    --bg-input: #151515;
    
    --border-light: #444;
    --border-dark: #222;
    --border-highlight: #555;
    
    --text-white: #ffffff;
    --text-light: #e0e0e0;
    --text-gray: #aaaaaa;
    --text-dim: #777777;
    
    --gold: #ffd700;
    --silver: #c0c0c0;
    --bronze: #cd7f32;
    
    --server-empty: #44aa44;
    --server-players: #ffff47;
    --server-half: #ddaa00;
    --server-full: #cc3333;
    
    --font-display: 'Nosifer', cursive;
    --font-heading: 'Special Elite', monospace;
    --font-mono: 'Share Tech Mono', monospace;
    --font-body: 'Rajdhani', Arial, sans-serif;
}

/* ============================================
   CUSTOM SCROLLBAR
   ============================================ */

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

::-webkit-scrollbar-track {
    background: #1a1010;
    border: 1px solid #2a1515;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #4a2020 0%, #2a1010 50%, #4a2020 100%);
    border: 1px solid #5a2525;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #5a2525 0%, #3a1515 50%, #5a2525 100%);
}

::-webkit-scrollbar-corner {
    background: #1a1010;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #4a2020 #1a1010;
}

/* ============================================
   RESET & BASE
   ============================================ */

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

html {
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-light);
    background: var(--bg-body);
    background-image: 
        radial-gradient(ellipse at center, #222 0%, #111 100%);
    min-height: 100vh;
}

a {
    color: var(--blood);
    text-decoration: none;
    font-weight: bold;
}

a:hover {
    color: #ff4444;
    text-decoration: underline;
}

/* ============================================
   ATMOSPHERIC EFFECTS (subtle)
   ============================================ */

.grain {
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 10000;
}

.vignette {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 0%, transparent 50%, rgba(0,0,0,0.4) 100%);
    pointer-events: none;
    z-index: 9998;
}

.scanlines, .fog { display: none; }

/* ============================================
   CLASSIC 4:3 LAYOUT
   ============================================ */

.page-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    padding: 10px;
    background: var(--bg-dark);
    border-left: 3px solid var(--border-highlight);
    border-right: 3px solid var(--border-dark);
    min-height: 100vh;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
}

/* ============================================
   HEADER - Classic Banner Style
   ============================================ */

.site-header {
    background: linear-gradient(180deg, #2a1515 0%, #1a0a0a 100%);
    border: 2px solid;
    border-color: #4a2020 #1a0808 #1a0808 #4a2020;
    padding: 20px 15px;
    text-align: center;
    margin-bottom: 0;
}

.site-title {
    font-family: var(--font-display);
    font-size: 42px;
    font-weight: normal;
    color: var(--text-white);
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 3px 3px 0 #000, 0 0 20px var(--blood-glow);
    margin: 0;
}

.site-title .highlight {
    color: var(--blood);
    text-shadow: 3px 3px 0 #000, 0 0 30px var(--blood);
}

.site-tagline {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-top: 5px;
}

/* ============================================
   NAVIGATION - Classic Tab Style
   ============================================ */

.main-nav {
    background: linear-gradient(180deg, #3a1515 0%, #2a0a0a 100%);
    border: 2px solid;
    border-color: #5a2525 #1a0505 #1a0505 #5a2525;
    padding: 0;
    margin-bottom: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nav-inner {
    display: flex;
    justify-content: center;
    min-width: max-content;
}

.nav-link {
    font-family: var(--font-mono);
    font-weight: bold;
    color: var(--text-light);
    padding: 12px 25px;
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    border-right: 1px solid #4a2020;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-link:last-child {
    border-right: none;
}

.nav-link:hover {
    background: #4a1515;
    color: #fff;
    text-decoration: none;
}

.nav-link.active {
    background: var(--blood-dark);
    color: #fff;
}

/* ============================================
   STATS BAR
   ============================================ */

.stats-bar {
    background: linear-gradient(180deg, #252525 0%, #1a1a1a 100%);
    border: 2px solid;
    border-color: #444 #222 #222 #444;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 5px;
}

.stat-item {
    text-align: center;
    padding: 5px 10px;
    min-width: 60px;
    flex: 1 1 auto;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: bold;
    color: var(--blood);
    display: block;
}

.stat-value.live {
    color: #44dd44;
}

.stat-label {
    font-size: 11px;
    font-weight: bold;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================
   CONTENT GRID - Classic 2-Column
   ============================================ */

.content-grid {
    display: flex;
    gap: 10px;
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ============================================
   PANELS - Classic Beveled Box
   ============================================ */

.panel {
    background: linear-gradient(180deg, #222 0%, #181818 100%);
    border: 2px solid;
    border-color: #444 #1a1a1a #1a1a1a #444;
}

.panel-header {
    background: linear-gradient(180deg, #333 0%, #252525 100%);
    border-bottom: 2px solid;
    border-color: #444 #1a1a1a #1a1a1a #444;
    padding: 8px 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: bold;
    color: var(--text-white);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.panel-body {
    padding: 8px;
}

/* ============================================
   SECTION HEADERS
   ============================================ */

.section-header {
    background: linear-gradient(180deg, #2a1515 0%, #1a0a0a 100%);
    border: 2px solid;
    border-color: #4a2020 #1a0808 #1a0808 #4a2020;
    padding: 10px 12px;
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: bold;
    color: var(--blood);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.section-header .icon {
    margin-right: 8px;
}

/* ============================================
   SERVER LIST - Compact
   ============================================ */

.server-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.server-card {
    background: linear-gradient(180deg, #222 0%, #1a1a1a 100%);
    border: 1px solid #333;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.server-card.offline {
    opacity: 0.5;
}

.server-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.2);
}

.server-status.online {
    background: var(--server-empty);
    box-shadow: 0 0 6px var(--server-empty);
}

.server-status.has-players {
    background: var(--server-players);
    box-shadow: 0 0 8px var(--server-players);
}

.server-status.half-full {
    background: var(--server-half);
    box-shadow: 0 0 8px var(--server-half);
}

.server-status.full {
    background: var(--server-full);
    box-shadow: 0 0 8px var(--server-full);
}

.server-status.offline {
    background: #333;
}

.server-info {
    flex: 1;
    min-width: 0;
}

.server-name {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.server-details {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-gray);
}

.server-map {
    text-align: center;
    min-width: 100px;
}

.server-map-name {
    font-size: 13px;
    font-weight: bold;
    color: #ddaa44;
}

.server-map-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
}

.server-players {
    text-align: center;
    min-width: 50px;
}

.server-player-count {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: bold;
}

.server-player-count.empty { color: var(--server-empty); }
.server-player-count.has-players { color: var(--server-players); }
.server-player-count.half-full { color: var(--server-half); }
.server-player-count.full { color: var(--server-full); }

.server-player-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
}

.server-join {
    background: linear-gradient(180deg, #333 0%, #222 100%);
    border: 1px solid #444;
    padding: 5px 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: bold;
    color: var(--text-gray);
    text-transform: uppercase;
    text-decoration: none;
}

.server-join:hover {
    background: linear-gradient(180deg, #444 0%, #333 100%);
    color: #fff;
    text-decoration: none;
}

/* ============================================
   LEADERBOARDS
   ============================================ */

.leaderboards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.leaderboard {
    background: linear-gradient(180deg, #222 0%, #181818 100%);
    border: 2px solid;
    border-color: #444 #1a1a1a #1a1a1a #444;
}

.leaderboard-header {
    background: linear-gradient(180deg, #333 0%, #252525 100%);
    border-bottom: 1px solid #444;
    padding: 8px 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: bold;
    color: var(--text-white);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.leaderboard-header .icon {
    margin-right: 5px;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid #2a2a2a;
    font-size: 13px;
}

.leaderboard-row:last-child {
    border-bottom: none;
}

.leaderboard-row:hover {
    background: #2a2a2a;
}

.leaderboard-row.rank-1 {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.15) 0%, transparent 70%);
}
.leaderboard-row.rank-1 .rank { color: var(--gold); font-weight: bold; }
.leaderboard-row.rank-1 .name { color: #ffe066; }

.leaderboard-row.rank-2 {
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.1) 0%, transparent 70%);
}
.leaderboard-row.rank-2 .rank { color: var(--silver); }

.leaderboard-row.rank-3 {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.1) 0%, transparent 70%);
}
.leaderboard-row.rank-3 .rank { color: var(--bronze); }

.rank {
    width: 20px;
    font-family: var(--font-mono);
    font-weight: bold;
    color: var(--text-dim);
}

.country-flag {
    margin-right: 4px;
}

.country-code {
    font-weight: bold;
    color: var(--text-white);
    margin-right: 3px;
}

.name {
    flex: 1;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: bold;
}

.value {
    font-family: var(--font-mono);
    font-weight: bold;
    color: var(--blood);
    min-width: 50px;
    text-align: right;
}

/* ============================================
   ACTIVITY CALENDAR
   ============================================ */

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    padding: 8px;
}

.calendar-cell {
    aspect-ratio: 1;
    background: #1a1a1a;
    border: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: bold;
    color: var(--text-dim);
}

.calendar-cell.level-1 { background: #2a1818; color: var(--text-gray); }
.calendar-cell.level-2 { background: #3a1c1c; color: var(--text-light); }
.calendar-cell.level-3 { background: #4a2020; color: var(--text-white); }
.calendar-cell.level-4 { background: #5a2525; color: #fff; border-color: #6a3030; }

.calendar-legend {
    display: flex;
    justify-content: space-between;
    padding: 0 8px 8px;
    font-size: 10px;
    color: var(--text-dim);
}

/* ============================================
   SURVIVAL TIMES
   ============================================ */

.survival-time-row {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid #2a2a2a;
    gap: 8px;
    font-size: 13px;
}

.survival-time-row:last-child {
    border-bottom: none;
}

.survival-time-row:hover {
    background: #2a2a2a;
}

.survival-time-row.rank-1 {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.1) 0%, transparent 70%);
}

.survival-rank {
    width: 18px;
    font-family: var(--font-mono);
    font-weight: bold;
    color: var(--text-dim);
}

.survival-medal {
    font-size: 12px;
}

.survival-info {
    flex: 1;
    min-width: 0;
}

.survival-player {
    font-weight: bold;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.survival-map {
    font-size: 10px;
    color: var(--text-gray);
}

.survival-time {
    font-family: var(--font-mono);
    font-weight: bold;
    color: var(--blood);
}

/* ============================================
   PIE CHARTS
   ============================================ */

.pie-chart-wrapper {
    display: flex;
    justify-content: center;
    padding: 10px;
}

.pie-chart {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid #444;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.pie-legend {
    padding: 5px 8px;
}

.pie-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 12px;
}

.pie-legend-color {
    width: 12px;
    height: 12px;
    border: 1px solid #555;
    flex-shrink: 0;
}

.pie-legend-label {
    flex: 1;
    font-weight: bold;
    color: var(--text-light);
}

.pie-legend-value {
    font-family: var(--font-mono);
    font-weight: bold;
    color: var(--text-gray);
    font-size: 11px;
}

/* ============================================
   NO DATA
   ============================================ */

.no-data {
    padding: 15px;
    text-align: center;
    color: var(--text-dim);
    font-style: italic;
}

/* ============================================
   LOADING
   ============================================ */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-dim);
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #333;
    border-top-color: var(--blood);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton {
    background: linear-gradient(90deg, #222 25%, #2a2a2a 50%, #222 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.hidden { display: none !important; }

.error-message {
    background: #2a1515;
    border: 1px solid #4a2020;
    padding: 10px;
    text-align: center;
    color: var(--blood);
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
    background: linear-gradient(180deg, #252525 0%, #1a1a1a 100%);
    border: 2px solid;
    border-color: #444 #222 #222 #444;
    padding: 12px;
    text-align: center;
    margin-top: 10px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 8px;
}

.footer-link {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-gray);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 5px;
}

.footer-link:hover {
    color: var(--blood);
}

.cache-info {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 900px) {
    .content-grid {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .sidebar .panel {
        flex: 1;
        min-width: 250px;
    }
    
    .leaderboards-grid {
        grid-template-columns: 1fr;
    }
    
    .server-map, .server-join {
        display: none;
    }
}

@media (max-width: 600px) {
    .page-wrapper {
        padding: 5px;
        border-left-width: 1px;
        border-right-width: 1px;
    }
    
    .site-header {
        padding: 15px 10px;
    }
    
    .site-title {
        font-size: 28px;
        letter-spacing: 2px;
    }
    
    .site-tagline {
        font-size: 9px;
        letter-spacing: 2px;
    }
    
    .nav-link {
        padding: 10px 15px;
        font-size: 11px;
    }
    
    .stats-bar {
        padding: 8px 5px;
        gap: 3px;
    }
    
    .stat-item {
        padding: 3px 5px;
        min-width: 50px;
    }
    
    .stat-value {
        font-size: 16px;
    }
    
    .stat-label {
        font-size: 8px;
        letter-spacing: 0;
    }
    
    .sidebar .panel {
        min-width: 100%;
    }
    
    .section-header {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .panel-header {
        font-size: 10px;
        padding: 5px 8px;
    }
}
