/* ==========================================================================
   MAFIA STREAM — Broadcast Control Center
   Powered By Avril
   Design System & Premium Cinematic Dark Theme
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    --bg-main: #080A0F;
    --bg-sidebar: #0B0E14;
    --bg-surface: #111722;
    --bg-surface-elevated: #161D2B;
    --bg-input: #0A0D14;
    --border-subtle: #1C2330;
    --border-default: #252D3A;
    --border-highlight: #374254;
    --accent-primary: #E31B32;
    --accent-hover: #FF3548;
    --accent-glow: rgba(227, 27, 50, 0.25);
    --text-primary: #F4F6FA;
    --text-secondary: #98A2B3;
    --text-muted: #5C6779;
    --status-live: #10B981;
    --status-live-glow: rgba(16, 185, 129, 0.35);
    --status-scheduled: #3B82F6;
    --status-warning: #F59E0B;
    --status-error: #EF4444;
    --status-stopped: #64748B;
}

/* Global resets & typography */
* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* Custom Font Mono for numbers & codes */
.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

/* Sidebar styling */
.mafia-sidebar,
.sidebar-gradient {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-default);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Navigation items */
.nav-item {
    color: var(--text-secondary);
    border: 1px solid transparent;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.04);
    border-color: var(--border-subtle);
}

.nav-item.active {
    color: #FFFFFF;
    background: linear-gradient(90deg, rgba(227, 27, 50, 0.18) 0%, rgba(227, 27, 50, 0.05) 100%);
    border-left: 3px solid var(--accent-primary);
    border-top: 1px solid rgba(227, 27, 50, 0.2);
    border-bottom: 1px solid rgba(227, 27, 50, 0.2);
    border-right: 1px solid transparent;
    font-weight: 700;
}

.nav-item.active i {
    color: var(--accent-primary);
    filter: drop-shadow(0 0 6px var(--accent-glow));
}

/* Surface Cards */
.card-mafia {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 0.875rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-mafia:hover {
    border-color: var(--border-highlight);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

/* Accent border accents */
.card-mafia-highlight {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    position: relative;
    overflow: hidden;
}

.card-mafia-highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), transparent);
}

/* Header style */
.mafia-header {
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-default);
}

/* Primary Mafia Button */
.btn-mafia-primary {
    background: linear-gradient(135deg, #E31B32 0%, #B31324 100%);
    color: #FFFFFF;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 10px rgba(227, 27, 50, 0.3);
    transition: all 0.2s ease-in-out;
}

.btn-mafia-primary:hover {
    background: linear-gradient(135deg, #FF3548 0%, #E31B32 100%);
    box-shadow: 0 4px 18px rgba(227, 27, 50, 0.5);
    transform: translateY(-1px);
}

.btn-mafia-primary:active {
    transform: translateY(0);
}

/* Secondary Button */
.btn-mafia-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

.btn-mafia-secondary:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: var(--border-highlight);
    color: #FFFFFF;
}

/* Mafia Input fields */
.input-mafia {
    background-color: var(--bg-input);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    border-radius: 0.625rem;
    transition: all 0.2s ease;
}

.input-mafia:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-mafia::placeholder {
    color: var(--text-muted);
}

select.input-mafia option {
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

/* Live Pulsing Dot */
@keyframes mafia-pulse-dot {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 var(--status-live-glow); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.pulsing-live {
    width: 8px;
    height: 8px;
    background-color: var(--status-live);
    border-radius: 50%;
    display: inline-block;
    animation: mafia-pulse-dot 2s infinite;
}

/* Red Live Pulsing Dot */
@keyframes mafia-pulse-red {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(227, 27, 50, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(227, 27, 50, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(227, 27, 50, 0); }
}

.pulsing-red {
    width: 8px;
    height: 8px;
    background-color: var(--accent-primary);
    border-radius: 50%;
    display: inline-block;
    animation: mafia-pulse-red 2s infinite;
}

/* Terminal Log Console */
.terminal-window {
    background: #05070B;
    color: #38BDF8;
    font-family: 'JetBrains Mono', 'Courier New', Courier, monospace;
    border: 1px solid var(--border-default);
    border-radius: 0.75rem;
    padding: 1.25rem;
    max-height: 480px;
    overflow-y: auto;
    font-size: 0.8125rem;
    line-height: 1.5;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-highlight);
}

/* Table styling */
.mafia-table th {
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-default);
}

.mafia-table td {
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.mafia-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.badge-live {
    background: rgba(16, 185, 129, 0.12);
    color: #34D399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-error {
    background: rgba(239, 68, 68, 0.12);
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-scheduled {
    background: rgba(59, 130, 246, 0.12);
    color: #60A5FA;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-stopped {
    background: rgba(100, 116, 139, 0.14);
    color: #94A3B8;
    border: 1px solid rgba(100, 116, 139, 0.25);
}

.badge-retry {
    background: rgba(245, 158, 11, 0.12);
    color: #FBBF24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Mobile responsive drawer */
@media (max-width: 1024px) {
    #app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        transform: translateX(-100%);
        z-index: 50;
    }
    #app-sidebar.open {
        transform: translateX(0);
    }
    #sidebar-backdrop {
        position: fixed;
        inset: 0;
        background-color: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(4px);
        z-index: 40;
    }
}

#sidebar-backdrop.hidden,
#sidebar-backdrop[hidden] {
    display: none !important;
    pointer-events: none !important;
}

@media (min-width: 1025px) {
    #sidebar-backdrop {
        display: none !important;
        pointer-events: none !important;
    }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .pulsing-live, .pulsing-red {
        animation: none;
    }
}
