/* =========================================================================
   PANEL VECINOS - ESTILOS PRINCIPALES (panel_vecinos.css)
   ========================================================================= */

/* 1. VARIABLES BASE (LIGHT/DARK) */
:root {
    --pv-bg-app: #f4f6f9;
    --pv-bg-card: #ffffff;
    --pv-text-main: #002c5f;
    --pv-text-muted: #6c7a89;
    --pv-primary: #004a99;
    --pv-border: #e2e8f0;
}

body.dark-mode {
    --pv-bg-app: #0f172a;
    --pv-bg-card: #1e293b;
    --pv-text-main: #f8fafc;
    --pv-text-muted: #94a3b8;
    --pv-border: #334155;
}

/* 2. CONTENEDOR PRINCIPAL DEL PANEL */
.pv-main-container {
    width: 100%;
    max-width: 450px;
    margin: 10px auto;
    padding: 20px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--pv-bg-card);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    min-height: 80vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

@media (max-width: 480px) {
    .pv-main-container { padding: 0 !important; }
    .pv-tab-pane > div:not(.pv-mantenimiento-box):not(.pv-renovacion-aviso) { 
        padding: 5px !important; border-radius: 0 !important; border-left: none !important; border-right: none !important; 
    }
}

body.dark-mode .pv-main-container {
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

/* 3. PESTAÑAS (SEGMENTED CONTROL) */
.pv-tabs-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 25px;
    background: #f1f5f9;
    /* CAMBIO: 0px abajo para que las pestañas toquen la base de la línea */
    padding: 5px 5px 0 5px; 
    border-radius: 0px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    align-items: flex-end;
    box-shadow: inset 0 -3px 0 0 var(--pv-primary);
    position: relative; /* NUEVO: Asegura el contexto de apilamiento */
}
.pv-tabs-nav::-webkit-scrollbar { display: none; }

.pv-tab-btn {
    flex: 1;
    background: #e2e8f0;
    color: #6c7a89;
    padding: 12px 16px;
    border: 1px solid #cbd5e1;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    margin-bottom: 3px;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    outline: none;
}
.pv-tab-btn:hover:not(.active) { background: #f1f5f9; color: #0f172a; }

.pv-tab-btn.active {
    background: #ffffff;
    color: var(--pv-primary);
    border-top: 3px solid var(--pv-primary);
    border-left: 3px solid var(--pv-primary);
    border-right: 3px solid var(--pv-primary);
    /* CAMBIO: Quitamos el borde inferior para una unión recta y sin cortes diagonales */
    border-bottom: none; 
    margin-bottom: 0;
    padding-top: 15px;
    /* NUEVO: Compensamos los 3px del borde inferior que eliminamos */
    padding-bottom: 3px; 
    /* NUEVO: Obligamos a la pestaña activa a dibujarse POR ENCIMA de la línea azul */
    position: relative; 
    z-index: 2; 
}

body.dark-mode .pv-tabs-nav {
    background: transparent !important;
    box-shadow: inset 0 -3px 0 0 #38bdf8 !important;
}
body.dark-mode .pv-tab-btn {
    background: #334155 !important;
    color: #94a3b8 !important;
    border: 1px solid #475569 !important;
    border-bottom: none !important;
}
body.dark-mode .pv-tab-btn.active {
    background: var(--pv-bg-card) !important;
    color: #38bdf8 !important;
    border-color: #38bdf8 !important;
    /* CAMBIO: Sin borde inferior también en modo oscuro */
    border-bottom: none !important; 
}
body.dark-mode .pv-tab-btn:hover:not(.active) {
    background: #475569 !important; color: #ffffff !important;
}

/* 4. CONTENIDO DE PESTAÑAS Y TARJETAS */
.pv-tab-pane { display: none; }
.pv-tab-pane.active { display: block; animation: pvFadeInTab 0.3s ease; }
.pv-tab-pane > div:not(.pv-mantenimiento-box):not(.pv-renovacion-aviso) { 
    background: var(--pv-bg-card); 
    border: 1px solid var(--pv-border); 
    padding: 10px; 
    border-radius: 16px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.02); 
}
.pv-tab-transparent > div:not(.pv-mantenimiento-box):not(.pv-renovacion-aviso) { 
    background: transparent !important; border: none !important; box-shadow: none !important; padding: 0 !important; 
}

