/* --- TACTICAL COLOR PALETTE --- */
:root {
    --cad-bg: #0a0b10;
    --cad-panel: #12141d;
    --cad-blue: #008cff;
    --cad-green: #00ff41;
    --cad-red: #ff3131;
    --cad-amber: #ffb100;
    --cad-border: #1e293b;
    --font-main: 'JetBrains Mono', monospace;
    --font-tech: 'Share Tech Mono', monospace;
}

/* --- CORE LAYOUT --- */
html, body {
    height: 100%;
    margin: 0;
    background-color: var(--cad-bg);
    color: var(--cad-green);
    font-family: var(--font-main);
    overflow: hidden;
}

/* --- GLOBAL TEXT VISIBILITY FIXES --- */
/* Overrides Bootstrap's dark grey text to make it readable on black */
.text-muted {
    color: #adb5bd !important; /* Light Grey (Bootstrap Gray-500) */
}

h1, h2, h3, h4, h5, h6 {
    color: #fff; /* Ensure all headers are white by default */
}

/* --- LOCKED SYSTEM HEADER --- */
.cad-header {
    height: 45px;
    background: var(--cad-panel);
    font-family: var(--font-tech);
    font-size: 0.9rem;
    position: sticky; /* Force stay at top */
    top: 0;
    width: 100%;
    z-index: 1040; /* Below Modals */
    box-shadow: 0 2px 15px rgba(0,0,0,0.8);
    border-bottom: 1px solid var(--cad-blue);
}

.stat-box {
    border-left: 1px solid var(--cad-border);
    padding-left: 15px;
    font-size: 0.85rem;
}

/* --- MAIN CONTAINER --- */
main {
    /* 100vh - Header(45px) - Footer(160px) */
    height: calc(100vh - 205px); 
    overflow: hidden;
    position: relative;
    padding-bottom: 0; 
}

/* --- TACTICAL PANELS --- */
.cad-panel-bg {
    background-color: var(--cad-panel);
}

.panel-tag {
    background: var(--cad-border);
    color: var(--cad-blue);
    font-size: 0.7rem;
    padding: 2px 10px;
    font-weight: bold;
    letter-spacing: 2px;
    border-bottom: 1px solid var(--cad-blue);
}

/* --- THE MAP --- */
#map {
    height: 100%;
    width: 100%;
    background: #111;
}

.map-overlay-bottom {
    position: absolute;
    bottom: 10px; 
    left: 0;
    right: 0;
    background: rgba(10, 11, 16, 0.9);
    color: var(--cad-blue);
    font-size: 0.65rem;
    padding: 4px 10px;
    z-index: 1000;
    border-top: 1px solid var(--cad-blue);
    pointer-events: none;
}

/* --- RADIO LOG FOOTER (Fixed Bottom) --- */
#radio-log-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 160px;
    background: var(--cad-panel);
    border-top: 2px solid var(--cad-border);
    z-index: 1020; /* Above Map, Below Modals */
    display: flex;
    flex-direction: column;
}

.radio-header {
    background: #000;
    padding: 2px 10px;
    border-bottom: 1px solid var(--cad-border);
    font-family: var(--font-tech);
    font-size: 0.75rem;
    color: #adb5bd; /* Lighter text */
    letter-spacing: 1px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.radio-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 5px 15px;
    font-family: var(--font-main);
    font-size: 0.8rem;
    color: #eee;
    display: flex;
    flex-direction: column-reverse; 
}

/* --- CUSTOM LEAFLET POPUP THEME (VISIBILITY FIX) --- */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: rgba(12, 15, 20, 0.98) !important; 
    border: 1px solid var(--cad-blue); 
    border-radius: 0;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.8);
}

.leaflet-popup-content {
    margin: 10px;
    line-height: 1.4;
    min-width: 200px !important;
    color: #e0e0e0 !important; 
    font-family: var(--font-main);
}

/* Force popup text white */
.leaflet-popup-content h6,
.leaflet-popup-content strong,
.leaflet-popup-content span,
.leaflet-popup-content div {
    color: #ffffff !important;
}

.leaflet-popup-content .text-muted {
    color: #cccccc !important; /* Very light grey for popup details */
}

.leaflet-popup-content button {
    border-radius: 2px;
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s;
    font-family: var(--font-tech);
    margin-top: 5px;
}

