/**
 * Coatequitl — Tactical Map Skin
 * Homologa las vistas de mapas (Leaflet / MapLibre) al estilo del
 * visor 3D de com_analisis3d (tactical-hud.css).
 *
 * Variables y patrones visuales identicos:
 *   --hud-cyan:        #00f3ff
 *   --hud-bg-dark:     rgba(10, 20, 30, 0.9)
 *   --hud-border-cyan: rgba(0, 243, 255, 0.4)
 *
 * @version    1.0.0 — 2026-09-01
 * @author     Lic. Joel Salazar Ramírez <joel@edugame.digital>
 * @copyright  (C) 2026 Edugame Digital
 */

:root {
    --hud-cyan: #00f3ff;
    --hud-bg-dark: rgba(10, 20, 30, 0.9);
    --hud-border-cyan: rgba(0, 243, 255, 0.4);
    --hud-mono: 'Courier New', Courier, monospace;
}

/* ═══════════════════════════════════════════════════════════════
   Wrapper — full-bleed, black bg, monospace, cyan accents
   ═══════════════════════════════════════════════════════════════ */
.ctq-tactical-map-wrapper {
    position: relative;
    width: 100vw;
    max-width: none;
    height: min(92vh, 1080px);
    min-height: 600px;
    overflow: hidden;
    background-color: #000;
    font-family: var(--hud-mono);
    color: #fff;
    border-radius: 6px;
    margin: 0 calc(50% - 50vw);
    padding: 0;
    isolation: isolate;
}

.ctq-tactical-map-wrapper *,
.ctq-tactical-map-wrapper *::before,
.ctq-tactical-map-wrapper *::after {
    box-sizing: border-box;
}

/* El mapa ocupa todo el wrapper */
.ctq-tactical-map-wrapper .ctq-map-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

/* ═══════════════════════════════════════════════════════════════
   Header bar — barra superior cyan con blur
   ═══════════════════════════════════════════════════════════════ */
.ctq-tactical-header {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--hud-bg-dark);
    border: 1px solid var(--hud-border-cyan);
    border-radius: 4px;
    color: var(--hud-cyan);
    backdrop-filter: blur(8px);
    font-family: var(--hud-mono);
}

.ctq-tactical-header h1,
.ctq-tactical-header h2,
.ctq-tactical-header .h5 {
    margin: 0;
    color: var(--hud-cyan) !important;
    text-shadow: 0 0 6px rgba(0, 243, 255, 0.5);
    font-family: var(--hud-mono);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ctq-tactical-header .badge {
    background: var(--hud-cyan) !important;
    color: #000 !important;
    font-family: var(--hud-mono);
    font-weight: 700;
    font-size: 0.7rem;
}

.ctq-tactical-header .pulse-active {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: var(--hud-cyan);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--hud-cyan);
    animation: ctqPulseGlow 1.5s infinite alternate;
}

@keyframes ctqPulseGlow {
    from { opacity: 0.4; }
    to   { opacity: 1.0; }
}

/* Botones en header */
.ctq-tactical-header .btn,
.ctq-tactical-header .ctq-tactical-btn {
    background: transparent !important;
    border: 1px solid var(--hud-border-cyan) !important;
    color: var(--hud-cyan) !important;
    font-family: var(--hud-mono);
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.ctq-tactical-header .btn:hover,
.ctq-tactical-header .ctq-tactical-btn:hover,
.ctq-tactical-header .btn.active,
.ctq-tactical-header .ctq-tactical-btn.active {
    background-color: var(--hud-cyan) !important;
    color: #000 !important;
}

/* ═══════════════════════════════════════════════════════════════
   Side panel — panel lateral derecho con blur
   ═══════════════════════════════════════════════════════════════ */
.ctq-tactical-side-panel {
    position: absolute;
    top: 70px;
    right: 10px;
    width: 280px;
    max-height: calc(100% - 90px);
    z-index: 100;
    background: var(--hud-bg-dark);
    border: 1px solid var(--hud-border-cyan);
    border-radius: 4px;
    color: #fff !important;
    backdrop-filter: blur(8px);
    font-family: var(--hud-mono);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--hud-border-cyan) transparent;
}

.ctq-tactical-side-panel::-webkit-scrollbar {
    width: 4px;
}
.ctq-tactical-side-panel::-webkit-scrollbar-thumb {
    background: var(--hud-border-cyan);
    border-radius: 2px;
}

