:root {
    --primary: #BB86FC;
    --secondary: #03DAC6;
    --bg: #050505;
    --surface: #111111;
    --card: #1A1A1A;
    --text: #F8F9FA;
    --text-dim: #94A3B8;
    --danger: #CF6679;
    --success: #00E676;
    --warning: #FF9800;
    --border: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    font-family: 'Plus Jakarta Sans', sans-serif; 
    background: var(--bg); 
    color: var(--text); 
    display: flex; 
    height: 100vh; 
    width: 100vw; 
    overflow: hidden; 
}

#admin-content { display: flex; width: 100%; height: 100%; }

/* NAVEGACIÓN */
nav { width: 260px; background: var(--surface); padding: 25px 15px; display: flex; flex-direction: column; border-right: 1px solid var(--border); flex-shrink: 0; overflow-y: auto; }
.logo-area { font-size: 22px; font-weight: 800; color: var(--primary); margin-bottom: 30px; text-align: center; letter-spacing: 1px; }
.nav-item { padding: 14px 18px; border-radius: 12px; color: var(--text-dim); text-decoration: none; display: flex; align-items: center; gap: 12px; margin-bottom: 6px; transition: 0.2s; cursor: pointer; font-size: 13px; font-weight: 600; }
.nav-item:hover, .nav-item.active { background: rgba(187, 134, 252, 0.12); color: var(--primary); }