.leaflet-popup-content button:hover {
    box-shadow: 0 0 8px currentColor;
}

.leaflet-popup-close-button {
    color: var(--cad-red) !important;
    font-size: 18px !important;
    padding: 4px !important;
}

/* --- PLAYER PROFILE OVERLAY (VISIBILITY FIX) --- */
#profile-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5, 6, 8, 0.95);
    backdrop-filter: blur(5px);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#profile-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.profile-container {
    width: 800px;
    max-width: 90%;
    background: var(--cad-panel);
    border: 1px solid var(--cad-blue);
    box-shadow: 0 0 50px rgba(0, 140, 255, 0.1);
}

.profile-header {
    background: rgba(0, 140, 255, 0.1);
    padding: 15px 25px;
    border-bottom: 1px solid var(--cad-blue);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile-header h2 {
    font-family: var(--font-tech);
    font-size: 1.2rem;
    margin: 0;
    letter-spacing: 2px;
    color: #fff;
}

.btn-close-custom {
    background: none;
    border: 1px solid var(--cad-red);
    color: var(--cad-red);
    font-family: var(--font-tech);
    padding: 5px 15px;
    cursor: pointer;
    transition: 0.2s;
}
.btn-close-custom:hover { background: var(--cad-red); color: #000; }

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 20px;
    padding: 30px;
}

.profile-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--cad-border);
    padding: 20px;
}

/* SPECIFIC FIX for Profile Text */
.profile-card p, 
.profile-card .small {
    color: #adb5bd !important; /* Force readable grey */
}

.rank-badge-lg {
    font-size: 4rem;
    color: var(--cad-green);
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(0, 255, 65, 0.3);
}

.section-title {
    color: #adb5bd; /* Readable grey */
    font-size: 0.7rem;
    letter-spacing: 2px;
    border-bottom: 1px solid var(--cad-border);
    padding-bottom: 5px;
    margin-bottom: 15px;
    display: block;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-box {
    /* For top nav & profile */
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--cad-border);
    padding: 8px 12px;
}

.stat-label { font-size: 0.6rem; color: #888; letter-spacing: 1px; }
.stat-value { font-size: 1.1rem; font-family: var(--font-tech); color: #fff; }

/* --- COMMAND RIBBON BUTTONS --- */
.btn-cmd {
    width: 100%;
    aspect-ratio: 1/1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    border-radius: 0;
    font-family: var(--font-tech);
    padding: 5px;
    border: 1px solid rgba(0, 140, 255, 0.3);
    background: rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
    color: #fff;
}

.btn-cmd i {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.btn-cmd:hover {
    background: rgba(0, 140, 255, 0.15);
    border-color: var(--cad-blue);
    transform: scale(1.02);
}

/* --- MODALS --- */
.modal-content {
    background-color: var(--cad-panel) !important;
    border-radius: 0;
    border: 1px solid var(--cad-blue);
    box-shadow: 0 0 30px rgba(0, 0, 0, 1);
    color: #fff;
}

.cad-input {
    background-color: #000 !important;
    border: 1px solid var(--cad-border) !important;
    color: var(--cad-green) !important;
    border-radius: 0;
}

.cad-table {
    color: #cbd5e0;
    border-color: var(--cad-border);
}

.cad-table thead {
    color: var(--cad-blue);
    font-family: var(--font-tech);
}

/* --- MISSION STRIPS --- */
.mission-card {
    background: #1a1d26;
    border: 1px solid #2d3748;
    border-left: 4px solid var(--cad-red);
    margin-bottom: 8px;
    padding: 10px;
    transition: all 0.2s ease;
}

.mission-card:hover {
    background: #242936;
    border-color: var(--cad-blue);
    cursor: pointer;
}

.mission-card h6 {
    color: #fff;
    font-family: var(--font-tech);
    letter-spacing: 1px;
}

/* --- ANIMATIONS --- */
.pulse {
    animation: textPulse 2s infinite;
}

@keyframes textPulse {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

.scrollbar-thin::-webkit-scrollbar {
    width: 5px;
}
.scrollbar-thin::-webkit-scrollbar-track {
    background: var(--cad-bg);
}
.scrollbar-thin::-webkit-scrollbar-thumb {
    background: var(--cad-border);
}
.scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: var(--cad-blue);
}