/* ==========================================================
   SoftIARun - Tema Verde Esmeralda Elegante & Blanco Puro
   ========================================================== */

:root {
    --bg-primary: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f1f5f9;
    --bg-surface-glass: rgba(255, 255, 255, 0.92);
    --border-color: #e2e8f0;
    --border-accent: #cbd5e1;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --accent-green: #059669;
    --accent-emerald: #10b981;
    --accent-emerald-light: #ecfdf5;
    --accent-emerald-dark: #064e3b;
    --accent-lime: #84cc16;
    --accent-amber: #d97706;
    --accent-rose: #e11d48;
    
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* Tarjetas y Superficies Blancas Elegantes */
.card-softia {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 1.15rem;
    box-shadow: 0 10px 25px -5px rgba(5, 150, 105, 0.07), 0 4px 10px -2px rgba(0, 0, 0, 0.03);
    transition: all 0.25s ease;
}

.card-softia-elevated {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 0.95rem;
}

/* Header & Barra de Navegación */
.navbar-softia {
    background: var(--bg-surface-glass);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
    padding: 0.85rem 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.brand-badge {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #ffffff;
    padding: 0.4rem 0.8rem;
    border-radius: 0.65rem;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

/* Tablero Métrico */
.metric-box {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 0.85rem 0.75rem;
    text-align: center;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(5, 150, 105, 0.08);
}

.metric-box .metric-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.metric-box .metric-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.metric-box .metric-unit {
    font-size: 0.75rem;
    color: var(--accent-green);
    font-weight: 600;
    margin-left: 2px;
}

/* Contador de 90s */
.countdown-container {
    background: #ffffff;
    border: 1px solid #d1fae5;
    border-radius: 1.15rem;
    padding: 1.15rem 1rem;
    position: relative;
    box-shadow: 0 8px 24px -4px rgba(16, 185, 129, 0.12);
}

.countdown-number {
    font-size: 2.8rem;
    font-weight: 900;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-green);
    line-height: 1;
    letter-spacing: -1px;
}

.progress-bar-custom {
    height: 8px;
    background-color: #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 0.75rem;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #059669, #34d399);
    transition: width 1s linear;
}

/* Indicador de Pulso y Estado */
.pulse-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.pulse-indicator.active {
    background-color: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
    animation: pulseGlow 1.5s infinite;
}

.pulse-indicator.paused {
    background-color: var(--accent-amber);
    box-shadow: 0 0 8px var(--accent-amber);
}

.pulse-indicator.error {
    background-color: var(--accent-rose);
    box-shadow: 0 0 8px var(--accent-rose);
}

@keyframes pulseGlow {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.25); opacity: 1; filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.8)); }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* Mapa Leaflet */
#map {
    height: 380px;
    width: 100%;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    background-color: #f1f5f9;
    z-index: 1;
}

@media (min-height: 800px) {
    #map {
        height: 440px;
    }
}

/* Custom Marker Leaflet Verde Esmeralda */
.leaflet-pulse-marker {
    background: #059669;
    border: 3px solid #ffffff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    box-shadow: 0 0 16px rgba(5, 150, 105, 0.8), 0 2px 6px rgba(0,0,0,0.3);
    position: relative;
}

.leaflet-pulse-ring {
    position: absolute;
    width: 44px;
    height: 44px;
    border: 3px solid #10b981;
    border-radius: 50%;
    top: -14px;
    left: -14px;
    animation: markerRing 2s infinite ease-out;
}

@keyframes markerRing {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* Banner de Alerta de Inmovilidad */
.alert-inmovil {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #9f1239;
    border-radius: 0.85rem;
    padding: 0.85rem 1rem;
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.1);
    animation: alertBounce 1s infinite alternate ease-in-out;
}

@keyframes alertBounce {
    0% { transform: translateY(0); box-shadow: 0 2px 8px rgba(225, 29, 72, 0.15); }
    100% { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(225, 29, 72, 0.25); }
}

/* Botones con Verde Esmeralda y Blancos */
.btn-softia-primary {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border: none;
    color: #ffffff !important;
    font-weight: 700;
    padding: 0.75rem 1.25rem;
    border-radius: 0.85rem;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
    transition: all 0.2s ease;
}

.btn-softia-primary:hover, .btn-softia-primary:focus {
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(5, 150, 105, 0.45);
}

.btn-softia-danger {
    background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
    border: none;
    color: #ffffff !important;
    font-weight: 700;
    padding: 0.75rem 1.25rem;
    border-radius: 0.85rem;
    box-shadow: 0 4px 14px rgba(225, 29, 72, 0.3);
    transition: all 0.2s ease;
}

.btn-softia-danger:hover {
    background: linear-gradient(135deg, #be123c 0%, #9f1239 100%);
    transform: translateY(-1px);
}

.btn-softia-secondary {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    border-radius: 0.85rem;
    transition: all 0.2s ease;
}

.btn-softia-secondary:hover {
    background: #f8fafc;
    color: var(--accent-green);
    border-color: #a7f3d0;
}

.badge-status {
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
    border-radius: 9999px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-status.bg-success {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    border: 1px solid #a7f3d0;
}

.badge-status.bg-warning {
    background-color: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #fde68a;
}
