/* GameCore - Server Rack & Gaming Edition */

:root {
    /* Color Palette - Industrial Sci-Fi / Rack Server */
    --bg-primary: #050505;
    --bg-secondary: #0f1115;
    --bg-tertiary: #181b21;

    /* Rack Unit Colors (Faceplates) */
    --rack-faceplate: #1a1c23;
    --rack-faceplate-hover: #22252e;
    --rack-border: #333842;
    --rack-screw: #0a0a0a;

    /* Accents - LED Status Lights */
    --accent-primary: #00bcd4;
    /* Cyan LED */
    --accent-secondary: #9c27b0;
    /* Purple Neon */
    --accent-gradient: linear-gradient(90deg, #00bcd4, #2196f3);

    /* Functional Status */
    --status-online: #00ff88;
    /* Bright Green LED */
    --status-offline: #4a505b;
    /* Dim/Dead LED */
    --status-warning: #ffb300;
    /* Amber Warning LED */
    --status-danger: #ff3d00;
    /* Red Alert LED */

    /* Text */
    --text-primary: #e0e6ed;
    --text-secondary: #94a3b8;
    --text-muted: #5e6b7c;
    --text-mono: 'JetBrains Mono', 'Consolas', monospace;

    /* Shadows & Glows */
    --shadow-rack: 0 4px 6px -1px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --glow-cyan: 0 0 10px rgba(0, 188, 212, 0.4);
    --glow-green: 0 0 8px rgba(0, 255, 136, 0.5);

    /* Metrics */
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 6px;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    font-family: 'Rajdhani', 'Inter', system-ui, -apple-system, sans-serif;
    /* Tech font preference */
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Background Setup */
body {
    background-image:
        linear-gradient(rgba(5, 5, 5, 0.85), rgba(5, 5, 5, 0.95)),
        url('/images/Background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

/* Layout */
.page-container {
    display: flex;
    min-height: 100vh;
}

.mobile-header {
    display: none;
    height: 60px;
    background: var(--rack-faceplate);
    border-bottom: 2px solid var(--rack-border);
    align-items: center;
    padding: 0 16px;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.mobile-toggle-btn {
    background: none;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0, 188, 212, 0.2);
    margin-right: 12px;
}

.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 2px solid var(--rack-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    /* Mesh Pattern for Sidebar */
    background-image: radial-gradient(#1f232b 1px, transparent 1px);
    background-size: 8px 8px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    min-height: 100vh;
}

/* Logo Area - "Brand Plate" */
.logo-container {
    padding: 24px;
    background: var(--rack-faceplate);
    border-bottom: 2px solid var(--rack-border);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.logo-nav-img {
    width: 100%;
    height: auto;
    max-width: 180px;
}

/* Navigation - "Control Panel Switches" */
.nav-menu {
    flex: 1;
    padding: 20px 12px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    /* Square/Tech edges */
    margin-bottom: 6px;
    transition: all 0.2s ease;
    background: linear-gradient(90deg, transparent, transparent);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(0, 188, 212, 0.1), transparent);
    color: var(--accent-primary);
    border-left: 3px solid var(--accent-primary);
    text-shadow: 0 0 8px rgba(0, 188, 212, 0.4);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Cards = "Server Units / Blades" */
.card {
    background: var(--rack-faceplate);
    border: 1px solid var(--rack-border);
    border-top: 2px solid var(--rack-border);
    /* Thicker top/bottom creates rack unit feel */
    border-bottom: 2px solid var(--rack-border);
    border-radius: 2px;
    padding: 24px;
    position: relative;
    box-shadow: var(--shadow-rack);
}

/* Simulated Rack Screws */
.card::before,
.card::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: #111;
    border-radius: 50%;
    border: 1px solid #333;
    top: 10px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8);
}

.card::before {
    left: 8px;
}

.card::after {
    right: 8px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.4);
    padding-bottom: 12px;
}

.card-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-primary);
}

/* Stat Cards - "Module Readouts" */
.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.2);
    /* Inset darker */
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: #111;
    border: 1px solid #333;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
    color: var(--text-muted);
}

/* Specific glows for active stats */
.stat-icon.servers {
    color: var(--status-online);
    text-shadow: var(--glow-green);
    border-color: rgba(0, 255, 136, 0.2);
}

.stat-icon.cpu {
    color: var(--accent-primary);
    text-shadow: var(--glow-cyan);
    border-color: rgba(0, 188, 212, 0.2);
}

.stat-icon.online {
    color: var(--status-online);
    text-shadow: var(--glow-green);
    border-color: rgba(0, 255, 136, 0.2);
}


.stat-value {
    font-family: var(--text-mono);
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -1px;
}

