/* ==========================================
   BANCA 360 - SISTEMA DE DISEÑO (CSS PURO)
   Concepto: "Confianza Moderna"
   ========================================== */

/* ==========================================
   1. VARIABLES Y TEMATIZACIÓN
   ========================================== */
   * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    
    --bg-body: #F8FAFC;         
    --bg-surface: #FFFFFF;      
    
    --text-main: #0F172A;       
    --text-muted: #64748B;      
    
    --brand-primary: #4F46E5;   
    --brand-hover: #4338CA;     
    --brand-light: #EEF2FF;     
    
    --status-income: #10B981;   
    --status-outcome: #EF4444;  
    
    --border-color: #E2E8F0;    
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-brand: 0 10px 25px -5px rgba(79, 70, 229, 0.3);
    
    --radius-card: 16px;        
    --radius-btn: 12px;         
}

[data-theme="dark"] {
    --bg-body: #0F172A;         
    --bg-surface: #1E293B;      
    
    --text-main: #F8FAFC;       
    --text-muted: #94A3B8;      
    
    --brand-primary: #6366F1;   
    --brand-hover: #818CF8;
    --brand-light: #312E81;     
    
    --border-color: #334155;    
    
    --shadow-sm: 0 4px 6px rgba(0,0,0,0.3);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.5);
    --shadow-brand: 0 10px 25px -5px rgba(99, 102, 241, 0.2);
}

/* ==========================================
   2. RESET Y ESTILOS GLOBALES
   ========================================== */
body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-family);
    display: flex;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { 
    cursor: pointer; 
    border: none; 
    background: none; 
    font-family: inherit; 
    transition: all 0.2s ease;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* ==========================================
   3. NAVEGACIÓN (SIDEBAR DESKTOP)
   ========================================== */
.sidebar {
    width: 260px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.brand-logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--brand-primary);
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.5px;
}

.main-nav { flex-grow: 1; }
.nav-links { display: flex; flex-direction: column; gap: 8px; }

.nav-item {
    padding: 14px 16px;
    border-radius: var(--radius-btn);
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-item:hover, .nav-item.active {
    background-color: var(--brand-light);
    color: var(--brand-primary);
}

.sidebar-footer { display: flex; flex-direction: column; gap: 12px; }

/* ==========================================
   4. ÁREA DE TRABAJO Y COMPONENTES
   ========================================== */
.main-content {
    flex-grow: 1;
    margin-left: 260px;
    padding: 40px;
    max-width: 100%;
}

.auth-body, .logout-body {
    margin-left: 0 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 20px;
}

.view-section { animation: slideUp 0.4s ease forwards; }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.view-header { margin-bottom: 32px; }
.header-title { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 10px;}
.subtitle-view { color: var(--text-muted); font-size: 15px; margin-bottom: 30px; }

.card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-card);
    padding: 30px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    text-align: center;
    border-top: 6px solid var(--brand-primary);
}

/* ==========================================
   5. FORMULARIOS 
   ========================================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    text-align: left;
}

.form-label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius-btn);
    border: 1px solid var(--border-color);
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-primary);
    background-color: var(--bg-surface);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-control::placeholder { color: var(--text-muted); font-style: normal; }

.input-group {
    display: flex;
    gap: 10px;
}
.input-group select { width: 30%; }
.input-group input { width: 70%; }

/* ==========================================
   6. BOTONES
   ========================================== */
.btn-primary {
    width: 100%;
    min-height: 48px;
    background-color: var(--brand-primary);
    color: white;
    border-radius: var(--radius-btn);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
}
.btn-primary:hover { background-color: var(--brand-hover); box-shadow: var(--shadow-brand); transform: translateY(-1px); }

