:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.88);
    --border-color: rgba(59, 130, 246, 0.25);
    --border-glow: rgba(6, 182, 212, 0.4);
    --accent-cyan: #06b6d4;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body.dark-theme {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header & Command Bar */
.top-nav {
    background: linear-gradient(180deg, #111827 0%, rgba(17, 24, 39, 0.96) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1000;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.radar-pulse-icon {
    width: 22px;
    height: 22px;
    background: var(--accent-cyan);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 14px var(--accent-cyan);
    animation: radar-ping 2s infinite ease-in-out;
}

@keyframes radar-ping {
    0% { transform: scale(0.9); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 1; filter: drop-shadow(0 0 10px var(--accent-cyan)); }
    100% { transform: scale(0.9); opacity: 0.8; }
}

.brand-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand h1 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #fff;
}

.badge {
    font-size: 0.68rem;
    font-family: var(--font-mono);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-cxx {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
}

.badge-india {
    background: rgba(249, 115, 22, 0.18);
    color: #fb923c;
    border: 1px solid #f97316;
}

.subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Sector Switcher */
.sector-selector-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
}

.sector-label {
    font-size: 0.68rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-weight: 600;
}

.sector-buttons {
    display: flex;
    gap: 0.35rem;
}

.btn-sector {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 0.73rem;
    font-family: var(--font-mono);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
}

.btn-sector .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #64748b;
}

.btn-sector:hover {
    color: #fff;
    background: rgba(59, 130, 246, 0.15);
}

.btn-sector.active {
    background: rgba(6, 182, 212, 0.2);
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.btn-sector.active .dot {
    background: var(--accent-cyan);
    box-shadow: 0 0 6px var(--accent-cyan);
}

/* Action Command Bar */
.action-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #fff;
    border: 1px solid #38bdf8;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.5px;
    padding: 0.45rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.7);
    transform: translateY(-1px);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 8px #4ade80;
    animation: radar-ping 1.5s infinite;
}

.btn-secondary {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--text-main);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 600;
    padding: 0.45rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.btn-secondary:hover, .btn-secondary.active {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #6ee7b7;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
}

.btn-secondary.active .live-indicator {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.live-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748b;
    transition: all 0.2s;
}

.btn-outline {
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.35);
    color: #38bdf8;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 600;
    padding: 0.45rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    background: rgba(14, 165, 233, 0.25);
    border-color: #0ea5e9;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.4);
}

.btn-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 700;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.btn-warning:hover {
    background: rgba(245, 158, 11, 0.3);
    border-color: #f59e0b;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.5);
}

/* Telemetry Ribbon */
.telemetry-bar {
    display: flex;
    gap: 1.2rem;
}

.tele-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.tele-label {
    font-size: 0.64rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
}

