/* War Room Shared Styles */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

/* ============================================
   THEME SYSTEM - CSS Variables
   ============================================ */

/* War Room Theme (Default - Navy Blue) */
:root,
[data-theme="warroom"] {
    --war-room-bg: #0a0e27;
    --war-room-secondary-bg: #0f1430;
    --war-room-tertiary-bg: #1a1f3a;
    --war-room-primary: #00ff41;
    --war-room-secondary: #4a90e2;
    --war-room-accent: #ff6b35;
    --war-room-gold: #ffd700;
    --war-room-red: #ff6b6b;
    --war-room-terminal-green: #33ff00;
    --war-room-text: #ffffff;
    --war-room-text-muted: #8892b0;
    --war-room-border: #1a1f3a;
    --war-room-card-bg: #0f1430;
    --war-room-input-bg: #1a1f3a;
    --war-room-shadow: rgba(0, 255, 65, 0.2);
    --war-room-glow: rgba(0, 255, 65, 0.5);

    /* Convenience aliases */
    --primary-green: var(--war-room-primary);
    --primary-blue: var(--war-room-secondary);
    --dark-bg: var(--war-room-bg);
    --darker-bg: var(--war-room-secondary-bg);
    --dark-border: var(--war-room-tertiary-bg);
    --gold: var(--war-room-gold);
    --silver: #c0c0c0;
    --bronze: #cd7f32;
    --danger: var(--war-room-accent);
    --success: #4caf50;
    --white: var(--war-room-text);
    --red-indicator: var(--war-room-red);

    /* Position colors */
    --pos-qb: #a855f7;
    --pos-rb: #22c55e;
    --pos-wr: #ec4899;
    --pos-te: #f59e0b;
    --pos-def: #8b5cf6;
    --pos-k: #64748b;
}

/* Void Theme (True Black) */
[data-theme="void"] {
    --war-room-bg: #030508;
    --war-room-secondary-bg: #080c14;
    --war-room-tertiary-bg: #0e1520;
    --war-room-primary: #00ff41;
    --war-room-secondary: #00d4ff;
    --war-room-accent: #ff6b35;
    --war-room-gold: #ffd700;
    --war-room-red: #ff3366;
    --war-room-terminal-green: #00ff41;
    --war-room-text: #e0e0e0;
    --war-room-text-muted: #666666;
    --war-room-border: #1a2535;
    --war-room-card-bg: #0c1018;
    --war-room-input-bg: #0c1018;
    --war-room-shadow: rgba(0, 255, 65, 0.15);
    --war-room-glow: rgba(0, 255, 65, 0.4);
}

/* ============================================
   THEMED SCROLLBARS
   ============================================ */

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--war-room-bg);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--war-room-tertiary-bg);
    border-radius: 4px;
    border: 1px solid var(--war-room-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--war-room-secondary-bg);
    box-shadow: 0 0 8px var(--war-room-glow);
}

::-webkit-scrollbar-corner {
    background: var(--war-room-bg);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--war-room-tertiary-bg) var(--war-room-bg);
}

/* Smooth theme transitions */
body,
.navbar,
.data-terminal,
.command-header,
footer,
.dropdown-menu {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Override Bootstrap margins */
main.mt-5.pt-5 {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Base War Room Container */
body {
    background: var(--war-room-bg) !important;
    color: var(--war-room-text) !important;
    font-family: 'IBM Plex Mono', monospace !important;
}

/* Void theme keeps the same CRT effects as warroom */

/* Scanlines Overlay - CRT Effect */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 1000;
}

/* Command Header */
.command-header {
    background: linear-gradient(180deg, var(--war-room-secondary-bg) 0%, var(--war-room-bg) 100%);
    border-bottom: 2px solid var(--war-room-primary);
    padding: 40px 0;
    position: relative;
    overflow: hidden;
}

.command-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, var(--war-room-primary) 50%, transparent 100%);
    box-shadow: 0 0 15px var(--war-room-primary), 0 0 30px var(--war-room-glow);
    animation: scanline 2s ease-in-out infinite;
}

@keyframes scanline {
    0% { transform: translateX(-100%); opacity: 0.7; }
    50% { opacity: 1; }
    100% { transform: translateX(100%); opacity: 0.7; }
}

/* Status Bar */
.status-bar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 20px;
    color: var(--war-room-primary);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.green {
    background: var(--war-room-primary);
    box-shadow: 0 0 10px var(--war-room-primary);
}

.status-indicator.yellow {
    background: var(--war-room-gold);
    box-shadow: 0 0 10px var(--war-room-gold);
}

.status-indicator.red {
    background: var(--war-room-red);
    box-shadow: 0 0 10px var(--war-room-red);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Title Main */
.title-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(40px, 8vw, 80px);
    line-height: 0.9;
    margin-bottom: 15px;
}

.title-main .line {
    display: block;
    color: #ffffff;
}

.title-main .highlight {
    color: var(--war-room-primary);
    text-shadow: 0 0 20px rgba(0, 255, 65, 0.5);
}

