/* cti_dashboard_custom.css */

/* Estilos para los inputs de fecha en el CTI Dashboard */
.cti-date-input {
    background: rgba(10, 5, 2, 0.8) !important; /* Fondo más oscuro */
    border: 1px solid rgba(255, 102, 0, 0.6) !important; /* Borde naranja más pronunciado */
    color: #ffcc00 !important; /* Color texto amarillo */
    border-radius: 6px !important;
    padding: 5px 10px !important;
    font-family: monospace !important;
    font-size: 0.75rem !important;
    outline: none !important;
    transition: box-shadow 0.2s, border-color 0.2s !important;
    color-scheme: dark !important;
}

.cti-date-input:focus {
    box-shadow: 0 0 10px rgba(255, 102, 0, 0.6) !important; /* Mayor glow al enfocar */
    border-color: #ff9933 !important;
}

.cti-date-input::-webkit-calendar-picker-indicator {
    filter: invert(0.8) sepia(1) hue-rotate(0deg) saturate(5) brightness(1.2) !important; /* Naranja más vivo */
    cursor: pointer !important;
    opacity: 0.9 !important;
}

.cti-date-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1 !important;
}

/* ============================================================
   MOBILE RESPONSIVE CTI DASHBOARD
   ============================================================ */

/* ============================================================
   MOBILE-ONLY ELEMENTS - Hidden by default on desktop
   ============================================================ */

/* Mobile bottom tab bar */
.cti-mobile-tabs {
    display: none !important;
}

/* Mobile view containers - hidden by default on desktop */
.cti-mobile-view {
    display: none !important;
}

/* Mobile filter bar overlay */
.cti-mobile-filter-overlay {
    display: none !important;
}

/* Mobile filter toggle button - hidden on desktop */
.cti-mobile-filter-toggle {
    display: none !important;
}

/* Mobile incident count overlay - hidden on desktop */
.cti-mobile-incident-count {
    display: none !important;
}

/* Mobile back button - hidden on desktop */
.cti-mobile-back-btn {
    display: none !important;
}

/* ============================================================
   MOBILE RESPONSIVE - Override for screens <= 768px
   ============================================================ */