.tele-val {
    font-size: 0.86rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.text-cyan { color: var(--accent-cyan); }
.text-green { color: var(--accent-green); }
.text-yellow { color: var(--accent-yellow); }
.text-red { color: var(--accent-red); }

/* Main Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.65fr 1fr;
    gap: 1.25rem;
    padding: 1.25rem;
    flex: 1;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.card-header {
    background: rgba(31, 41, 55, 0.7);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 0.84rem;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sector-subtag {
    font-size: 0.68rem;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.12);
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    font-weight: 500;
}

.layer-toggles {
    display: flex;
    gap: 0.35rem;
}

.btn-sm {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--text-main);
    padding: 0.3rem 0.65rem;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm:hover, .btn-sm.active {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.badge-count {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    font-weight: 700;
}

/* Map Container */
.map-container {
    min-height: 540px;
    position: relative;
}

.radar-map {
    flex: 1;
    width: 100%;
    background: #050811;
    position: relative;
    min-height: 480px;
}

/* Real-Time Rotating Radar Sweep Beam Overlay */
.radar-sweep-beam {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 500px;
    height: 500px;
    margin-top: -250px;
    margin-left: -250px;
    border-radius: 50%;
    border: 1px solid rgba(6, 182, 212, 0.2);
    background: conic-gradient(from 0deg, rgba(6, 182, 212, 0) 0deg, rgba(6, 182, 212, 0.18) 45deg, rgba(6, 182, 212, 0) 50deg);
    pointer-events: none;
    z-index: 400;
    opacity: 0.85;
    animation: radar-sweep 5s infinite linear;
}

@keyframes radar-sweep {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Live Event Ticker */
.live-event-ticker {
    background: rgba(15, 23, 42, 0.92);
    border-top: 1px solid var(--border-color);
    padding: 0.45rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    z-index: 500;
}

.ticker-badge {
    background: rgba(239, 68, 68, 0.25);
    color: #ef4444;
    border: 1px solid #ef4444;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-weight: 700;
    font-size: 0.68rem;
    letter-spacing: 0.5px;
}

.ticker-text {
    color: #94a3b8;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Right Panel */
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.dossier-list {
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 270px;
    overflow-y: auto;
}

.dossier-item {
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-left: 4px solid var(--accent-red);
    border-radius: 6px;
    padding: 0.65rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dossier-item:hover {
    background: rgba(31, 41, 55, 0.85);
    transform: translateX(2px);
}

.dossier-item.medium {
    border-color: rgba(245, 158, 11, 0.4);
    border-left-color: var(--accent-yellow);
}

.dossier-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dossier-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
}

.dossier-sev {
    font-size: 0.68rem;
    font-family: var(--font-mono);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.dossier-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.dossier-grid strong {
    color: var(--text-main);
}

/* Suspect Vessel Cards */
.suspect-item {
    background: rgba(17, 24, 39, 0.7);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-left: 4px solid var(--accent-yellow);
    border-radius: 6px;
    padding: 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.suspect-item:hover {
    background: rgba(31, 41, 55, 0.85);
    transform: translateX(2px);
}

.suspect-item.dark-vessel {
    border-color: rgba(239, 68, 68, 0.6);
    border-left-color: var(--accent-red);
}

.threat-tag {
    font-size: 0.64rem;
    font-family: var(--font-mono);
    padding: 0.12rem 0.4rem;
    border-radius: 3px;
    display: inline-block;
    font-weight: 700;
}

.threat-tag.red {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    border: 1px solid #ef4444;
}

.threat-tag.yellow {
    background: rgba(245, 158, 11, 0.25);
    color: #fde68a;
    border: 1px solid #f59e0b;
}

.threat-tag.green {
    background: rgba(16, 185, 129, 0.25);
    color: #a7f3d0;
    border: 1px solid #10b981;
}

.conf-bar-container {
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.2rem;
}

.conf-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* Interactive Drift Sliders */
.math-body {
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.slider-control {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.slider-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.74rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan);
    cursor: pointer;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.74rem;
    font-family: var(--font-mono);
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.m-label {
    color: var(--text-muted);
}

.m-val {
    color: var(--accent-cyan);
    font-weight: 600;
}

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #0f172a;
    border: 1px solid var(--border-glow);
    border-radius: 10px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    animation: modal-appear 0.25s ease-out;
}

@keyframes modal-appear {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    background: rgba(30, 41, 59, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.85rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 0.92rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
}

.btn-close:hover {
    color: #fff;
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.diagnostics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.diag-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 0.85rem;
}

.diag-title {
    font-size: 0.68rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.diag-val {
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--font-mono);
    margin: 0.25rem 0;
}

.diag-desc {
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.4;
}

.training-curve-section h3 {
    font-size: 0.84rem;
    font-family: var(--font-mono);
    margin-bottom: 0.5rem;
    color: #fff;
}

.diag-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.74rem;
}

.diag-table th {
    background: rgba(15, 23, 42, 0.8);
    padding: 0.4rem 0.6rem;
    text-align: left;
    color: var(--accent-cyan);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.diag-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.modal-footer {
    background: rgba(30, 41, 59, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
}

/* Indian Coast Guard Dossier Styles */
.icg-dossier-box {
    background: #090d16;
    border: 2px solid #f97316;
    border-radius: 8px;
    padding: 1.25rem;
    font-family: var(--font-mono);
    color: #e2e8f0;
}

.icg-header-seal {
    text-align: center;
    border-bottom: 2px solid #f97316;
    padding-bottom: 0.8rem;
    margin-bottom: 1rem;
}

.icg-header-seal h2 {
    font-size: 1.15rem;
    letter-spacing: 1px;
    color: #f97316;
}

.icg-header-seal p {
    font-size: 0.74rem;
    color: #94a3b8;
}

.icg-section {
    margin-bottom: 1rem;
}

.icg-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #38bdf8;
    border-bottom: 1px solid rgba(56, 189, 248, 0.3);
    padding-bottom: 0.2rem;
    margin-bottom: 0.4rem;
}

.icg-data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 1rem;
    font-size: 0.74rem;
}

.icg-alert-box {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid #ef4444;
    border-radius: 6px;
    padding: 0.65rem;
    color: #fca5a5;
    font-size: 0.75rem;
    margin-top: 0.8rem;
}
