/* ============================================
   HOSTEL MESS EXPENSE MANAGER - STYLES
   ============================================
   
   TABLE OF CONTENTS:
   1. CSS Variables & Root Settings
   2. Reset & Base Styles
   3. Authentication Styles
   4. App Layout Styles
   5. Header Styles
   6. Card Styles
   7. Form Styles
   8. Quick Stats Styles
   9. Tabs Styles
   10. Expense List Styles
   11. Charts Styles
   12. Modal Styles
   13. Footer Styles
   14. Utility Classes
   15. Animations
   16. Responsive Styles
   
   ============================================ */

/* ============================================
   1. CSS VARIABLES & ROOT SETTINGS
   ============================================ */
:root {
    /* Primary Colors */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    
    /* Background Colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    
    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    /* Border Colors */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    /* Status Colors */
    --color-red: #dc2626;
    --color-orange: #ea580c;
    --color-green: #16a34a;
    --color-blue: #2563eb;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Font Family */
    --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================
   2. RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============================================
   3. AUTHENTICATION STYLES
   ============================================ */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    padding: 20px;
    position: relative;
}

.auth-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.15) 0%, transparent 40%);
    pointer-events: none;
}

.auth-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 440px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.auth-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 30px;
    text-align: center;
    color: white;
}

.auth-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.auth-header p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.auth-body {
    padding: 30px;
}

.auth-message {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: 16px;
    display: none;
}

.auth-message.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--color-red);
}

.auth-message.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: var(--color-green);
}

.auth-message.show {
    display: block;
}

.auth-btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-btn.primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.auth-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.auth-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    margin-top: 12px;
}

.auth-btn.secondary:hover {
    background: var(--border-color);
}

.auth-btn.google {
    background: #ffffff;
    color: #374151;
    border: 2px solid #e5e7eb;
    margin-top: 12px;
}

.auth-btn.google:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.auth-btn.google svg {
    flex-shrink: 0;
}

.auth-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.auth-btn .btn-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.auth-btn.loading .btn-text {
    display: none;
}

.auth-btn.loading .btn-loader {
    display: inline-block;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    padding: 0 15px;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-switch a {
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.password-toggle:hover {
    opacity: 1;
}

/* Hide auth when logged in */
.auth-container.hidden {
    display: none;
}

/* ============================================
   4. APP LAYOUT STYLES
   ============================================ */
.app-container {
    display: none;
    min-height: 100vh;
    padding-bottom: 50px;
}

.app-container.show {
    display: block;
}

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.top-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* ============================================
   5. HEADER STYLES
   ============================================ */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 24px;
    box-shadow: var(--shadow-md);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.header-left p {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 2px;
}

.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 8px 16px;
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: white;
}

.user-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: white;
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.user-name {
    font-weight: 500;
}

.dropdown-arrow {
    font-size: 0.7rem;
    transition: transform var(--transition-fast);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    min-width: 220px;
    overflow: hidden;
    display: none;
    z-index: 100;
}

.user-dropdown.show {
    display: block;
    animation: slideDown 0.2s ease;
}

.dropdown-header {
    padding: 16px;
    background: var(--bg-tertiary);
}

.dropdown-name {
    font-weight: 600;
    color: var(--text-primary);
}

.dropdown-email {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
}

.dropdown-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
}

.dropdown-item.logout {
    color: var(--color-red);
}

/* ============================================
   6. CARD STYLES
   ============================================ */
.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

/* ============================================
   7. FORM STYLES
   ============================================ */
.expense-form-card {
    padding: 0;
}

.expense-form-card form {
    padding: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.required {
    color: var(--color-red);
}

.input-wrapper {
    position: relative;
}

.input-wrapper .input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    opacity: 0.6;
}

.input-wrapper input,
.input-wrapper textarea,
.input-wrapper select {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: all var(--transition-fast);
}

.input-wrapper textarea {
    resize: vertical;
    min-height: 60px;
}

.input-wrapper input:focus,
.input-wrapper textarea:focus,
.input-wrapper select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-wrapper input::placeholder,
.input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.submit-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.submit-btn .btn-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.submit-btn.loading .btn-text {
    display: none;
}