/* Subtitle Text */
.subtitle-text {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    font-size: 14px;
    color: var(--war-room-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Container Main */
.container-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Terminal Window Components */
.terminal-header,
.selector-header,
.player-header,
.tab-header,
.module-header {
    background: var(--war-room-tertiary-bg);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--war-room-primary);
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.indicator.yellow {
    background: var(--war-room-gold);
}
.indicator.green {
    background: var(--war-room-primary);
}

.terminal-title,
.selector-title,
.player-title,
.tab-title {
    font-size: 12px;
    color: var(--war-room-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-left: auto;
    font-family: 'IBM Plex Mono', monospace;
}

/* Data Terminal */
.data-terminal {
    background: var(--war-room-secondary-bg);
    border: 2px solid var(--war-room-primary);
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.2);
    margin-bottom: 24px;
}

.terminal-content {
    padding: 20px;
}

/* War Room Buttons */
.btn-war-room {
    background: var(--war-room-bg);
    border: 1px solid var(--war-room-primary);
    color: var(--war-room-primary);
    padding: 14px 28px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'IBM Plex Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-war-room::before {
    content: '>';
    font-weight: 700;
}

.btn-war-room:hover {
    background: var(--war-room-secondary-bg);
    border-color: var(--war-room-primary);
    color: var(--war-room-primary);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.3);
    text-decoration: none;
    transform: translateY(-2px);
}

/* ============================================
   GLITCH EFFECT
   ============================================ */

/* Glitch effect - chromatic aberration on hover */
.glitch-hover:hover {
    animation: glitch 0.3s ease-in-out;
}

/* Continuous glitch effect */
.glitch-continuous {
    animation: glitch 2s ease-in-out infinite;
}

/* Subtle glitch on hover */
.glitch-subtle:hover {
    animation: glitch-subtle 0.4s ease-in-out;
}

@keyframes glitch {
    0% {
        text-shadow: 0 0 20px var(--war-room-glow), 0 0 40px var(--war-room-glow);
    }
    25% {
        text-shadow: -2px 0 var(--war-room-red), 2px 0 var(--war-room-secondary);
    }
    50% {
        text-shadow: 2px 0 var(--war-room-red), -2px 0 var(--war-room-secondary);
    }
    75% {
        text-shadow: -1px 0 var(--war-room-red), 1px 0 var(--war-room-secondary);
    }
    100% {
        text-shadow: 0 0 20px var(--war-room-glow), 0 0 40px var(--war-room-glow);
    }
}

@keyframes glitch-subtle {
    0%, 100% {
        text-shadow: 0 0 10px var(--war-room-glow);
    }
    25% {
        text-shadow: -1px 0 var(--war-room-red), 1px 0 var(--war-room-secondary);
    }
    50% {
        text-shadow: 1px 0 var(--war-room-red), -1px 0 var(--war-room-secondary);
    }
    75% {
        text-shadow: -0.5px 0 var(--war-room-red), 0.5px 0 var(--war-room-secondary);
    }
}

/* Box/container glitch effect */
.glitch-box:hover {
    animation: glitch-box 0.3s ease-in-out;
}

@keyframes glitch-box {
    0% {
        box-shadow: 0 0 20px var(--war-room-glow);
    }
    25% {
        box-shadow: -3px 0 0 var(--war-room-red), 3px 0 0 var(--war-room-secondary);
    }
    50% {
        box-shadow: 3px 0 0 var(--war-room-red), -3px 0 0 var(--war-room-secondary);
    }
    75% {
        box-shadow: -1px 0 0 var(--war-room-red), 1px 0 0 var(--war-room-secondary);
    }
    100% {
        box-shadow: 0 0 20px var(--war-room-glow);
    }
}

/* Title highlight glitch (for .highlight elements) */
.title-main .highlight.glitch-hover:hover,
.title-main.glitch-hover:hover .highlight {
    animation: glitch 0.3s ease-in-out;
}

/* ============================================
   TOOLTIP STYLES
   ============================================ */

/* Tooltip marker - the "?" icon */
.tooltip-marker,
.tooltip-icon {
    width: 14px;
    height: 14px;
    background: var(--war-room-bg);
    border: 1px solid var(--war-room-primary);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: var(--war-room-primary);
    cursor: help;
    position: relative;
    margin-left: 4px;
    vertical-align: middle;
    transition: all 0.2s ease;
}

.tooltip-marker:hover,
.tooltip-icon:hover {
    background: var(--war-room-primary);
    color: var(--war-room-bg);
    box-shadow: 0 0 10px var(--war-room-glow);
}

/* Global tooltip element - positioned via JS */
.war-room-tooltip {
    position: fixed;
    background: var(--war-room-secondary-bg);
    border: 1px solid var(--war-room-primary);
    padding: 10px 14px;
    border-radius: 4px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    max-width: 280px;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 255, 65, 0.4), 0 0 0 1px rgba(0, 255, 65, 0.2);
    color: var(--war-room-text);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.war-room-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.war-room-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--war-room-primary);
}

