/* ============================================
   Portal Meteorologico INDOMET Alternativo
   Diseno alusivo a indomet.gob.do
   ============================================ */

:root {
    --azul-gob: #003869;
    --azul-gob-hover: #002a50;
    --azul-claro: #e8f0fe;
    --gris-borde: #dee2e6;
    --gris-fondo: #f4f5f7;
    --blanco: #ffffff;
    --texto-oscuro: #1a1a2e;
    --rojo-alerta: #dc3545;
    --verde-ok: #198754;
    --dorado: #c8960c;
    --naranja-alerta: #fd7e14;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background-color: var(--gris-fondo);
    color: var(--texto-oscuro);
    line-height: 1.6;
}

/* ─── HEADER GUBERNAMENTAL ─── */
.barra-gob {
    background-color: var(--azul-gob);
    color: var(--blanco);
    padding: 4px 0;
    font-size: 0.8rem;
    letter-spacing: 0.3px;
}

.barra-gob .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.barra-gob a {
    color: var(--blanco);
    text-decoration: none;
    font-size: 0.78rem;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.barra-gob a:hover {
    opacity: 1;
    color: var(--blanco);
}

/* ─── NAVBAR ─── */
.navbar-principal {
    background: var(--blanco);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-principal .nav-link {
    color: var(--azul-gob) !important;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.6rem 1rem;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.navbar-principal .nav-link:hover,
.navbar-principal .nav-link.active {
    border-bottom-color: var(--azul-gob);
    background: var(--azul-claro);
    border-radius: 4px 4px 0 0;
}

/* ─── HERO ─── */
.hero-meteo {
    background: linear-gradient(135deg, var(--azul-gob) 0%, #004d8c 50%, #0066b3 100%);
    color: var(--blanco);
    padding: 2rem 0 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-meteo::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-meteo h1 {
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.hero-meteo .badge-status {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.35rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    backdrop-filter: blur(4px);
}

.hero-meteo .live-dot {
    width: 10px;
    height: 10px;
    background: #28a745;
    border-radius: 50%;
    display: inline-block;
    animation: pulso 2s infinite;
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.5);
}

@keyframes pulso {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.5); }
    70% { box-shadow: 0 0 0 8px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

/* ─── TABS ─── */
.nav-tabs-container {
    background: var(--blanco);
    border-bottom: 3px solid var(--gris-borde);
    position: sticky;
    top: 76px;
    z-index: 999;
    scrollbar-width: thin;
    overflow-x: auto;
}

.nav-tabs-meteo {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0;
    flex-wrap: nowrap;
}

.nav-tabs-meteo .nav-item {
    flex-shrink: 0;
}

.nav-tabs-meteo .nav-link-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.3rem;
    border: none;
    background: none;
    color: #6c757d;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    position: relative;
    top: 3px;
}

.nav-tabs-meteo .nav-link-tab:hover {
    color: var(--azul-gob);
    background: var(--azul-claro);
}

.nav-tabs-meteo .nav-link-tab.active {
    color: var(--azul-gob);
    border-bottom-color: var(--azul-gob);
    background: var(--blanco);
}

.nav-tabs-meteo .nav-link-tab i {
    font-size: 1.1rem;
}

/* ─── CONTENIDO ─── */
.tab-content {
    padding: 1.5rem 0;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* ─── TARJETA DE DATOS ─── */
.card-meteo {
    background: var(--blanco);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--gris-borde);
    overflow: hidden;
    transition: box-shadow 0.3s;
}

.card-meteo:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.card-meteo .card-header {
    background: linear-gradient(90deg, var(--azul-gob), #004d8c);
    color: var(--blanco);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-meteo .card-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-meteo .card-header .fecha-actualizacion {
    font-size: 0.8rem;
    opacity: 0.85;
    font-weight: 400;
}

.card-meteo .card-body {
    padding: 1.5rem;
}

/* ─── CAJA TIPO TERMINAL (METAR/TAF/SIGMET) ─── */
.terminal-box {
    background: #0d1117;
    color: #58a6ff;
    border-radius: 8px;
    padding: 1.2rem 1.5rem;
    font-family: 'Consolas', 'Courier New', 'Fira Code', monospace;
    font-size: 0.95rem;
    line-height: 1.8;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid #30363d;
    position: relative;
}

.terminal-box::before {
    content: '$ METAR \25B8';
    display: block;
    color: #8b949e;
    margin-bottom: 0.6rem;
    font-size: 0.78rem;
    letter-spacing: 1px;
}

.terminal-box.tipo-sigmet::before { content: '$ SIGMET \25B8'; }
.terminal-box.tipo-taf::before    { content: '$ TAF \25B8'; }
.terminal-box.tipo-metar::before  { content: '$ METAR \25B8'; }

/* ─── VISOR DE IMAGEN ─── */
.imagen-viewer {
    background: #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    position: relative;
    cursor: zoom-in;
}

.imagen-viewer img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    transition: transform 0.3s;
}

.imagen-viewer.zoomed img {
    transform: scale(2);
    cursor: zoom-out;
}

.imagen-viewer .download-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: var(--azul-gob);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 500;
    transition: background 0.2s;
    text-decoration: none;
}

.imagen-viewer .download-btn:hover {
    background: #002a50;
    color: white;
}

/* ─── SIN DATOS ─── */
.sin-datos {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #6c757d;
}

.sin-datos i {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.sin-datos h5 {
    font-weight: 600;
    color: #adb5bd;
}

/* ─── HISTORIAL ─── */
.historial-section {
    margin-top: 1.5rem;
}

.historial-section summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--azul-gob);
    padding: 0.6rem 0;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    user-select: none;
}

.historial-section summary:hover {
    color: #004d8c;
}

.historial-list {
    list-style: none;
    padding: 0;
}

.historial-list li {
    padding: 0.7rem 1rem;
    border-left: 3px solid var(--azul-gob);
    margin-bottom: 0.5rem;
    background: var(--azul-claro);
    border-radius: 0 6px 6px 0;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    transition: background 0.2s;
}

.historial-list li:hover {
    background: #d4e4f7;
}

.historial-list .fecha {
    font-size: 0.78rem;
    color: #6c757d;
    white-space: nowrap;
}

.historial-list .tipo-badge {
    font-size: 0.72rem;
    background: var(--azul-gob);
    color: white;
    padding: 0.15rem 0.6rem;
    border-radius: 50px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ─── FOOTER ─── */
.footer-indomet {
    background: var(--azul-gob);
    color: rgba(255, 255, 255, 0.8);
    padding: 2rem 0 1.5rem;
    margin-top: 3rem;
    font-size: 0.88rem;
}

.footer-indomet h6 {
    color: var(--blanco);
    font-weight: 700;
    margin-bottom: 0.8rem;
}

.footer-indomet a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-indomet a:hover {
    color: var(--blanco);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 1.2rem;
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.78rem;
    opacity: 0.7;
}

/* ─── ADMIN PANEL ─── */
.admin-body {
    background: #f0f2f5;
    min-height: 100vh;
}

.admin-sidebar {
    background: var(--azul-gob);
    color: var(--blanco);
    min-height: 100vh;
    width: 250px;
    position: fixed;
    left: 0;
    top: 0;
    padding: 1.5rem 0;
    z-index: 1000;
}

.admin-sidebar .brand {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
}

.admin-sidebar .brand h4 {
    color: white;
    margin: 0;
    font-weight: 700;
    font-size: 1.1rem;
}

.admin-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.2s;
    font-weight: 500;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: white !important;
}

.admin-main {
    margin-left: 250px;
    padding: 1.5rem;
}

.admin-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--gris-borde);
}

.admin-card .card-header {
    background: transparent;
    border-bottom: 2px solid var(--gris-borde);
    padding: 1rem 1.5rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--azul-gob);
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--azul-gob), #004d8c);
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-card .logo-login {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-card .logo-login img {
    height: 70px;
}

.login-card h4 {
    text-align: center;
    color: var(--azul-gob);
    font-weight: 700;
    margin-bottom: 1.8rem;
}

.login-card .btn-primary {
    width: 100%;
    background: var(--azul-gob);
    border: none;
    padding: 0.7rem;
    font-weight: 600;
    border-radius: 8px;
}

.login-card .btn-primary:hover {
    background: var(--azul-gob-hover);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
    .nav-tabs-meteo .nav-link-tab {
        padding: 0.6rem 0.9rem;
        font-size: 0.8rem;
    }

    .hero-meteo h1 {
        font-size: 1.3rem;
    }

    .card-meteo .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .terminal-box {
        font-size: 0.82rem;
        padding: 1rem;
    }

    .admin-sidebar {
        width: 100%;
        min-height: auto;
        position: relative;
    }

    .admin-main {
        margin-left: 0;
    }
}

@media (max-width: 576px) {
    .nav-tabs-meteo .nav-link-tab {
        padding: 0.5rem 0.7rem;
        font-size: 0.75rem;
        gap: 0.3rem;
    }

    .nav-tabs-meteo .nav-link-tab i {
        font-size: 0.9rem;
    }
}

/* ─── BADGE DE VIGENCIA ─── */
.badge-vigente {
    background: #d4edda;
    color: #155724;
    padding: 0.2rem 0.7rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-vencido {
    background: #f8d7da;
    color: #721c24;
    padding: 0.2rem 0.7rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ─── SPINNER ─── */
.spinner-carga {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gris-borde);
    border-top-color: var(--azul-gob);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── ALERTAS ─── */
.alerta-actualizacion {
    background: linear-gradient(90deg, #fff3cd, #ffe69c);
    color: #664d03;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-bottom: 1px solid #ffc107;
    text-align: center;
    display: none;
}

.alerta-actualizacion.show {
    display: block;
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