.btn-outline {
    width: 100%;
    min-height: 48px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    color: var(--text-main);
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
.btn-outline:hover { background-color: var(--bg-body); border-color: var(--brand-primary); color: var(--brand-primary); }

.btn-outline-small {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    color: var(--text-main);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-outline-small:hover { background-color: var(--bg-body); border-color: var(--text-main); }

.btn-logout { color: var(--status-outcome); border-color: var(--border-color); }
.btn-logout:hover { background-color: rgba(239, 68, 68, 0.1); border-color: var(--status-outcome); color: var(--status-outcome); }

/* ==========================================
   7. DASHBOARD Y TARJETAS ESPECIALES
   ========================================== */
.balance-card {
    background: linear-gradient(135deg, var(--brand-primary), #818CF8);
    color: white;
    border: none;
    box-shadow: var(--shadow-brand);
    position: relative;
    overflow: hidden;
}
.balance-card::after {
    content: ""; position: absolute; top: -50px; right: -50px;
    width: 200px; height: 200px; background: rgba(255, 255, 255, 0.1);
    border-radius: 50%; pointer-events: none;
}
.balance-label { font-size: 15px; font-weight: 500; opacity: 0.9; margin-bottom: 8px; }
.balance-wrapper { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 1; }
.balance-amount { font-size: 42px; font-weight: 700; letter-spacing: -1px; font-feature-settings: "tnum"; }
.account-hint { font-size: 13px; font-weight: 500; opacity: 0.88; margin-top: 12px; position: relative; z-index: 1; }

.btn-icon {
    background: rgba(255, 255, 255, 0.2); color: white; width: 44px; height: 44px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 20px; backdrop-filter: blur(4px);
}
.btn-icon:hover { background: rgba(255, 255, 255, 0.3); transform: scale(1.05); }

/* ==========================================
   8. LISTAS DE TRANSACCIONES Y FILTROS
   ========================================== */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section-title { font-size: 20px; font-weight: 600; color: var(--text-main); }
.link-primary { color: var(--brand-primary); font-weight: 600; font-size: 14px; }
.link-primary:hover { text-decoration: underline; }

.tx-list { display: flex; flex-direction: column; gap: 12px; }
.tx-item {
    display: flex; align-items: center; justify-content: space-between; padding: 16px;
    background-color: var(--bg-surface); border-radius: var(--radius-btn);
    border: 1px solid var(--border-color); cursor: pointer; transition: all 0.2s;
}
.tx-item:hover { background-color: var(--bg-body); border-color: var(--brand-primary); transform: translateX(4px);}

.filters { display: flex; gap: 12px; margin-bottom: 24px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter-btn {
    padding: 10px 20px; border-radius: 20px; border: 1px solid var(--border-color);
    background-color: var(--bg-surface); color: var(--text-muted); font-weight: 500; font-size: 14px; white-space: nowrap;
}
.filter-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.filter-btn.active { background-color: var(--brand-primary); color: white; border-color: var(--brand-primary); }

.receipt-header { text-align: center; margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px dashed var(--border-color); }
.icon-large { font-size: 40px; margin-bottom: 16px; }
.tx-amount-large { font-size: 32px; font-weight: 700; margin-bottom: 8px; font-feature-settings: "tnum"; }
.receipt-status.success { color: var(--status-income); font-weight: 600;}

.data-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border-color);}
.data-row:last-child { border-bottom: none; }
.data-label { color: var(--text-muted); font-weight: 500; }
.data-value { color: var(--text-main); font-weight: 600; }

.mt-4 { margin-top: 1.5rem; }
.text-center { text-align: center; }
#spinner { margin-top: 20px; color: var(--brand-primary); font-weight: 600;}


/* ==========================================
   9. CLASES AUXILIARES Y RESPONSIVE DESIGN
   ========================================== */

/* 📍 DEFENSA: Clase oculta en escritorio, pero visible en móviles */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    /* Activar visibilidad en teléfonos */
    .mobile-only {
        display: block;
    }

    .sidebar {
        width: 100%; height: 70px; flex-direction: row; bottom: 0; top: auto;
        padding: 10px 16px; border-right: none; border-top: 1px solid var(--border-color);
        justify-content: space-between; box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
    }
    .brand-logo, .sidebar-footer { display: none; }
    .nav-links { flex-direction: row; justify-content: space-between; width: 100%; }
    .nav-item { flex-direction: column; gap: 4px; font-size: 11px; padding: 4px 8px; background: transparent !important; }
    .nav-icon { font-size: 24px; color: var(--text-muted); }
    .nav-item.active { color: var(--brand-primary); }
    .nav-item.active .nav-icon { color: var(--brand-primary); }

    .main-content { margin-left: 0; margin-bottom: 70px; padding: 24px 16px; }
    .header-title { font-size: 24px; }
    .balance-amount { font-size: 36px; }
    .auth-card { box-shadow: none; border: none; padding: 10px; background: transparent;}
}