/* ÁREA PRINCIPAL */
main { flex: 1; height: 100vh; overflow-y: auto; background: #080808; padding: 30px; }
.header-box { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; background: var(--surface); padding: 20px 30px; border-radius: 20px; border: 1px solid var(--border); }
.content-section { display: none; width: 100%; }
.content-section.active { display: block; }

/* ESTADÍSTICAS */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: var(--card); padding: 25px; border-radius: 20px; border: 1px solid var(--border); text-align: center; }
.stat-card h3 { font-size: 11px; color: var(--text-dim); text-transform: uppercase; margin-bottom: 10px; font-weight: 800; }
.stat-card p { font-size: 28px; font-weight: 800; color: #fff; }

/* COMPONENTES DE FORMULARIO */
.input-group { margin-bottom: 15px; display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: 10px; font-weight: 800; color: var(--text-dim); text-transform: uppercase; }
.admin-input { background: #000; border: 1px solid #333; color: white; padding: 12px; border-radius: 10px; font-family: inherit; font-size: 14px; }
.admin-input:focus { border-color: var(--primary); outline: none; }

/* MAPAS */
.map-wrapper { width: 100%; height: 500px; border-radius: 30px; border: 1px solid var(--border); background: #111; margin-bottom: 30px; overflow: hidden; }

/* TABLAS */
.card-container { background: var(--card); border-radius: 25px; border: 1px solid var(--border); padding: 30px; margin-bottom: 30px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 15px; font-size: 11px; color: var(--primary); text-transform: uppercase; border-bottom: 1px solid var(--border); }
td { padding: 15px; font-size: 14px; border-bottom: 1px solid rgba(255,255,255,0.02); }

.btn-action { padding: 10px 16px; border-radius: 10px; border: none; font-weight: 800; cursor: pointer; transition: 0.2s; }
.btn-action:active { transform: scale(0.95); }
.btn-primary { background: var(--primary); color: #000; }
.btn-success { background: var(--success); color: #000; }
.btn-danger { background: var(--danger); color: #fff; }

/* MODALES */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.95); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.modal-card { background: var(--card); width: 95%; max-width: 900px; max-height: 90vh; border-radius: 24px; border: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.modal-header { padding: 20px 30px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.btn-close { background: transparent; border: none; color: #fff; font-size: 32px; cursor: pointer; }

/* ANIMACIONES */
@keyframes pulse { 0% { transform: scale(0.9); opacity: 0.7; } 50% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(0.9); opacity: 0.7; } }
.alert-pulse { animation: pulse 1s infinite alternate; background: rgba(207, 102, 121, 0.2) !important; border: 1px solid var(--danger) !important; }

/* CENTRO GLOBAL */
.command-center {
    --command-blue: #40a9ff;
    --command-cyan: #35dfcf;
    --command-text: #eaf4ff;
    --command-muted: #829bb4;
    padding: 2px;
    color: var(--command-text);
}
.command-topbar, .command-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.command-topbar { margin-bottom: 18px; }
.command-topbar h2 { margin-top: 5px; color: var(--command-text); font-size: 21px; }
.command-eyebrow { color: #7995b2; font-size: 9px; font-weight: 800; letter-spacing: 1.5px; }
.command-clock { display: grid; justify-items: end; gap: 3px; }
.command-clock span { color: var(--command-cyan); font-size: 9px; font-weight: 800; letter-spacing: 1px; }
.command-clock span i { margin-right: 4px; }
.command-clock strong { color: var(--command-text); font-size: 19px; font-variant-numeric: tabular-nums; }
.command-clock small { color: var(--command-muted); font-size: 10px; }
.command-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; margin-bottom: 13px; }
.command-kpi, .command-panel { min-width: 0; border: 1px solid rgba(76, 137, 192, .2); border-radius: 11px; background: linear-gradient(145deg, #101f32, #0a1422); }
.command-kpi { min-height: 87px; display: flex; flex-direction: column; justify-content: space-between; padding: 14px; }
.command-kpi > span { overflow: hidden; color: #8da7c0; font-size: 9px; font-weight: 800; letter-spacing: .65px; text-overflow: ellipsis; white-space: nowrap; }
.command-kpi > span i { margin-right: 6px; color: var(--command-blue); }
.command-kpi strong { color: var(--command-text); font-size: clamp(17px, 1.9vw, 24px); font-variant-numeric: tabular-nums; }
.command-kpi-live > span i { color: var(--command-cyan); }
.command-main-grid { display: grid; grid-template-columns: minmax(175px, .82fr) minmax(360px, 2.3fr) minmax(190px, .9fr); gap: 12px; align-items: stretch; }
.command-panel { padding: 14px; }
.command-panel-heading { min-height: 32px; margin-bottom: 12px; }
.command-panel-heading h3 { margin-top: 4px; color: var(--command-text); font-size: 13px; font-weight: 700; }
.command-panel-heading > i { color: var(--command-blue); }
.command-map-legend { display: inline-flex; align-items: center; gap: 5px; color: #9bb1c7; font-size: 9px; white-space: nowrap; }
.command-driver-dot, .command-request-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; }
.command-driver-dot { margin-left: 5px; background: #33dfb1; box-shadow: 0 0 7px #33dfb1; }
.command-request-dot { margin-left: 4px; background: #ff5269; box-shadow: 0 0 7px #ff5269; }
.command-map { width: 100%; height: 380px; overflow: hidden; border: 1px solid rgba(68, 132, 189, .2); border-radius: 8px; background: #06101c; }
#global-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.65) saturate(.45); }
#global-map .leaflet-control-attribution { background: rgba(5, 13, 23, .82); color: #8fa8c0; }
#global-map .leaflet-control-attribution a { color: #68baff; }
#global-map .leaflet-bar a { color: #cce6ff; background: #102035; border-color: #25435f; }
.command-count-badge { min-width: 25px; padding: 5px 8px; border: 1px solid rgba(255, 82, 105, .25); border-radius: 20px; background: rgba(255, 82, 105, .1); color: #ff8091; font-size: 10px; font-weight: 800; text-align: center; }
.command-bar-list { display: grid; gap: 14px; }
.command-bar-row { min-width: 0; }
.command-bar-label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; color: #b5c6d8; font-size: 10px; }
.command-bar-label strong { color: var(--command-text); font-variant-numeric: tabular-nums; }
.command-bar-track { height: 5px; overflow: hidden; border-radius: 8px; background: #182a3c; }
.command-bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2876dc, #37d8d1); }
.command-empty { padding: 20px 8px; color: var(--command-muted); font-size: 11px; line-height: 1.5; text-align: center; }
.command-request-list { display: grid; gap: 8px; max-height: 340px; overflow-y: auto; }
.command-request { padding: 10px; border: 1px solid rgba(255, 82, 105, .15); border-left: 2px solid #ff5269; border-radius: 7px; background: rgba(255, 82, 105, .045); }
.command-request strong, .command-request span, .command-request small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-request strong { color: #e8f1fa; font-size: 10px; }
.command-request span { margin-top: 5px; color: #9eb3c8; font-size: 9px; }
.command-request small { margin-top: 5px; color: #ff8292; font-size: 8px; }
.command-bottom-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.command-distribution { display: flex; align-items: center; justify-content: center; gap: 25px; min-height: 125px; }
.command-donut { width: 112px; height: 112px; flex: 0 0 112px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; background: conic-gradient(#38a9ff 0deg 90deg, #35dfcf 90deg 180deg, #ffb547 180deg 270deg, #876bff 270deg 360deg); position: relative; }
.command-donut::before { width: 76px; height: 76px; position: absolute; border-radius: 50%; background: #0c1929; content: ""; }
.command-donut span { z-index: 1; color: var(--command-text); font-size: 18px; font-weight: 800; }
.command-status-legend { display: grid; gap: 9px; }
.command-legend-item { display: flex; align-items: center; gap: 7px; color: #a9bdd1; font-size: 10px; }
.command-legend-swatch { width: 7px; height: 7px; border-radius: 50%; }
.command-legend-item strong { margin-left: 4px; color: var(--command-text); }

@media (max-width: 1100px) {
    .command-main-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
    .command-requests-panel { grid-column: 1 / -1; }
    .command-request-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none; }
}

/* RESPONSIVE MOBILE MENU (LUPITA / TOGGLE) */
@media (max-width: 768px) {
    nav {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        height: 100vh;
        z-index: 10000;
        transition: transform 0.3s ease;
        background: var(--surface);
        box-shadow: 10px 0 30px rgba(0,0,0,0.9);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 120px;
    }
    nav.open {
        transform: translateX(300px);
    }
    .btn-close-nav {
        display: block !important;
    }
    main {
        padding: 15px;
        width: 100%;
    }
    .header-box {
        padding: 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .header-box > div {
        width: 100%;
        justify-content: space-between;
    }
    #global-country-selector {
        width: 100% !important;
    }
    .command-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .command-main-grid { grid-template-columns: 1fr; }
    .command-map-panel { grid-row: 1; }
    .command-requests-panel { grid-column: auto; }
    .command-request-list { grid-template-columns: 1fr; max-height: 340px; }
    .command-map { height: 340px; }
    .command-bar-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
    .command-topbar { align-items: flex-start; }
    .command-topbar h2 { font-size: 17px; }
    .command-clock strong { font-size: 16px; }
    .command-kpi { min-height: 76px; padding: 11px; }
    .command-kpi > span { font-size: 8px; }
    .command-bottom-grid { grid-template-columns: 1fr; }
    .command-distribution { gap: 16px; }
    .command-bar-list { grid-template-columns: 1fr; }
    .command-map-legend { font-size: 8px; }
}
