/* css/style.css */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* =========================================
   1. THEME VARIABLES (Premium Dark & Light Mode)
========================================= */
:root {
    /* DEFAULT THEME: DARK MODE (OLED Friendly) */
    --bg-background: #0F0F13;
    --bg-surface: #1C1C21;
    --bg-surface-hover: #2A2A32;
    
    /* Semantic Colors (GPay / Finance Standard) */
    --color-primary: #1A73E8;    /* Google Blue for actions */
    --color-success: #188038;    /* Trust Green for 'Owed to You / Jama' */
    --color-danger: #D93025;     /* Alert Red for 'You Owe / Udhaar' */
    --color-warning: #FBBC04;    /* Pending/Alerts */
    --color-settled: #9AA0A6;    /* Neutral grey for settled */
    
    --border-color: #2A2A32;
    
    --text-primary: #FFFFFF;
    --text-secondary: #9AA0A6;
    --text-tertiary: #5F6368;
    
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
}

[data-theme="light"] {
    /* Clean White Theme */
    --bg-background: #F8F9FA;
    --bg-surface: #FFFFFF;
    --bg-surface-hover: #F1F3F4;
    
    --border-color: #E8EAED;
    
    --text-primary: #202124;
    --text-secondary: #5F6368;
    --text-tertiary: #9AA0A6;
}

/* =========================================
   2. RESET & BASE
========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-background);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
    
    /* P0 QA FIX: Tabular numbers for all financial figures globally */
    font-variant-numeric: tabular-nums; 
}

#app-container {
    max-width: 480px; 
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-background);
    position: relative;
    padding-bottom: 80px; 
}

/* =========================================
   3. TYPOGRAPHY & UTILITIES
========================================= */
.text-h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.text-h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.3px; }
.text-body { font-size: 14px; color: var(--text-secondary); }
.text-caption { font-size: 12px; color: var(--text-tertiary); }
.text-amount-lg { font-size: 32px; font-weight: 800; letter-spacing: -1px; }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }

.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-row { display: flex; align-items: center; gap: 12px; }

.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-primary { color: var(--color-primary); }

/* =========================================
   4. COMPONENTS (Cards & Buttons)
========================================= */
/* Clean Minimal Cards (No drop shadows for premium look) */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    transition: transform 0.2s ease, background 0.3s ease;
}

.card:active { transform: scale(0.98); }

/* Primary CTA Button (Visually Strongest) */
.btn-primary {
    width: 100%;
    background: var(--color-primary);
    color: #FFFFFF;
    border: none;
    padding: 16px;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s, transform 0.2s;
}
.btn-primary:active { transform: scale(0.97); opacity: 0.9; }

/* =========================================
   5. NAVIGATION & FAB
========================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: 70px;
    background: var(--bg-surface);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border-color);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: color 0.3s;
}

.nav-item.active { color: var(--color-primary); }
.nav-item .material-symbols-rounded { font-size: 24px; }
.nav-item.active .material-symbols-rounded { font-variation-settings: 'FILL' 1; }

.fab {
    position: fixed;
    bottom: 90px;
    right: max(20px, calc(50vw - 220px));
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #FFFFFF;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.3);
    cursor: pointer;
    z-index: 90;
    transition: transform 0.2s;
}
.fab:active { transform: scale(0.9); }
.fab .material-symbols-rounded { font-size: 28px; }

/* =========================================
   6. VIEWS & BOTTOM SHEET (Menu)
========================================= */
.view-section {
    display: none;
    padding: 24px 20px;
    animation: fadeIn 0.3s ease-out;
}
.view-section.active { display: block; }

.bottom-sheet-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transition: opacity 0.3s;
}
.bottom-sheet-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.bottom-sheet {
    background: var(--bg-surface);
    border-radius: 24px 24px 0 0;
    padding: 24px;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 90vh;
    overflow-y: auto;
}
.bottom-sheet-overlay.hidden .bottom-sheet {
    transform: translateY(100%);
}

.sheet-handle {
    width: 40px; height: 5px;
    background: var(--border-color);
    border-radius: 3px;
    margin: -10px auto 20px auto;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   7. GLOBAL INPUT & FORM FIX 
========================================= */
input, select, textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary) !important;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color-scheme: dark; 
    transition: border-color 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

[data-theme="light"] input, 
[data-theme="light"] select, 
[data-theme="light"] textarea {
    color-scheme: light;
}

input::placeholder, textarea::placeholder {
    color: var(--text-tertiary) !important;
    opacity: 1;
}