/* --- CSS VARIABLES & RESET --- */
:root {
    /* SCIENTIFICALLY BALANCED "SOFT HOLOGRAPHIC" PALETTE */
    --bg-gradient: linear-gradient(135deg, #fbc2eb 0%, #a6c1ee 50%, #96e6a1 100%);
    
    /* Glassmorphism Configuration */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: 1px solid rgba(255, 255, 255, 0.6);
    --glass-blur: blur(20px);
    
    /* UPDATED: Softer Primary for Eye Comfort */
    --primary: #6366f1; /* Soft Indigo */
    --primary-light: #818cf8;
    --primary-glow: 0 4px 20px rgba(99, 102, 241, 0.3); /* Softer diffusion */
    
    /* UPDATED: Softer Contrast Typography */
    --text-dark: #334155; /* Slate 700 - Softer than black */
    --text-gray: #64748b; /* Slate 500 */
    
    /* Semantic Colors */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    --radius: 24px;
    --nav-height: 80px;
    --shadow: 0 10px 40px -10px rgba(0,0,0,0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    background: var(--bg-gradient);
    color: var(--text-dark);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background-attachment: fixed; 
}

/* --- HEADER --- */
header {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: var(--glass-border);
    padding: 15px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 4px 30px rgba(0,0,0,0.03);
}

.header-left { display: flex; align-items: center; gap: 8px; }

.brand-text {
    font-size: 22px;
    font-weight: 900;
    /* Gradient Text for Holographic Feel */
    background: linear-gradient(to right, #6366f1, #d946ef);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.brand-badge {
    background: rgba(255,255,255,0.5);
    color: #6366f1;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: 1px solid rgba(255,255,255,0.6);
}

.notif-box { position: relative; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.notif-badge {
    position: absolute; top: 0; right: 0;
    background: var(--danger); color: white;
    font-size: 10px; font-weight: 800;
    width: 16px; height: 16px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.4);
}

.safety-banner {
    background: rgba(255, 255, 255, 0.85);
    color: #b45309;
    padding: 8px 24px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.4);
    backdrop-filter: blur(5px);
}

.btn-banner {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    padding: 5px 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 10px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

/* --- MAIN CONTAINER --- */
main {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    padding-bottom: calc(var(--nav-height) + 24px);
    }

/* --- GLASSMORPHISM CARDS --- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

/* --- VIEWS --- */
.view { display: none; animation: fadeIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

.section-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 15px;
    display: flex; justify-content: space-between; align-items: center;
}

/* --- HOME VIEW --- */
.search-row { display: flex; gap: 12px; margin-bottom: 24px; }

.search-input-style {
    padding: 16px 20px;
    border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.5);
    background: rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow);
    font-size: 14px;
    outline: none;
    width: 100%;
    color: var(--text-dark);
    backdrop-filter: blur(10px);
    font-weight: 500;
    transition: all 0.2s;
}
.search-input-style:focus { background: white; border-color: #a6c1ee; }

.search-row input { flex: 1; }
.search-row select { width: auto; font-weight: 600; }

.empty-state { text-align: center; margin-top: 60px; color: var(--text-gray); opacity: 0.9; }

.btn-restore {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
    cursor: pointer;
    margin-top: 15px;
}

.borrower-card {
    padding: 18px;
    margin-bottom: 16px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: transform 0.1s, background 0.2s;
    cursor: pointer;
}
.borrower-card:active { transform: scale(0.98); background: rgba(255,255,255,0.9); }

/* Priority Borders */
.borrower-card.priority-high { border-left: 6px solid var(--danger); }
.borrower-card.priority-med { border-left: 6px solid var(--warning); }

.b-avatar {
    width: 50px; height: 50px;
    /* Gradient Avatar */
    background: linear-gradient(135deg, #e0f2fe, #a5f3fc);
    color: var(--primary);
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; margin-right: 16px;
    font-size: 20px;
    box-shadow: 0 4px 10px rgba(186, 230, 253, 0.5);
    border: 2px solid white;
}

.alert-icon { font-size: 18px; margin-left: 6px; vertical-align: middle; }
.text-warning { color: #d97706; }
.text-red { color: #dc2626; }

.btn-see-more {
    display: block; width: 100%; text-align: center;
    padding: 14px; color: var(--primary); font-weight: 700; font-size: 13px;
    background: rgba(255,255,255,0.4); border-radius: 16px; border: none; cursor: pointer; margin-top: 10px;
}

/* --- DASHBOARD VIEW --- */
.dash-card-lg {
    padding: 30px;
    text-align: center;
    margin-bottom: 20px;
    border-top: 4px solid #d946ef; /* Softer Fuchsia */
}
/* Updated Dashboard Font Colors */
.dash-time { font-size: 40px; font-weight: 800; color: #475569; margin-bottom: 4px; letter-spacing: -1px; }
.dash-label { color: #64748b; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dash-card-sm {
    padding: 24px;
    text-align: center;
    border-top: 4px solid;
}
.stat-val { font-size: 28px; font-weight: 800; margin-bottom: 4px; color: #334155; }
.text-green { color: #059669; }
.text-red { color: #dc2626; }

/* --- BOOKS VIEW --- */
.tabs { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 5px; margin-bottom: 20px; }
.tab-btn {
    background: rgba(255,255,255,0.4);
    border: 1px solid rgba(255,255,255,0.5);
    padding: 12px 24px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-gray);
    white-space: nowrap;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s;
}
/* UPDATED: Softer Active Tab Color */
.tab-btn.active { 
    background: linear-gradient(135deg, #818cf8, #a78bfa); 
    color: white; 
    box-shadow: 0 4px 15px rgba(129, 140, 248, 0.4);
    border: none;
}

.books-header {
    display: grid; grid-template-columns: 1fr 1.5fr 1fr 1fr;
    padding: 16px; margin-bottom: 12px;
    font-weight: 800; font-size: 11px; color: var(--text-dark);
    text-transform: uppercase;
}
.book-row {
    display: grid; grid-template-columns: 1fr 1.5fr 1fr 1fr;
    padding: 18px; border-bottom: 1px solid rgba(0,0,0,0.05);
    font-size: 12px; color: var(--text-dark);
}

/* --- TOOLS VIEW --- */
.tools-list { display: flex; flex-direction: column; gap: 16px; }
.tool-item {
    padding: 20px;
    display: flex; align-items: center; gap: 20px;
    cursor: pointer;
    transition: transform 0.1s;
}
.tool-item:active { transform: scale(0.98); }
.tool-icon-box {
    width: 52px; height: 52px; border-radius: 20px;
    display: flex; align-items: center; justify-content: center; font-size: 26px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
/* Icon Colors - Kept Pastel/Soft */
.bg-blue { background: #dbeafe; color: #2563eb; }
.bg-green { background: #dcfce7; color: #16a34a; }
.bg-yellow { background: #fef3c7; color: #d97706; }
.bg-gray { background: #f1f5f9; color: #475569; }
.bg-teal { background: #ccfbf1; color: #0d9488; }
.bg-orange { background: #ffedd5; color: #ea580c; }

.tool-content h4 { font-size: 16px; font-weight: 700; color: var(--text-dark); }
.tool-content p { font-size: 12px; color: var(--text-gray); margin-top: 4px; }

/* --- BOTTOM NAV --- */
.bottom-nav {
    position: fixed; bottom: 0; width: 100%; height: var(--nav-height);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex; justify-content: space-around; align-items: center;
    border-top: 1px solid rgba(255,255,255,0.5);
    z-index: 100;
}
.nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    color: #94a3b8; font-size: 26px; cursor: pointer; width: 25%;
    transition: color 0.2s;
}
.nav-item span { font-size: 11px; font-weight: 600; }
.nav-item.active { 
    color: var(--primary); 
    text-shadow: 0 0 15px rgba(99, 102, 241, 0.4); 
}

/* --- FAB (UPDATED: SOFTER COLOR & GLOW) --- */
.fab {
    position: fixed; bottom: calc(var(--nav-height) + 24px); right: 24px;
    width: 64px; height: 64px; 
    /* Softer Indigo/Lavender Gradient */
    background: linear-gradient(135deg, #818cf8, #c084fc);
    color: white;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 32px; 
    /* Soft Neon Diffusion */
    box-shadow: 0 8px 25px rgba(167, 139, 250, 0.6);
    border: 2px solid rgba(255,255,255,0.4);
    cursor: pointer; z-index: 99;
    transition: transform 0.1s;
}
.fab:active { transform: scale(0.9); }

/* --- MODALS / OVERLAYS --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(30, 27, 75, 0.3); /* Navy dim */
    z-index: 200; display: none;
    justify-content: center; align-items: flex-end;
    backdrop-filter: blur(8px);
}
.modal-overlay.open { display: flex; }

.modal-sheet {
    background: rgba(255, 255, 255, 0.95);
    width: 100%; max-width: 600px; height: 90vh;
    border-radius: 32px 32px 0 0; padding: 32px; overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex; flex-direction: column;
    box-shadow: 0 -20px 50px rgba(0,0,0,0.15);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* --- FORM INPUTS --- */
.form-group { margin-bottom: 24px; }

.form-group label { 
    display: block; font-size: 13px; font-weight: 700; 
    color: var(--text-dark); margin-bottom: 10px; letter-spacing: 0.5px;
}

.form-group input, .form-group select {
    width: 100%; padding: 18px 20px; font-size: 16px; font-weight: 600;
    color: var(--text-dark); background-color: #f8fafc;
    border: 2px solid #e2e8f0; border-radius: 20px; outline: none;
    transition: all 0.2s ease;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--primary); background-color: #ffffff;
    box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.1);
}

.btn-block { 
    width: 100%; padding: 18px; border: none; border-radius: 20px; 
    font-weight: 700; cursor: pointer; font-size: 15px; margin-top: 12px; 
    transition: transform 0.1s; 
}
.btn-block:active { transform: scale(0.98); }
.btn-primary, .btn-secondary { 
    padding: 14px 24px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.btn-primary:active, .btn-secondary:active { transform: scale(0.98); }

.btn-primary { 
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.9), rgba(129, 140, 248, 0.9)); 
    color: white; 
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-dark);
    box-shadow: 0 8px 20px -5px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.8);
}
.btn-danger { background: var(--danger); color: white; box-shadow: 0 10px 25px -5px rgba(239, 68, 68, 0.4); }
.btn-success { background: var(--success); color: white; box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.4); }
.btn-cancel { background: #f1f5f9; color: var(--text-dark); }

/* Photo Placeholder */
.photo-placeholder {
    width: 110px; height: 110px; background: linear-gradient(135deg, #f3e8ff, #e0e7ff); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; color: var(--primary); margin: 0 auto 30px auto;
    cursor: pointer; border: 4px solid white; box-shadow: var(--shadow);
    overflow: hidden; 
    background-size: cover;
    background-position: center;
}

/* --- DETAILS MODAL STYLES --- */
.details-header { text-align: center; margin-bottom: 30px; }
.details-avatar { 
    width: 90px; height: 90px; border-radius: 30px; 
    background-color: #c4b5fd; 
    background-size: cover;
    background-position: center;
    margin: 0 auto 20px; display: flex; align-items: center; justify-content: center;
    font-size: 36px; color: white; font-weight: 800; box-shadow: 0 10px 30px rgba(129, 140, 248, 0.5);
    border: 4px solid white;
}
.details-balance { font-size: 36px; font-weight: 900; color: var(--text-dark); margin: 8px 0; letter-spacing: -1px; }
.details-label { font-size: 12px; color: var(--text-gray); font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; }

.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 30px; }
.action-btn { 
    padding: 18px; border-radius: 20px; border: none; color: white; font-weight: 700; 
    font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
}

.history-section h4 { font-size: 14px; color: var(--text-gray); margin-bottom: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.history-list { background: #f8fafc; border-radius: 20px; padding: 10px; max-height: 300px; overflow-y: auto; border: 2px solid #f1f5f9; }
.history-item { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 16px; border-bottom: 1px solid #e2e8f0; font-size: 13px; 
}
.history-item:last-child { border-bottom: none; }
.h-date { color: var(--text-gray); font-size: 11px; margin-top: 4px; font-weight: 500; }
.h-amount { font-weight: 800; font-size: 15px; }

/* Toast Notification */
.toast {
    position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.9); backdrop-filter: blur(10px);
    color: white; padding: 12px 24px; border-radius: 30px;
    font-size: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 300;
    text-align: center; width: 80%; max-width: 300px;
}

/* --- TUTORIAL STYLES --- */
.tutorial-step { margin-bottom: 25px; border-bottom: 1px solid rgba(0,0,0,0.05); padding-bottom: 15px; }
.tutorial-step:last-child { border-bottom: none; }
.tutorial-step h4 { color: var(--primary); font-size: 16px; margin-bottom: 8px; font-weight: 700; }
.tutorial-step p { font-size: 13px; line-height: 1.6; color: var(--text-dark); opacity: 0.9; }
.badge-warn { background: #fff7ed; color: #ea580c; padding: 2px 6px; border-radius: 4px; font-weight: 700; font-size: 11px; margin-left: 5px;}

/* --- LOAN CARD STYLES --- */
.loan-list-card {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}
.loan-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.loan-status { font-size: 10px; font-weight: 800; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; }
.status-active { background: #dcfce7; color: #166534; }
.status-overdue { background: #fee2e2; color: #991b1b; }
.loan-details { font-size: 12px; color: var(--text-gray); line-height: 1.6; }
.loan-total { font-size: 18px; font-weight: 900; color: var(--text-dark); margin: 10px 0; }
.loan-actions { display: flex; gap: 10px; }
.btn-pay-small { flex: 1; padding: 10px; font-size: 12px; border-radius: 10px; border: none; font-weight: 700; cursor: pointer; background: var(--success); color: white; }

/* --- RECEIPT MODAL --- */
.receipt-paper {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}
.receipt-paper::before {
    content: "";
    position: absolute; top: 0; left: 0; width: 100%; height: 8px;
    background: linear-gradient(to right, #6366f1, #10b981);
}
.receipt-amount { font-size: 42px; font-weight: 900; color: var(--text-dark); margin: 20px 0; letter-spacing: -2px; }
.receipt-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 12px; color: var(--text-gray); border-bottom: 1px dashed #e2e8f0; padding-bottom: 8px; }
.receipt-row span:last-child { font-weight: 700; color: var(--text-dark); }
             