@media (max-width: 768px) {
    /* Hide desktop-specific layout elements */
    .cti-left-panel {
        display: none !important;
    }
    .cti-sidebar {
        display: none !important;
    }
    .cti-bottom-status {
        display: none !important;
    }
    .cti-container > div[style*="position: absolute; top: 20px; left: 560px"] {
        display: none !important;
    }
    .cti-legend {
        display: none !important;
    }

    /* Mobile container adjustments */
    .cti-container {
        height: calc(100vh - 56px) !important;
        margin-top: -1.5rem !important;
        position: relative !important;
        overflow: hidden !important;
    }

    /* Globe takes full screen on mobile */
    #globeViz {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 1 !important;
        transform: none !important;
    }

    /* Mobile bottom tab bar */
    .cti-mobile-tabs {
        display: flex !important;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: rgba(8, 4, 1, 0.97);
        border-top: 1px solid rgba(255, 102, 0, 0.4);
        backdrop-filter: blur(16px);
        padding: 4px 0;
        padding-bottom: max(4px, env(safe-area-inset-bottom, 4px));
        justify-content: space-around;
        align-items: center;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.8);
    }

    .cti-mobile-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1px;
        background: transparent;
        border: none;
        color: rgba(255, 255, 255, 0.4);
        font-family: monospace;
        font-size: 0.55rem;
        padding: 4px 8px;
        cursor: pointer;
        transition: all 0.2s;
        position: relative;
        min-width: 60px;
    }

    .cti-mobile-tab i {
        font-size: 1.1rem;
        transition: all 0.2s;
    }

    .cti-mobile-tab.active {
        color: #ff6600;
    }

    .cti-mobile-tab.active i {
        text-shadow: 0 0 8px rgba(255, 102, 0, 0.5);
    }

    .cti-mobile-tab.active::after {
        content: '';
        position: absolute;
        top: -1px;
        left: 25%;
        right: 25%;
        height: 2px;
        background: #ff6600;
        border-radius: 0 0 2px 2px;
        box-shadow: 0 0 6px rgba(255, 102, 0, 0.6);
    }

    .cti-mobile-tab .tab-badge {
        position: absolute;
        top: 0;
        right: 4px;
        background: #dc3545;
        color: white;
        font-size: 0.5rem;
        padding: 1px 4px;
        border-radius: 8px;
        min-width: 14px;
        text-align: center;
        line-height: 1.2;
    }

    /* Mobile view containers */
    .cti-mobile-view {
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 5;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .cti-mobile-view.active {
        display: block;
    }

    /* Mobile Globe view - show globe behind it */
    .cti-mobile-view-globe {
        background: transparent;
        pointer-events: none;
        z-index: 2;
    }
    .cti-mobile-view-globe.active {
        display: block;
    }
    .cti-mobile-view-globe.active ~ #globeViz {
        z-index: 1;
    }

    /* Mobile Stats view */
    .cti-mobile-view-stats {
        background: rgba(10, 5, 2, 0.92);
        backdrop-filter: blur(12px);
        padding: 12px;
        z-index: 20;
    }

    .cti-mobile-view-stats .stats-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding-bottom: 60px;
    }

    .cti-mobile-view-stats .stat-box {
        background: rgba(0,0,0,0.6);
        border: 1px solid rgba(255, 102, 0, 0.3);
        border-radius: 8px;
        padding: 8px;
        backdrop-filter: blur(5px);
    }

    .cti-mobile-view-stats .stat-box h6 {
        color: white;
        font-family: monospace;
        font-size: 0.55rem;
        margin-bottom: 4px;
        text-align: center;
    }

    .cti-mobile-view-stats .stat-box canvas {
        width: 100% !important;
        height: 80px !important;
    }

    .cti-mobile-view-stats .stat-box-full {
        grid-column: 1 / -1;
    }

    .cti-mobile-view-stats .stat-box-full canvas {
        height: 100px !important;
    }

    /* Mobile Threats view */
    .cti-mobile-view-threats {
        background: rgba(10, 5, 2, 0.95);
        backdrop-filter: blur(12px);
        padding: 12px;
        z-index: 20;
    }

    .cti-mobile-view-threats .threats-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
        padding-bottom: 8px;
        border-bottom: 1px solid rgba(255, 102, 0, 0.2);
    }

    .cti-mobile-view-threats .threats-header h3 {
        color: #ff6600;
        font-family: monospace;
        font-size: 0.85rem;
        margin: 0;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .cti-mobile-view-threats .threats-tabs {
        display: flex;
        gap: 4px;
        margin-bottom: 10px;
    }

    .cti-mobile-view-threats .threats-tabs button {
        flex: 1;
        background: rgba(0,0,0,0.4);
        border: 1px solid rgba(255, 102, 0, 0.2);
        color: rgba(255, 255, 255, 0.5);
        font-family: monospace;
        font-size: 0.6rem;
        padding: 6px 4px;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.2s;
    }

    .cti-mobile-view-threats .threats-tabs button.active {
        background: rgba(255, 102, 0, 0.15);
        border-color: #ff6600;
        color: #ff6600;
    }

    .cti-mobile-view-threats .threats-list {
        overflow-y: auto;
        padding-bottom: 60px;
        max-height: calc(100vh - 180px);
    }

    .cti-mobile-view-threats .threats-pagination {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        font-family: monospace;
        font-size: 0.65rem;
    }

    /* Mobile filter bar - collapsible overlay */
    .cti-mobile-filter-toggle {
        position: absolute;
        top: 8px;
        right: 8px;
        z-index: 30;
        background: rgba(8, 4, 1, 0.9);
        border: 1px solid rgba(255, 102, 0, 0.5);
        color: #ff6600;
        border-radius: 8px;
        padding: 6px 10px;
        font-family: monospace;
        font-size: 0.65rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 4px;
        backdrop-filter: blur(8px);
        transition: all 0.2s;
    }

    .cti-mobile-filter-overlay {
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        z-index: 50;
        background: rgba(8, 4, 1, 0.98);
        backdrop-filter: blur(16px);
        padding: 12px;
        border-bottom: 1px solid rgba(255, 102, 0, 0.4);
        max-height: 80vh;
        overflow-y: auto;
    }

    .cti-mobile-filter-overlay.open {
        display: block;
    }

    .cti-mobile-filter-overlay .filter-close {
        position: absolute;
        top: 8px;
        right: 8px;
        background: transparent;
        border: none;
        color: rgba(255, 255, 255, 0.5);
        font-size: 1.2rem;
        cursor: pointer;
    }

    /* Mobile incident count badge on globe */
    .cti-mobile-incident-count {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 15;
        pointer-events: none;
        text-align: center;
    }

    .cti-mobile-incident-count .count-number {
        font-size: 2.5rem;
        font-weight: bold;
        color: #ff6600;
        font-family: monospace;
        text-shadow: 0 0 20px rgba(255, 102, 0, 0.6), 0 0 40px rgba(255, 102, 0, 0.3);
        line-height: 1;
    }

    .cti-mobile-incident-count .count-label {
        font-size: 0.65rem;
        color: rgba(255, 255, 255, 0.6);
        font-family: monospace;
        text-transform: uppercase;
        letter-spacing: 2px;
        margin-top: 4px;
    }

    .cti-mobile-incident-count .count-sub {
        font-size: 0.55rem;
        color: rgba(255, 255, 255, 0.35);
        font-family: monospace;
        margin-top: 2px;
    }

    /* Mobile back button for country selection */
    .cti-mobile-back-btn {
        position: absolute;
        top: 8px;
        left: 8px;
        z-index: 30;
        background: rgba(8, 4, 1, 0.9);
        border: 1px solid rgba(255, 102, 0, 0.5);
        color: #ff6600;
        border-radius: 8px;
        padding: 6px 10px;
        font-family: monospace;
        font-size: 0.65rem;
        cursor: pointer;
        display: none;
        align-items: center;
        gap: 4px;
        backdrop-filter: blur(8px);
    }

    .cti-mobile-back-btn.visible {
        display: flex;
    }
}


