/* ==========================================================================
   BANCO CENTRAL RP - TEMA "CENTRO FINANCIERO" v4.0
   - Rediseño a formato dashboard con múltiples cuentas y UX mejorada.
   ========================================================================== */

/* --- 1. FONDO Y CONTENEDOR PRINCIPAL --- */
body.dark-theme {
    background: #0D1117;
    overflow-x: hidden;
}

.banco-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* Estado de carga */
.loading-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 60vh;
    color: var(--text-secondary);
}
.loading-container .spinner {
    width: 48px;
    height: 48px;
    border: 5px solid var(--border-color);
    border-bottom-color: var(--primary-accent);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}
@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- 2. LAYOUT DEL DASHBOARD --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    align-items: flex-start;
}

/* --- 3. SIDEBAR (PERFIL Y CUENTAS) --- */
.dashboard-sidebar {
    background: var(--dark-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    position: sticky;
    top: 90px; /* Debajo de la navbar */
}

.user-profile {
    text-align: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--primary-accent);
    margin-bottom: 1rem;
}
.user-profile h2 { font-size: 1.5rem; color: var(--text-primary); margin: 0; }
.user-profile p { color: var(--text-secondary); margin-top: 0.25rem; }

.total-balance {
    text-align: center;
    padding: 1.5rem 0;
}
.total-balance p { margin: 0; color: var(--text-secondary); }
.total-balance h3 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-accent);
    margin: 0;
}

.accounts-section h4 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}
#accounts-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.account-item {
    background: var(--dark-bg);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.account-item-header { display: flex; justify-content: space-between; align-items: center; }
.account-name { font-weight: 600; color: var(--text-primary); }
.account-type { font-size: 0.8rem; color: var(--text-secondary); }
.account-balance { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); margin-top: 0.5rem; }

.btn-secondary-action {
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: 1px dashed var(--border-color);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-secondary-action:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* --- 4. CONTENIDO PRINCIPAL (PESTAÑAS) --- */
.dashboard-main {
    background: var(--dark-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem 2rem;
}

/* Estilos de Pestañas (tabs) sin cambios */
.tabs { display: flex; border-bottom: 1px solid var(--border-color); margin-bottom: 1.5rem; }
.tab-link { background: none; border: none; color: var(--text-secondary); padding: 1rem 1.5rem; cursor: pointer; font-size: 1rem; font-weight: 600; transition: color 0.3s, border-bottom 0.3s; border-bottom: 3px solid transparent; position: relative; top: 1px; }
.tab-link i { margin-right: 0.5rem; }
.tab-link:hover { color: var(--text-primary); }
.tab-link.active { color: var(--primary-accent); border-bottom-color: var(--primary-accent); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeInContent 0.5s ease; }
@keyframes fadeInContent { from { opacity: 0; } to { opacity: 1; } }

/* --- 5. COMPONENTES DENTRO DE LAS PESTAÑAS --- */

/* Resumen */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.quick-action-btn { background: var(--dark-bg); border: 1px solid var(--border-color); border-radius: 8px; padding: 1.5rem; text-align: center; color: var(--text-secondary); font-weight: 600; cursor: pointer; transition: all 0.2s ease; }
.quick-action-btn:hover { transform: translateY(-4px); border-color: var(--primary-accent); color: var(--primary-accent); }
.quick-action-btn i { font-size: 1.5rem; display: block; margin-bottom: 0.75rem; }
.chart-placeholder { text-align: center; padding: 3rem; background: var(--dark-bg); border-radius: 8px; border: 1px dashed var(--border-color); color: var(--text-secondary); margin-top: 1rem; }

/* Contactos */
.contacts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.contact-item { background: var(--dark-bg); padding: 1rem; border-radius: 8px; text-align: center; cursor: pointer; transition: all 0.2s ease; }
.contact-item:hover { transform: translateY(-4px); background: var(--border-color); }
.contact-item p { margin: 0; }
.contact-name { font-weight: 600; color: var(--text-primary); }
.contact-rut { font-size: 0.9rem; color: var(--text-secondary); }

/* Desglose de Sueldo */
/* Desglose de Sueldo (CORREGIDO) */
.salary-details { 
    background-color: var(--dark-bg); 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    padding: 1.5rem; 
    margin-bottom: 1.5rem; 
}

.salary-details .s-row { 
    display: flex; 
    justify-content: space-between; 
    padding: 0.75rem 0; 
    border-bottom: 1px solid var(--border-color); 
}

.salary-details .s-row:last-child { 
    border-bottom: none; 
}

.salary-details .s-label { 
    color: var(--text-secondary); 
}

.salary-details .s-amount { 
    font-weight: 600; 
    color: var(--text-primary); 
}

.salary-details .s-total .s-label { 
    font-weight: 700; 
    color: var(--text-primary); 
}

.salary-details .s-total .s-amount { 
    font-weight: 700; 
    font-size: 1.2rem; 
    color: var(--primary-accent); 
}
/* Formularios y Botones (reutilizados y consistentes) */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.form-control { width: 100%; padding: 0.8rem 1rem; border: 1px solid var(--border-color); border-radius: var(--main-border-radius); background-color: var(--dark-bg); color: var(--text-primary); font-size: 1rem; transition: all 0.3s ease; }
.form-control:focus { outline: none; border-color: var(--primary-accent); box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2); }
.btn-action { width: 100%; padding: 0.8rem 1rem; font-weight: 700; font-size: 1rem; border: none; border-radius: var(--main-border-radius); cursor: pointer; background: var(--primary-accent); color: var(--primary-accent-text); transition: all 0.3s ease; }
.btn-action:hover:not(:disabled) { background-color: var(--primary-accent-hover); transform: translateY(-2px); box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2); }
.btn-action:disabled { background-color: #334155; color: #64748b; cursor: not-allowed; }

/* Historial (sin cambios mayores) */
.history-list { max-height: 500px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.75rem; padding-right: 0.5rem; }
.transaction-item { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: var(--dark-bg); border-radius: 8px; border-left: 4px solid var(--border-color); }
.transaction-icon.income { color: #28a745; }
.transaction-icon.expense { color: #dc3545; }
.transaction-amount.income { color: #28a745; }
.transaction-amount.expense { color: #dc3545; }
.transaction-amount { font-family: 'Courier New', monospace; font-weight: 700; margin-left: auto; }
.transaction-desc { font-weight: 600; color: var(--text-primary); }
.transaction-date { font-size: 0.8rem; color: var(--text-secondary); }

hr { border-color: var(--border-color); margin: 1.5rem 0; }
.hidden { display: none !important; }

/* --- 7. Sistema de Notificaciones Emergentes (CORREGIDO) --- */

#notification-container {
    position: fixed;
    top: 90px; /* Debajo del header */
    right: 2rem;
    z-index: 2000; /* Por encima de todo */
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-end;
}

.notification {
    background-color: var(--surface-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-left-width: 5px; /* Borde de color distintivo */
    border-radius: 8px;
    padding: 1rem 1.5rem;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.2), 0 4px 6px -2px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification i {
    font-size: 1.5rem;
}

.notification p {
    margin: 0;
    font-weight: 600;
    line-height: 1.5;
}

/* Colores según el tipo de notificación */
.notification.success {
    border-left-color: var(--accent-green);
}
.notification.success i {
    color: var(--accent-green);
}

.notification.error {
    border-left-color: #EF4444; /* Rojo para errores */
}
.notification.error i {
    color: #EF4444;
}

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