.submit-btn.loading .btn-loader {
    display: inline-block;
}

.form-message {
    margin: 16px 20px 20px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    display: none;
}

.form-message.success {
    display: block;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: var(--color-green);
}

.form-message.error {
    display: block;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--color-red);
}

.form-message.warning {
    display: block;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: var(--color-orange);
}

/* ============================================
   8. QUICK STATS STYLES
   ============================================ */
.quick-stats-card {
    padding: 0;
}

.stats-grid {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stat-item {
    padding: 16px;
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-item.today {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border: 1px solid #86efac;
}

.stat-item.month {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 1px solid #93c5fd;
}

.stat-item.entries {
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
    border: 1px solid #d8b4fe;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-item.today .stat-value {
    color: var(--color-green);
}

/* Dynamic color classes for Today's Spending based on limits */
.stat-item.today.stat-green {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border: 1px solid #86efac;
}

.stat-item.today.stat-green .stat-value {
    color: #16a34a;
}

.stat-item.today.stat-orange {
    background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
    border: 1px solid #fdba74;
}

.stat-item.today.stat-orange .stat-value {
    color: #ea580c;
}

.stat-item.today.stat-red {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 1px solid #f87171;
}

.stat-item.today.stat-red .stat-value {
    color: #dc2626;
}

.stat-item.month .stat-value {
    color: var(--color-blue);
}

.stat-item.entries .stat-value {
    color: #7c3aed;
}

/* Color classes for daily totals */
.color-red { color: var(--color-red) !important; }
.color-orange { color: var(--color-orange) !important; }
.color-green { color: var(--color-green) !important; }
.color-blue { color: var(--color-blue) !important; }

/* ============================================
   9. TABS STYLES
   ============================================ */
.tabs-card {
    padding: 0;
}

.tabs-header {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.tab-btn {
    flex: 1;
    padding: 16px 20px;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--bg-secondary);
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.tab-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
}

/* ============================================
   10. EXPENSE LIST STYLES
   ============================================ */
.expenses-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.empty-message {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
}

.expense-day-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
    border-left: 4px solid var(--color-green);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.expense-day-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.expense-day-card.red {
    border-left-color: var(--color-red);
}

.expense-day-card.orange {
    border-left-color: var(--color-orange);
}

.expense-day-card.green {
    border-left-color: var(--color-green);
}

.day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
}

.day-date {
    font-weight: 600;
    color: var(--text-primary);
}

.day-total {
    font-weight: 700;
    font-size: 1.1rem;
}

.expense-list {
    padding: 0;
}

.expense-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.expense-info {
    flex: 1;
}

.expense-desc {
    font-weight: 500;
    color: var(--text-primary);
}

.expense-comment {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.expense-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.expense-amount {
    font-weight: 600;
    color: var(--text-secondary);
}

.delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    opacity: 0.5;
    transition: all var(--transition-fast);
    font-size: 1rem;
}

.delete-btn:hover {
    opacity: 1;
    background: #fef2f2;
    color: var(--color-red);
}

/* Monthly View Specific */
.month-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.month-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.month-header:hover {
    background: var(--bg-tertiary);
}

.month-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.month-name {
    font-weight: 600;
    color: var(--text-primary);
}

.month-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.month-total {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-blue);
}

.chevron {
    transition: transform var(--transition-fast);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.chevron.rotated {
    transform: rotate(180deg);
}

.month-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
}

.month-content.expanded {
    max-height: 2000px;
}

.month-body {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.month-comment-section {
    margin-bottom: 16px;
}

.month-comment-section label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.comment-input-group {
    display: flex;
    gap: 10px;
}

.comment-input-group textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    resize: none;
    font-family: inherit;
}

.comment-input-group button {
    padding: 10px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.comment-input-group button:hover {
    background: var(--primary-dark);
}

/* ============================================
   11. CHARTS STYLES
   ============================================ */
.charts-section {
    background: var(--bg-secondary);
}

.charts-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.chart-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.control-group select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.control-btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--primary-color);
    color: white;
}

