:root {
    /* --- COLOR PALETTE --- */
    --primary: #4f46e5;    /* Indigo */
    --secondary: #ec4899;  /* Pink */
    --success: #10b981;    /* Emerald Green */
    --warning: #f59e0b;    /* Amber */
    --danger: #ef4444;     /* Red */
    --dark: #1f2937;       /* Gray 800 */
    --light: #f3f4f6;      /* Gray 100 */
    --white: #ffffff;
    
    /* --- UI VARIABLES --- */
    --radius: 16px;
    --shadow-sm: 0 1px 2px 0 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-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --font-main: 'Poppins', sans-serif;
}

/* --- RESET & BASE STYLES --- */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background-color: var(--light);
    color: var(--dark);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- LOGIN SCREEN (Overlay) --- */
#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.5s ease-out;
}

.login-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px 30px;
    border-radius: 24px;
    text-align: center;
    width: 90%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px); /* Glassmorphism */
}

.brand-logo {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 15px;
}

.login-content h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
}

.login-content p {
    color: #6b7280;
    margin-bottom: 30px;
    font-size: 14px;
}

.pin-wrapper {
    margin-bottom: 25px;
}

.pin-input {
    width: 100%;
    padding: 15px;
    font-size: 24px;
    text-align: center;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    letter-spacing: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.pin-input:focus {
    border-color: var(--primary);
}

.login-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.btn-login {
    border: none;
    padding: 15px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.1s;
}

.btn-login:active {
    transform: scale(0.96);
}

.btn-bano {
    background-color: var(--secondary);
    color: white;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

.btn-basit {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.error-message {
    color: var(--danger);
    font-size: 13px;
    margin-top: 15px;
    min-height: 20px;
}


/* --- MAIN APP CONTAINER --- */
#app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    opacity: 0; /* Hidden initially for fade-in */
    animation: fadeIn 0.6s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 45px;
    height: 45px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.greeting-text {
    display: block;
    font-size: 12px;
    color: #6b7280;
}

.greeting h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.date-badge {
    background: var(--white);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Toggle Switch */
.view-toggle-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

.toggle-container {
    background: #e5e7eb;
    padding: 4px;
    border-radius: 50px;
    display: flex;
    position: relative;
    width: 100%;
    max-width: 300px;
    cursor: pointer;
}

.toggle-option {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 600;
    z-index: 2;
    color: #6b7280;
    transition: color 0.3s;
}

.toggle-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 50%; /* Starts at 50% width */
    height: calc(100% - 8px);
    background: white;
    border-radius: 50px;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    z-index: 1;
}

/* Active State Logic handled by JS via classes */
.toggle-active-basit .toggle-slider {
    transform: translateX(100%); /* Moves slider right */
}
.toggle-active-basit .toggle-option:nth-child(3) { color: var(--dark); } /* Basit Text */
.toggle-active-bano .toggle-option:nth-child(2) { color: var(--dark); } /* Bano Text */


/* --- SUMMARY CARDS --- */
.summary-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--white);
    padding: 15px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.income-bg { background: #e0e7ff; color: var(--primary); }
.expense-bg { background: #fee2e2; color: var(--danger); }
.balance-bg { background: #d1fae5; color: var(--success); }

.stat-label {
    display: block;
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.stat-data h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}


/* --- SECTIONS & LISTS --- */
.card-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 10px;
}

.section-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Budget List Items */
.budget-item {
    margin-bottom: 18px;
}

.budget-info {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 6px;
}

.budget-name { font-weight: 500; }
.budget-amt { font-weight: 600; font-size: 13px; color: #6b7280; }

.progress-track {
    height: 8px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Goals Grid */
.goals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.goal-card {
    background: #f9fafb;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    border: 1px solid #e5e7eb;
}

.goal-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    position: relative;
}

.goal-ring-inner {
    width: 52px;
    height: 52px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.goal-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.goal-subtitle { font-size: 11px; color: #9ca3af; }


/* --- FAB (Add Button) --- */
.fab {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--dark);
    color: white;
    border: none;
    font-size: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s, background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:active {
    transform: scale(0.9);
}


/* --- MODAL (Entry Form) --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1100;
    align-items: flex-end; /* Sheet slides from bottom */
}

.modal-sheet {
    background: white;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-radius: 24px 24px 0 0;
    padding: 25px;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.modal-header h3 { margin: 0; font-size: 20px; }

.close-btn {
    background: #f3f4f6;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.form-control {
    width: 100%;
    padding: 16px 16px 16px 48px; /* Left padding for icon */
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    background: #f9fafb;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    background: white;
}

.btn-save {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 16px;
    background: var(--dark);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

/* --- TOAST --- */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #1f2937;
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* --- SKELETON LOADING --- */
.skeleton-item {
    height: 50px;
    background: #f3f4f6;
    border-radius: 8px;
    margin-bottom: 15px;
    animation: pulse 1.5s infinite;
}

.skeleton-box {
    height: 100px;
    background: #f3f4f6;
    border-radius: 12px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Type Toggles in Modal */
.type-toggles {
    display: flex;
    background: #f3f4f6;
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 5px;
}

.type-opt {
    flex: 1;
    text-align: center;
    padding: 12px 5px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.type-opt i {
    font-size: 11px;
}

.type-opt.active {
    background: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Active colors for specific types */
#type-Expense.active { color: #ef4444; }
#type-Income.active { color: #10b981; }
#type-Saving.active { color: #4f46e5; }

/* Section Dividers */
.section-divider {
    margin: 25px 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.section-divider h4 {
    margin: 0;
    font-size: 12px;
    text-transform: uppercase;
    color: #9ca3af;
    letter-spacing: 1px;
}

/* Saving Badge */
.saving-badge {
    display: inline-block;
    background: #e0e7ff;
    color: #4338ca;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    font-weight: 600;
}

.budget-info small {
    color: #9ca3af;
    font-size: 0.85em;
}