.ctq-tactical-side-panel h2,
.ctq-tactical-side-panel h6,
.ctq-tactical-side-panel .h6 {
    color: var(--hud-cyan) !important;
    border-color: var(--hud-border-cyan) !important;
    font-family: var(--hud-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ctq-tactical-side-panel .ctq-panel-section {
    border-bottom: 1px solid rgba(0, 243, 255, 0.15);
    padding: 10px 14px;
}

.ctq-tactical-side-panel .ctq-panel-section:last-child {
    border-bottom: none;
}

.ctq-tactical-side-panel .form-check-label,
.ctq-tactical-side-panel label {
    color: #e0e0e0 !important;
    font-family: var(--hud-mono);
    font-size: 0.75rem;
}

/* ═══════════════════════════════════════════════════════════════
   Loading overlay
   ═══════════════════════════════════════════════════════════════ */
.ctq-tactical-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    z-index: 500;
    flex-direction: column;
    gap: 16px;
    color: var(--hud-cyan);
    font-family: var(--hud-mono);
    font-size: 0.85rem;
}

.ctq-tactical-loading .spinner-border {
    color: var(--hud-cyan);
    width: 2.5rem;
    height: 2.5rem;
}

/* ═══════════════════════════════════════════════════════════════
   Severity legend (compact, tactical style)
   ═══════════════════════════════════════════════════════════════ */
.ctq-tactical-legend {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 100;
    background: var(--hud-bg-dark);
    border: 1px solid var(--hud-border-cyan);
    border-radius: 4px;
    backdrop-filter: blur(8px);
    padding: 8px 12px;
    font-family: var(--hud-mono);
    font-size: 0.7rem;
    color: #e0e0e0;
}

.ctq-tactical-legend .ctq-legend-title {
    color: var(--hud-cyan);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    font-size: 0.65rem;
}

.ctq-tactical-legend .ctq-legend-row {
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.6;
}

.ctq-tactical-legend .ctq-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   Leaflet overrides — dark theme + cyan accents
   ═══════════════════════════════════════════════════════════════ */
.ctq-tactical-map-wrapper .leaflet-container {
    background: #000 !important;
    font-family: var(--hud-mono) !important;
}

.ctq-tactical-map-wrapper .leaflet-control-zoom {
    border: 1px solid var(--hud-border-cyan) !important;
    background: var(--hud-bg-dark) !important;
    backdrop-filter: blur(8px);
    border-radius: 4px !important;
    overflow: hidden;
}

.ctq-tactical-map-wrapper .leaflet-control-zoom a {
    background: transparent !important;
    color: var(--hud-cyan) !important;
    border-bottom: 1px solid rgba(0, 243, 255, 0.15) !important;
    font-family: var(--hud-mono) !important;
}

.ctq-tactical-map-wrapper .leaflet-control-zoom a:hover {
    background: rgba(0, 243, 255, 0.15) !important;
    color: #fff !important;
}

.ctq-tactical-map-wrapper .leaflet-control-zoom a:last-child {
    border-bottom: none !important;
}

/* Attribution */
.ctq-tactical-map-wrapper .leaflet-control-attribution {
    background: rgba(10, 20, 30, 0.7) !important;
    color: rgba(207, 216, 220, 0.6) !important;
    font-size: 9px !important;
    font-family: var(--hud-mono) !important;
    border: 1px solid rgba(0, 243, 255, 0.15) !important;
    border-radius: 3px !important;
}

.ctq-tactical-map-wrapper .leaflet-control-attribution a {
    color: var(--hud-cyan) !important;
}

/* Popups */
.ctq-tactical-map-wrapper .leaflet-popup-content-wrapper {
    background: var(--hud-bg-dark) !important;
    color: #fff !important;
    border: 1px solid var(--hud-border-cyan) !important;
    border-radius: 4px !important;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6) !important;
    font-family: var(--hud-mono) !important;
}

.ctq-tactical-map-wrapper .leaflet-popup-content {
    margin: 10px 14px !important;
    font-size: 0.8rem !important;
    line-height: 1.5 !important;
}

.ctq-tactical-map-wrapper .leaflet-popup-content strong {
    color: var(--hud-cyan) !important;
}

.ctq-tactical-map-wrapper .leaflet-popup-tip {
    background: var(--hud-bg-dark) !important;
    border: 1px solid var(--hud-border-cyan) !important;
}

.ctq-tactical-map-wrapper .leaflet-popup-close-button {
    color: rgba(0, 243, 255, 0.6) !important;
    font-size: 1.1rem !important;
    padding: 4px 8px !important;
}