.control-btn:hover {
    background: var(--primary-dark);
}

.control-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.control-btn.secondary:hover {
    background: var(--border-color);
}

.month-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    margin-bottom: 20px;
}

.month-checkbox-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.85rem;
    font-weight: 500;
}

.month-checkbox-label:hover {
    border-color: var(--primary-light);
    background: #f5f3ff;
}

.month-checkbox-label input {
    margin-right: 6px;
}

.month-checkbox-label input:checked + span {
    color: var(--primary-color);
}

.chart-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    height: 400px;
}

.chart-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.summary-item {
    text-align: center;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.summary-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.summary-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* ============================================
   12. MODAL STYLES
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 400px;
    width: 100%;
    animation: modalSlide 0.3s ease;
    overflow: hidden;
}

.modal-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--color-red) 0%, #991b1b 100%);
    color: white;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.expense-preview {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 16px;
}

.preview-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-desc {
    font-weight: 600;
    color: var(--text-primary);
}

.preview-amount {
    font-weight: 700;
    color: var(--color-red);
}

.preview-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.warning-text {
    font-size: 0.85rem;
    color: var(--color-orange) !important;
    font-weight: 500;
}

.modal-footer {
    padding: 16px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-tertiary);
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-btn.cancel {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.modal-btn.cancel:hover {
    background: var(--border-color);
}

.modal-btn.delete {
    background: var(--color-red);
    color: white;
}

.modal-btn.delete:hover {
    background: #b91c1c;
}

.modal-btn .btn-loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.modal-btn.loading .btn-text {
    display: none;
}

.modal-btn.loading .btn-loader {
    display: inline-block;
}

/* Success Modal */
.success-modal {
    text-align: center;
    padding: 40px 30px;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 40px;
    color: white;
    animation: bounceIn 0.5s ease;
}

.success-modal h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.success-modal p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.success-modal .auth-btn {
    max-width: 200px;
    margin: 0 auto;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ============================================
   13. PROFILE PAGE STYLES
   ============================================ */
.profile-page {
    display: none;
    min-height: 100vh;
    background: var(--bg-primary);
}

.profile-page.show {
    display: block;
}

.profile-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px;
}

.profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.profile-header h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.back-btn {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.back-btn:hover {
    background: var(--primary-dark);
}

.profile-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.profile-avatar-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px;
    text-align: center;
    color: white;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    background: white;
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 auto 16px;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-section h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.profile-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 0.85rem;
}

.profile-badge.guest {
    background: rgba(251, 191, 36, 0.3);
}

.profile-badge.google {
    background: rgba(234, 67, 53, 0.3);
}

.profile-badge.email {
    background: rgba(59, 130, 246, 0.3);
}

.profile-info {
    padding: 24px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.info-value {
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    word-break: break-all;
}

/* ============================================
   14. FOOTER STYLES
   ============================================ */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #1e1e1e 0%, #2d2d2d 50%, #1e1e1e 100%);
    padding: 12px;
    text-align: center;
    border-top: 1px solid #404040;
    z-index: 50;
}

.app-footer p {
    font-size: 11px;
    color: #888;
    letter-spacing: 1px;
}

/* ============================================
   15. UTILITY CLASSES
   ============================================ */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

/* ============================================
   16. ANIMATIONS
   ============================================ */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ============================================
   17. RESPONSIVE STYLES
   ============================================ */
@media (max-width: 768px) {
    .top-section {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .header-left h1 {
        font-size: 1.2rem;
    }
    
    .user-name {
        display: none;
    }
    
    .tabs-header {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: none;
        width: 33.33%;
        padding: 12px;
        font-size: 0.85rem;
    }
    
    .tab-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .chart-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .chart-summary {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .day-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .expense-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .expense-actions {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .auth-card {
        border-radius: var(--radius-lg);
    }
    
    .auth-header {
        padding: 24px 20px;
    }
    
    .auth-body {
        padding: 20px;
    }
    
    .month-selector {
        grid-template-columns: repeat(3, 1fr);
    }
}