@keyframes pvFadeInTab {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 5. HOME GRID */
.pv-home-main-title { margin: 0 0 15px 0; color: var(--pv-primary); font-size: 18px; font-weight: 800; text-align: center; }
.pv-home-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; margin-top: 20px; }
.pv-home-card {
    background: var(--pv-bg-card);
    border: 1px solid var(--pv-border);
    border-radius: 16px;
    padding: 20px 15px;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.pv-home-card:hover { transform: translateY(-3px); box-shadow: 0 10px 15px -3px rgba(0,74,153,0.15); border-color: #93c5fd; }
.pv-home-icon { font-size: 32px; background: #f8fafc; width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.pv-home-title { font-size: 14px; font-weight: 700; color: var(--pv-text-main); margin: 0; }

body.dark-mode .pv-home-main-title { color: #f8fafc; }
body.dark-mode .pv-home-card { box-shadow: 2px 10px 25px 0px #00081a; }
body.dark-mode .pv-home-card:hover { border-color: #38bdf8; }
body.dark-mode .pv-home-icon { background: #334155; }

/* 6. AVISOS Y ALERTAS GLOBALES DEL PANEL */
.pv-alerta { padding:12px; border-radius:10px; margin-bottom:15px; font-size:13px; font-weight:600; text-align:center; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.pv-alerta-success { background:#e8f5e9; color:#2e7d32; }
.pv-alerta-error { background:#ffebee; color:#d32f2f; }
.pv-mantenimiento-box { background:#fff3cd; color:#856404; padding:20px; border-radius:12px; text-align:center; font-weight:600; border:1px solid #ffeeba; margin: 15px; }
.pv-renovacion-aviso { background: #fefce0; color: #a10303; padding: 15px; border-radius: 8px; border-left: 4px solid #e9730e; margin: 15px; font-size: 13px; text-align: left; }
.pv-alerta-verificacion { background: #fffbeb; border: 1px solid #f59e0b; padding: 20px; border-radius: 12px; margin-bottom: 20px; text-align: center; color: #92400e; }
.pv-alerta-titulo { margin-top:0; margin-bottom:10px; color: #92400e; }
.pv-alerta-texto { margin: 5px 0 15px 0; }
.pv-btn-reenviar { background: #d97706; color: #fff; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.pv-simulador-panel { background: #f0f9ff; padding: 15px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #bae6fd; }
.pv-simulador-label { display:block; font-size: 11px; font-weight: 800; color: #0369a1; margin-bottom: 8px; text-transform: uppercase; }
.pv-simulador-select { width:100%; padding: 10px; border-radius: 6px; border: 1px solid #7dd3fc; color: #0c4a6e; font-weight: 600; cursor:pointer; }

body.dark-mode .pv-alerta-success { background: rgba(46,125,50,0.2); color: #81c784; }
body.dark-mode .pv-alerta-error { background: rgba(211,47,47,0.2); color: #e57373; }
body.dark-mode .pv-mantenimiento-box { background: rgba(245,158,11,0.1); color: #fbbf24; border-color: #f59e0b; }
body.dark-mode .pv-renovacion-aviso { background: rgba(245,158,11,0.15); color: #fbbf24; border-left-color: #f59e0b; }
body.dark-mode .pv-alerta-verificacion { background: #451a03; border-color: #92400e; color: #fcd34d; }
body.dark-mode .pv-alerta-titulo { color: #f59e0b; }
body.dark-mode .pv-btn-reenviar { background: #b45309; }
body.dark-mode .pv-simulador-panel { background: #0f172a; border-color: #1e40af; }
body.dark-mode .pv-simulador-label { color: #60a5fa; }
body.dark-mode .pv-simulador-select { background: #1e293b; color: #f8fafc; border-color: #3b82f6; }

/* 7. MODAL DE ACTUALIZAR DATOS */
.pv-modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(8px); z-index: 100000; align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; }
.pv-modal-box { background: var(--pv-bg-card); width: 100%; max-width: 450px; border-radius: 16px; padding: 26px; position: relative; border: 1px solid var(--pv-border); box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); }
.pv-modal-title { margin: 0 0 6px 0; color: var(--pv-text-main); font-size: 20px; font-weight: 800; text-align: center; }
.pv-modal-subtitle { color: var(--pv-text-muted); font-size: 14px; text-align: center; margin-bottom: 20px;}
.pv-input { width: 100%; padding: 12px; margin-bottom: 12px; border-radius: 8px; border: 1px solid #cbd5e1; font-size: 14px; background: #f8fafc; box-sizing: border-box; outline: none; }
.pv-input:focus { border-color: var(--pv-primary); }
.pv-btn-submit-full { width: 100%; background: var(--pv-primary); color: white; border: none; padding: 14px; border-radius: 12px; font-weight: bold; cursor: pointer; margin-top: 10px; transition: 0.3s; }

body.dark-mode .pv-input { background: #0f172a; color: #ffffff; border-color: #334155; }
body.dark-mode .pv-btn-submit-full { background: linear-gradient(to right, #2563eb, #3b82f6); }