.stat-content {
    flex: 1;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Status Badges - "LED Indicators" */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 2px 10px;
    border-radius: 2px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: #000;
    border: 1px solid #333;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 5px currentColor;
    /* LED Glow */
}

.badge-online,
.badge-running {
    color: var(--status-online);
    border-color: rgba(0, 255, 136, 0.3);
}

.badge-offline,
.badge-stopped {
    color: var(--status-offline);
    border-color: #333;
    box-shadow: none;
}

.badge-offline::before {
    box-shadow: none;
    background: #333;
}

.badge-starting {
    color: var(--accent-primary);
    animation: blink 1s infinite;
}

.badge-crashed {
    color: var(--status-danger);
    animation: blink 0.5s infinite;
}

@keyframes blink {
    50% {
        opacity: 0.3;
    }
}

/* Buttons - "Tactile Switches" */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 20px;
    border: 1px solid transparent;
    border-radius: 2px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Rajdhani', sans-serif;
}

.btn-primary {
    background: linear-gradient(180deg, #1565c0, #0d47a1);
    border: 1px solid #1e88e5;
    color: #fff;
    box-shadow: 0 2px 0 #002171;
}

.btn-primary:active {
    transform: translateY(2px);
    box-shadow: none;
}

.btn-secondary {
    background: linear-gradient(180deg, #2d313a, #22252e);
    border: 1px solid #454d5e;
    color: var(--text-primary);
    box-shadow: 0 2px 0 #181b21;
}

.btn-secondary:hover {
    background: linear-gradient(180deg, #383d49, #2d313a);
}

.btn-secondary:active {
    transform: translateY(2px);
    box-shadow: none;
}

.btn-success {
    background: linear-gradient(180deg, #00796b, #004d40);
    border: 1px solid #009688;
    color: #fff;
    box-shadow: 0 2px 0 #00251a;
}

.btn-success:hover {
    box-shadow: 0 2px 0 #00251a, 0 0 10px rgba(0, 255, 136, 0.4);
}

.btn-danger {
    background: linear-gradient(180deg, #c62828, #b71c1c);
    border: 1px solid #ef5350;
    color: #fff;
    box-shadow: 0 2px 0 #7f0000;
}

.btn-danger:hover {
    box-shadow: 0 2px 0 #7f0000, 0 0 10px rgba(255, 61, 0, 0.4);
}

/* Tables - "Data Grids" */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
    /* Space between rows */
}

.data-table th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid var(--accent-primary);
}

.data-table td {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table tr td:first-child {
    border-left: 2px solid transparent;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.05);
}

.data-table tr:hover td:first-child {
    border-left-color: var(--accent-primary);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 10px;
    background: #000;
    border: 1px solid #333;
    border-radius: 0;
    /* Keep it square */
    color: var(--accent-primary);
    font-family: var(--text-mono);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5), 0 0 5px rgba(0, 188, 212, 0.3);
}

/* Console Terminals */
.console {
    background: #050505;
    border: 1px solid #333;
    padding: 20px;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    color: #ccc;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
    position: relative;
    max-height: 500px;
    overflow-y: auto;
}

.console::before {
    content: "TERMINAL_OUTPUT";
    position: absolute;
    top: 0;
    right: 0;
    background: #333;
    color: #000;
    font-size: 0.6rem;
    padding: 2px 8px;
    font-weight: bold;
}

.console-line {
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 2px;
}

.console-line.error {
    color: var(--status-danger);
}

.console-line.info {
    color: var(--accent-primary);
}

/* Utilities */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 1024px) {

    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 1001;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding-top: 80px;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 2px;
    background: var(--accent-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Error Pages */
.error-page-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80vh;
    text-align: center;
    background: radial-gradient(circle at center, rgba(0, 188, 212, 0.05) 0%, transparent 70%);
}

.error-code {
    font-family: 'Orbitron', sans-serif;
    font-size: 8rem;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 0;
    text-shadow: 0 0 20px currentColor;
    opacity: 0.9;
}

.error-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 2rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 1rem;
    font-weight: 700;
    border-bottom: 2px solid currentColor;
    padding-bottom: 0.5rem;
    display: inline-block;
}

.error-message {
    font-family: 'Inter', sans-serif;
    color: var(--text-secondary);
    max-width: 500px;
    margin-bottom: 2rem;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

/* Specific Colors */
.error-404 {
    color: var(--status-warning);
}

.error-403 {
    color: var(--status-danger);
}

.error-500 {
    color: var(--status-danger);
}

.error-502 {
    color: var(--text-muted);
}


.error-logo {
    width: 100px;
    height: 100px;
    margin-bottom: 2rem;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 188, 212, 0.2);
}


/* Remove focus outline on error headers */
h1:focus,
.error-code:focus {
    outline: none !important;
    box-shadow: none !important;
}