/* Adjust arrow when tooltip is shown below */
.war-room-tooltip.below::after {
    bottom: auto;
    top: -6px;
    border-top: none;
    border-bottom: 6px solid var(--war-room-primary);
}

/* ============================================
   COLLAPSIBLE PANELS
   ============================================ */

/* Collapsible header styles */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.collapsible-header:hover {
    background: rgba(0, 255, 65, 0.05);
}

.collapsible-header:focus {
    outline: 2px solid var(--war-room-primary);
    outline-offset: -2px;
}

.collapsible-header:focus:not(:focus-visible) {
    outline: none;
}

/* Collapsible header layout - dots left, badge center, title right */
.collapsible-panel .collapsible-header {
    position: relative;
    justify-content: flex-start;
}

/* Title always positioned on the right */
.collapsible-panel .collapsible-header .terminal-title,
.collapsible-panel .collapsible-header .selector-title {
    position: absolute;
    right: 16px;
    margin-left: 0;
}

/* Badge centered in the header */
.collapsible-panel .collapsible-header .panel-badge {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    transition: opacity 0.3s ease;
}

/* Header actions container - next to dots */
.collapsible-header .header-actions {
    display: flex;
    gap: 0.5rem;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    margin-left: 16px;
}

/* Hide header actions when collapsed */
.collapsible-panel.collapsed .header-actions {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    position: absolute;
}

/* Indicator dot state changes for collapsed panels */
.collapsible-panel .indicator {
    transition: opacity 0.3s ease, box-shadow 0.3s ease;
}

/* When expanded: green is bright/glowing, yellow is normal */
.collapsible-panel .indicator.green {
    box-shadow: 0 0 8px var(--war-room-primary);
}

.collapsible-panel .indicator.yellow {
    opacity: 0.5;
}

/* When collapsed: dim green, brighten yellow to indicate collapsed state */
.collapsible-panel.collapsed .indicator.green {
    opacity: 0.3;
    box-shadow: none;
}

.collapsible-panel.collapsed .indicator.yellow {
    opacity: 1;
    box-shadow: 0 0 8px var(--war-room-gold);
}

/* Panel badge (for showing counts, status) */
.panel-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 3px;
    background: rgba(0, 255, 65, 0.15);
    color: var(--war-room-primary);
    font-family: 'IBM Plex Mono', monospace;
    margin-left: 8px;
}

.panel-badge.warning {
    background: rgba(255, 150, 0, 0.15);
    color: var(--war-room-gold);
}

.panel-badge.danger,
.panel-badge.error {
    background: rgba(255, 100, 100, 0.15);
    color: var(--war-room-red);
}

.panel-badge.success {
    background: rgba(0, 255, 65, 0.15);
    color: var(--war-room-primary);
}

/* Collapsible content */
.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.collapsed .collapsible-content {
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Ensure terminal-content respects collapse */
.collapsed .terminal-content.collapsible-content {
    max-height: 0 !important;
    padding: 0 !important;
    overflow: hidden;
}

/* Section panel (non-terminal collapsible) */
.section-panel {
    background: var(--war-room-secondary-bg);
    border: 1px solid var(--war-room-border);
    border-radius: 8px;
    margin-bottom: 24px;
}

.section-header {
    background: var(--war-room-tertiary-bg);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--war-room-border);
    border-radius: 8px 8px 0 0;
}

.collapsed .section-header {
    border-bottom: none;
    border-radius: 8px;
}

.section-header i {
    color: var(--war-room-primary);
    font-size: 14px;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--war-room-text);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'IBM Plex Mono', monospace;
}

.section-content {
    padding: 20px;
}

/* Collapsed state for data terminals */
.data-terminal.collapsed .terminal-header {
    border-bottom: none;
    border-radius: 6px;
}

.data-terminal.collapsed {
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.1);
    overflow: hidden !important;
}

/* Ensure collapsible panels clip content when collapsed */
.collapsible-panel.collapsed {
    overflow: hidden !important;
}

/* Hover effect on collapsed panels */
.collapsible-panel.collapsed:hover {
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.25);
}

/* ============================================
   SKIP LINK - Accessibility
   ============================================ */

.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    background: var(--war-room-primary);
    color: var(--war-room-bg);
    padding: 8px 16px;
    z-index: 10000;
    text-decoration: none;
    font-weight: bold;
}

.skip-link:focus {
    position: fixed;
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    overflow: visible;
}

/* Responsive */
@media (max-width: 768px) {
    .command-header {
        padding: 30px 0;
    }

    .status-bar {
        font-size: 9px;
        gap: 10px;
        flex-wrap: wrap;
    }

    .terminal-content {
        padding: 12px;
    }

    .title-main {
        font-size: clamp(32px, 10vw, 48px);
    }

    /* Hide tooltips on mobile - they don't work well with touch */
    .tooltip-marker:hover::before,
    .tooltip-marker:hover::after,
    .tooltip-icon:hover::before,
    .tooltip-icon:hover::after {
        display: none;
    }

    .panel-badge {
        font-size: 9px;
        padding: 1px 6px;
    }
}
