:root {
    /* Base Colors - Deep Dark Theme */
    --bg-primary: #08090B;
    --bg-secondary: #0F1216;
    --bg-surface: #1B1E24;
    --bg-card: rgba(27, 30, 36, 0.4);
    
    --text-primary: #FCFCFD;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    --accent-blue: #2563EB;
    --accent-blue-light: #60A5FA;
    --accent-blue-glow: rgba(37, 99, 235, 0.3);
    
    --accent-red: #FF0000;
    --accent-red-glow: rgba(255, 0, 0, 0.3);
    
    --accent: var(--accent-blue);
    --accent-glow: var(--accent-blue-glow);
    
    /* Functional Colors */
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --border-color: rgba(255, 255, 255, 0.06);
    
    /* Layout - Compact */
    --sidebar-width: 240px;
    --header-height: 60px;
    --border-radius-lg: 12px;
    --border-radius-md: 8px;
    --border-radius-sm: 4px;
    --touch-target: 40px;
    
    /* Fonts - Smaller base */
    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
    --font-tech: 'Space Grotesk', 'Roboto Mono', monospace;
    
    /* Transitions */
    --transition-standard: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="red"] {
    --bg-primary: #000000;
    --bg-secondary: #080000;
    --bg-surface: #100000;
    --bg-card: rgba(16, 0, 0, 0.6);
    --text-primary: #FF2222;
    --text-secondary: #BB0000;
    --text-muted: #770000;
    --accent: #FF0000;
    --accent-glow: var(--accent-red-glow);
    --border-color: rgba(255, 0, 0, 0.15);
}

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

html { font-size: 14px; } /* Global reduction in size */

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-ui);
    height: 100vh;
    overflow: hidden;
}

h1, h2, h3, .tech-text {
    font-family: var(--font-tech);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Layout */
.app-container {
    display: grid;
    grid-template-areas: 
        "sidebar header"
        "sidebar main";
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    height: 100vh;
}

.header {
    grid-area: header;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 100;
}

.sidebar {
    grid-area: sidebar;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    gap: 32px;
}

.brand { padding: 0 24px; }
.brand-logo { font-size: 1rem; color: var(--accent); }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    padding: 10px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-standard);
}
.nav-item:hover, .nav-item.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}
.nav-item.active { border-left: 3px solid var(--accent); }

.main-content {
    grid-area: main;
    padding: 32px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Dashboard Information Density */
.dashboard-grid-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
}

.stats-overview-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-family: var(--font-tech);
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Sections */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.investigations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Compact Investigation Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition-standard);
}

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

.card-media {
    height: 140px;
    background: #000;
    position: relative;
    overflow: hidden;
}

.card-content { padding: 16px; }
.card-title { font-size: 1rem; margin-bottom: 4px; }
.card-location { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 12px; }

.card-metadata {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-tech);
    font-size: 0.7rem;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

/* Team Panel */
.team-panel {
    background: var(--bg-card);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    padding: 24px;
}

.team-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.team-member {
    display: flex;
    align-items: center;
    gap: 12px;
}

.member-avatar {
    width: 32px;
    height: 32px;
    background: var(--bg-surface);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--accent);
}

.member-info { display: flex; flex-direction: column; }
.member-name { font-size: 0.85rem; font-weight: 600; }
.member-role { font-size: 0.7rem; color: var(--text-muted); }

/* Storage Sidebar */
.storage-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.storage-card, .processing-card {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
}

.storage-header { display: flex; justify-content: space-between; margin-bottom: 8px; }
.storage-bar {
    height: 6px;
    background: var(--bg-surface);
    border-radius: 3px;
    overflow: hidden;
}
.storage-fill { background: var(--accent); height: 100%; box-shadow: 0 0 8px var(--accent-glow); }

/* Buttons & UI */
.btn {
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-tech);
    font-size: 0.8rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: var(--transition-standard);
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 6px var(--success);
}

/* Red Mode Vignette */
/* Investigations List View */
.investigations-list-full {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

/* Investigation Detail View (Modular & Tactical) */
.investigation-detail-page {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 32px;
    min-height: calc(100vh - 120px);
}

/* Detail Sidebar */
.detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.case-info-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
}

.case-id-badge {
    font-family: var(--font-tech);
    font-size: 0.6rem;
    color: var(--accent);
    letter-spacing: 0.1em;
    margin-bottom: 8px;
    display: block;
}

.case-title-large {
    font-family: var(--font-tech);
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 8px 0;
}

.telemetry-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px;
    margin-top: 16px;
}

.telemetry-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.75rem;
}

.telemetry-label { color: var(--text-muted); font-family: var(--font-tech); }
.telemetry-value { color: var(--text-primary); font-family: var(--font-tech); }

/* Evidence Folders */
.evidence-section {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.folder-group {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.folder-header {
    background: var(--bg-surface);
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.folder-content {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.evidence-thumb-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-standard);
}

.evidence-thumb-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.evidence-thumb-visual {
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    position: relative;
}

.evidence-thumb-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
}

.evidence-thumb-info {
    padding: 10px;
    font-size: 0.65rem;
}

.evidence-name {
    display: block;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.evidence-type-tag {
    font-family: var(--font-tech);
    color: var(--accent);
    font-size: 0.55rem;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

#red-mode-vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 100px rgba(255, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.5s;
    z-index: 9999;
}

/* Review Console Styles */
.view {
    max-width: 1400px; /* Contain the view */
    margin: 0 auto;
    width: 100%;
}

.review-grid-layout {
    display: grid;
    grid-template-columns: 1fr 380px; /* Slightly narrower right col */
    gap: 24px;
    align-items: start;
}

.media-grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    aspect-ratio: 16/9;
}

.media-grid-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: var(--transition-standard);
    height: 100%;
}

.media-grid-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.media-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    transition: var(--transition-standard);
}

.media-grid-item:hover img {
    opacity: 0.9;
}

/* Media Detail Styles */
.media-detail-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}

.media-viewer {
    background: #000;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    width: 100%;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.media-viewer img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Technical Overlay */
.viewer-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: radial-gradient(circle, transparent 70%, rgba(0,0,0,0.3) 100%);
}

.overlay-top, .overlay-bottom {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-tech);
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.5);
    text-shadow: 0 0 4px rgba(0,0,0,0.8);
}

.overlay-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
}
.overlay-crosshair::before { content: ''; position: absolute; height: 100%; width: 1px; background: rgba(255, 255, 255, 0.1); left: 50%; }
.overlay-crosshair::after { content: ''; position: absolute; width: 100%; height: 1px; background: rgba(255, 255, 255, 0.1); top: 50%; }

/* Audit Log */
.audit-log {
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.audit-entry {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.audit-time { font-family: var(--font-tech); color: var(--accent); white-space: nowrap; }

.annotation-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-input {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    padding: 12px;
    font-family: var(--font-ui);
    font-size: 0.9rem;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

.telemetry-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.anomaly-toggles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.anomaly-toggles .btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