.ctq-tactical-map-wrapper .leaflet-popup-close-button:hover {
    color: var(--hud-cyan) !important;
    background: rgba(0, 243, 255, 0.1) !important;
}

/* Layer control (if used) */
.ctq-tactical-map-wrapper .leaflet-control-layers {
    background: var(--hud-bg-dark) !important;
    color: #fff !important;
    border: 1px solid var(--hud-border-cyan) !important;
    border-radius: 4px !important;
    backdrop-filter: blur(8px);
    font-family: var(--hud-mono) !important;
    font-size: 0.75rem !important;
}

.ctq-tactical-map-wrapper .leaflet-control-layers label {
    color: #e0e0e0 !important;
}

/* Scale control */
.ctq-tactical-map-wrapper .leaflet-control-scale-line {
    background: rgba(10, 20, 30, 0.7) !important;
    color: var(--hud-cyan) !important;
    border-color: var(--hud-border-cyan) !important;
    font-family: var(--hud-mono) !important;
    font-size: 9px !important;
}

/* ═══════════════════════════════════════════════════════════════
   Card / list items inside tactical wrapper
   ═══════════════════════════════════════════════════════════════ */
.ctq-tactical-map-wrapper .ctq-tactical-item {
    background: rgba(0, 243, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.1);
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: var(--hud-mono);
    font-size: 0.75rem;
    color: #e0e0e0;
}

.ctq-tactical-map-wrapper .ctq-tactical-item:hover {
    background: rgba(0, 243, 255, 0.12);
    border-color: var(--hud-border-cyan);
}

.ctq-tactical-map-wrapper .ctq-tactical-item .ctq-item-title {
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    margin-bottom: 2px;
}

.ctq-tactical-map-wrapper .ctq-tactical-item .ctq-item-meta {
    color: rgba(0, 243, 255, 0.7);
    font-size: 0.65rem;
}

.ctq-tactical-map-wrapper .ctq-severity-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   Form controls inside tactical wrapper
   ═══════════════════════════════════════════════════════════════ */
.ctq-tactical-map-wrapper .form-control,
.ctq-tactical-map-wrapper .form-select {
    background: rgba(0, 0, 0, 0.5) !important;
    border-color: var(--hud-border-cyan) !important;
    color: #fff !important;
    font-family: var(--hud-mono) !important;
    font-size: 0.75rem;
}

.ctq-tactical-map-wrapper .form-control:focus,
.ctq-tactical-map-wrapper .form-select:focus {
    box-shadow: 0 0 4px rgba(0, 243, 255, 0.3) !important;
    border-color: var(--hud-cyan) !important;
}

.ctq-tactical-map-wrapper .form-control::placeholder {
    color: rgba(0, 243, 255, 0.4);
}

/* ═══════════════════════════════════════════════════════════════
   Footer bar — contador y acciones
   ═══════════════════════════════════════════════════════════════ */
.ctq-tactical-footer {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 14px;
    background: var(--hud-bg-dark);
    border: 1px solid var(--hud-border-cyan);
    border-radius: 4px;
    backdrop-filter: blur(8px);
    font-family: var(--hud-mono);
    font-size: 0.7rem;
    color: rgba(0, 243, 255, 0.8);
}

.ctq-tactical-footer .btn {
    background: transparent !important;
    border: 1px solid var(--hud-border-cyan) !important;
    color: var(--hud-cyan) !important;
    font-family: var(--hud-mono);
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 3px;
}

.ctq-tactical-footer .btn:hover {
    background: rgba(0, 243, 255, 0.15) !important;
}

/* ═══════════════════════════════════════════════════════════════
   Focus visibility + reduced motion
   ═══════════════════════════════════════════════════════════════ */
.ctq-tactical-map-wrapper :focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@media (max-width: 760px) {
    .ctq-tactical-map-wrapper {
        width: 100%;
        min-height: 700px;
        height: 88vh;
        margin: 0;
        border-radius: 0;
    }
    .ctq-tactical-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .ctq-tactical-side-panel {
        top: auto;
        bottom: 10px;
        right: 10px;
        left: 10px;
        width: auto;
        max-height: 40%;
    }
    .ctq-tactical-legend {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ctq-tactical-map-wrapper *,
    .ctq-tactical-map-wrapper *::before,
    .ctq-tactical-map-wrapper *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* 7.2.6: los dropdowns del menu del template quedaban debajo de esta vista — Cassiopeia da
   al header z-index:10 (template.css:13699) y los contenedores apilados aqui lo superaban.
   El contexto del header por encima de todo el contenido restaura los dropdowns. */
.container-header { z-index: 10000; }
