/* VARIABLES GLOBALES */
:root {
    --primary-blue: #1a237e;
    --primary-red: #d32f2f;
    --bg-body: #f4f7f9;
    --text-main: #37474f;
    --text-light: #90a4ae;
    --white: #ffffff;
    --sidebar-width: 260px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

/* RESET GENERAL */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden;
}

/* ESTRUCTURA WRAPPER */
.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-blue);
    color: var(--white);
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: fixed;
    height: 100vh;
    transition: var(--transition);
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 40px;
}

.sidebar-logo i {
    font-size: 2rem;
    color: var(--primary-red);
}

.nav-menu {
    list-style: none;
    flex-grow: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #c5cae9;
    text-decoration: none;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.nav-link i {
    font-size: 1.4rem;
}

.logout-link {
    color: #ff8a80;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
}

/* CONTENIDO PRINCIPAL */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 30px;
    transition: var(--transition);
}

/* HEADER */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.header-info h2 {
    font-size: 1.5rem;
    color: var(--primary-blue);
}

/* COMPONENTES REUTILIZABLES (BADGES Y CARDS) */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 10px;
}

.badge-blue { background: #e8eaf6; color: var(--primary-blue); }
.badge-red { background: #ffebee; color: var(--primary-red); }

.card-widget {
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    border-left: 5px solid var(--primary-red);
}

.card-widget i {
    font-size: 2.5rem;
    color: var(--primary-red);
}

/* RESPONSIVE (Móviles) */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
        padding: 15px 5px;
    }
    
    .sidebar .link-name, .sidebar-logo span {
        display: none;
    }
    
    .main-content {
        margin-left: 70px;
        width: calc(100% - 70px);
        padding: 15px;
    }
    
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}



/* SISTEMA DE GRID PARA DASHBOARD */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* ESTILO DE LAS CARDS DE ESTADO */
.card-status {
    background: var(--white);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    border-bottom: 4px solid transparent;
}

.card-status:hover {
    transform: translateY(-5px);
}

.card-icon { 
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

/* Variantes de Color para las Cards */
.card-status.info { border-bottom-color: var(--primary-blue); }
.card-status.info .card-icon { background: #e8eaf6; color: var(--primary-blue); }

.card-status.success { border-bottom-color: #2e7d32; }
.card-status.success .card-icon { background: #e8f5e9; color: #2e7d32; }

.card-status.danger { border-bottom-color: var(--primary-red); }
.card-status.danger .card-icon { background: #ffebee; color: var(--primary-red); }

.card-details .label {
    display: block;
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.card-details .value {
    font-size: 1.3rem;
    color: var(--text-main);
    margin: 5px 0;
}

.card-details .sub-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* CAJA DE ALERTAS */
.alert-box {
    background: var(--white);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.alert-header {
    background: var(--primary-red);
    color: var(--white);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.alert-content {
    padding: 20px;
}

.alert-content p {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 15px;
}

/* BOTONES GLOBALES */
.btn-main-red {
    background: var(--primary-red);
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-main-red:hover {
    background: #b71c1c;
    box-shadow: 0 4px 10px rgba(211, 47, 47, 0.3);
}


/* ESTILOS DEL MODAL */
.modal {
    display: none; /* Se activa por JS */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--white);
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow);
    position: relative;
}

/* STEPPER */
.stepper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.step {
    padding: 10px;
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 600;
}

.step.active {
    color: var(--primary-blue);
    border-bottom: 3px solid var(--primary-red);
}

/* FORMULARIO */
.form-step { display: none; }
.form-step.active { display: block; }

.input-group { margin-bottom: 20px; }
.input-group label { display: block; margin-bottom: 8px; font-weight: 600; }

.input-file {
    width: 100%;
    padding: 10px;
    border: 2px dashed #cfd8dc;
    border-radius: 8px;
    cursor: pointer;
}

/* PAGO QR */
.pago-info {
    display: flex;
    gap: 20px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.qr-container img { width: 100px; height: 100px; }
.price { font-size: 1.5rem; color: var(--primary-red); font-weight: bold; }

/* BOTONES DEL MODAL */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
}

.btn-next, .btn-finish { background: var(--primary-blue); color: var(--white); border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; }
.btn-prev { background: #cfd8dc; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; }
.success-icon { font-size: 5rem; color: #4caf50; display: block; margin-bottom: 15px; }

.text-center { text-align: center; }


/* Posicionamiento de la X de cierre */
.modal-header {
    position: relative; /* Esto es clave para que la X se guíe por el encabezado */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
}



/* DISEÑO PARA TABLA DE PENSIONES */
.table-container {
    background: var(--white);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    width: 100%;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.table-header h3 {
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

/* Tabla Custom */
.custom-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.custom-table th {
    text-align: left;
    padding: 12px 15px;
    color: var(--text-light);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid #f4f7f9;
}

.custom-table td {
    padding: 15px;
    border-bottom: 1px solid #f4f7f9;
    vertical-align: middle;
    color: var(--text-main);
    font-size: 0.95rem;
}

.custom-table tbody tr:hover {
    background-color: #fcfcfc;
}

/* Indicadores de Estado (Pills) */
.status-pill {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-pill.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-pill.warning {
    background: #fff3e0;
    color: #ef6c00;
}

/* Ajustes adicionales para el modal de pago (QR) */
.qr-box {
    text-align: center;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin: 15px 0;
}

.qr-box img {
    width: 150px;
    margin-bottom: 10px;
    border: 4px solid var(--white);
    border-radius: 8px;
}

.input-standard {
    width: 100%;
    padding: 12px;
    border: 1px solid #cfd8dc;
    border-radius: 8px;
    outline: none;
    transition: var(--transition);
}

.input-standard:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
}