/* Mobile-first CSS for Personal Finance App */

/* PWA Update Notification Styles */
.pwa-update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 350px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-update-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.pwa-update-notification.hiding {
    opacity: 0;
    transform: translateX(100%);
}

.update-content {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.update-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.update-text {
    flex-grow: 1;
}

.update-text strong {
    color: #0f3460;
    font-size: 14px;
    display: block;
    margin-bottom: 2px;
}

.update-details {
    color: #666;
    font-size: 12px;
    line-height: 1.3;
}

.update-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.update-actions .btn {
    font-size: 12px;
    padding: 4px 12px;
}

/* Dark mode updates */
[data-bs-theme="dark"] .pwa-update-notification {
    background: rgba(42, 42, 80, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .update-text strong {
    color: #4dabf7;
}

[data-bs-theme="dark"] .update-details {
    color: #adb5bd;
}

/* PWA Install Button */
.pwa-install-btn {
    white-space: nowrap;
    font-size: 12px;
}

/* Mobile PWA notification adjustments */
@media (max-width: 768px) {
    .pwa-update-notification {
        left: 10px;
        right: 10px;
        max-width: none;
        top: 70px;
    }
    
    .update-content {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .update-actions {
        justify-content: center;
        margin-top: 12px;
    }
}

/* CSS Variables for Glassmorphism Light/Dark Mode */
:root {
    /* Light theme improved contrast */
    --bg-primary: rgba(255, 255, 255, 0.8);
    --bg-secondary: rgba(248, 249, 250, 0.95);
    --bg-tertiary: rgba(233, 236, 239, 0.9);
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow: rgba(0, 0, 0, 0.15);
    --shadow-lg: rgba(0, 0, 0, 0.25);
    --card-bg: rgba(255, 255, 255, 0.85);
    --nav-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.08);
    --success: #198754;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #0dcaf0;
    --primary: #0d6efd;
    
    /* Glassmorphism specific - reduced for better clarity */
    --blur-strength: 10px;
    --glass-opacity: 0.85;
    --backdrop-brightness: 1.1;
}

[data-bs-theme="dark"] {
    /* Dark theme glassmorphism colors */
    --bg-primary: rgba(33, 37, 41, 0.4);
    --bg-secondary: rgba(52, 58, 64, 0.8);
    --bg-tertiary: rgba(73, 80, 87, 0.6);
    --text-primary: #ffffff;
    --text-secondary: #e9ecef;
    --text-muted: #adb5bd;
    --border-color: rgba(255, 255, 255, 0.15);
    --shadow: rgba(0, 0, 0, 0.4);
    --shadow-lg: rgba(0, 0, 0, 0.6);
    --card-bg: rgba(33, 37, 41, 0.4);
    --nav-bg: rgba(33, 37, 41, 0.2);
    --glass-border: rgba(255, 255, 255, 0.15);
    --success: #198754;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #0dcaf0;
    --primary: #0d6efd;
    
    /* Glassmorphism specific for dark mode */
    --blur-strength: 20px;
    --glass-opacity: 0.4;
    --backdrop-brightness: 0.8;
}

/* Base styles with glassmorphism background */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, 
        rgba(59, 130, 246, 0.1) 0%, 
        rgba(147, 51, 234, 0.1) 25%, 
        rgba(236, 72, 153, 0.1) 50%, 
        rgba(251, 146, 60, 0.1) 75%, 
        rgba(34, 197, 94, 0.1) 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    transition: all 0.3s ease;
    min-height: 100vh;
}

[data-bs-theme="dark"] body {
    background: linear-gradient(135deg, 
        rgba(17, 24, 39, 0.95) 0%, 
        rgba(31, 41, 55, 0.95) 25%, 
        rgba(55, 65, 81, 0.95) 50%, 
        rgba(75, 85, 99, 0.95) 75%, 
        rgba(17, 24, 39, 0.95) 100%);
    background-attachment: fixed;
}

/* Enhanced Dark mode toggle with micro-interactions */
.theme-toggle {
    border: none;
    background: none;
    color: inherit;
    font-size: 1.1rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.theme-toggle:hover {
    background-color: var(--bg-tertiary);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-toggle:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* Theme toggle icon animations */
.theme-toggle i {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
}

/* Ripple animation for theme toggle */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* Theme transition overlay for smooth switching */
.theme-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, 
                rgba(255, 255, 255, 0.1) 0%, 
                rgba(0, 0, 0, 0.05) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease-out;
    z-index: 9999;
}

.theme-transition-overlay.active {
    opacity: 1;
}

/* Enhanced theme toggle for dark mode */
[data-bs-theme="dark"] .theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

/* Smooth page transitions during theme change */
body {
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Cards and elements smooth theme transition */
.card,
.navbar,
.bottom-nav,
.modal-content,
.form-control,
.btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Add glow effect to theme toggle when switching */
.theme-toggle.switching {
    box-shadow: 0 0 20px var(--primary),
                0 0 40px var(--primary),
                0 0 60px var(--primary);
    animation: glow-pulse 0.6s ease-out;
}

@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 5px var(--primary);
    }
    50% {
        box-shadow: 0 0 20px var(--primary),
                    0 0 40px var(--primary);
    }
}

/* Navigation adjustments */
.main-content {
    padding-top: 76px; /* Account for fixed navbar */
    padding-bottom: 80px; /* Account for sticky bottom navigation */
    padding-left: 15px; /* Add left margin/padding */
    padding-right: 15px; /* Add right margin/padding */
}

/* Desktop gets more padding for better breathing room */
@media (min-width: 992px) {
    .main-content {
        padding-left: 30px;
        padding-right: 30px;
    }
}

/* Extra large screens get even more padding */
@media (min-width: 1400px) {
    .main-content {
        padding-left: 50px;
        padding-right: 50px;
    }
}

/* Glassmorphism Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(var(--blur-strength));
    -webkit-backdrop-filter: blur(var(--blur-strength));
    border-top: 1px solid var(--glass-border);
    z-index: 1030;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

[data-bs-theme="dark"] .bottom-nav {
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
}

.bottom-nav .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    min-height: 60px;
    justify-content: center;
    font-size: 0.75rem;
    border-radius: 0;
    transition: color 0.3s ease, background-color 0.3s ease;
}

/* Desktop navbar active state */
.navbar .nav-link.active {
    color: var(--primary) !important;
    background-color: rgba(13, 110, 253, 0.1);
    border-radius: 0.375rem;
}

[data-bs-theme="dark"] .navbar .nav-link.active {
    color: #ffffff !important;
    background-color: rgba(13, 110, 253, 0.2);
}

.bottom-nav .nav-link.active {
    color: var(--primary);
    background-color: rgba(13, 110, 253, 0.1);
}

.bottom-nav .nav-link i {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

@media (min-width: 992px) {
    .bottom-nav {
        display: none;
    }
    
    .main-content {
        padding-bottom: 0;
    }
}

/* Landing page styles */
.landing-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.hero-content {
    animation: fadeInUp 0.8s ease-out;
}

.hero-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 50%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Navbar logo styling */
.navbar-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 50%;
}

/* New improved login page styles */
.login-hero-new {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0;
}

.login-card-new {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: 100%;
}

.login-logo-small {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Form improvements */
.login-card-new h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
}

.login-card-new .small {
    font-size: 0.85rem;
}

.login-card-new .form-control {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin-bottom: 1rem;
}

.login-card-new .btn {
    padding: 0.75rem;
    font-size: 1rem;
    border-radius: 8px;
    font-weight: 500;
}

/* Legacy login styles (keeping for backwards compatibility) */
.login-hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem 0;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.hero-icon {
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.9);
}

.features-grid .feature-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.features-grid .feature-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
}

.feature-card h6 {
    margin: 0;
    font-weight: 600;
}

.landing-features {
    padding: 4rem 0;
    background: white;
}

.feature-detail {
    text-align: center;
    padding: 2rem 1rem;
}

.feature-icon-wrapper {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    color: white;
    font-size: 1.8rem;
}

/* Glassmorphism Card Styling */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur-strength));
    -webkit-backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem; /* Add space between cards */
}

/* Prevent cards from touching edges on hover */
.card:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 48px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    /* Ensure cards don't expand beyond safe area */
    max-width: calc(100% - 10px);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    opacity: 0.6;
}

.card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.3);
}

[data-bs-theme="dark"] .card:hover {
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #6610f2 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #198754 0%, #20c997 100%);
}

/* Glassmorphism Button Styling */
.btn {
    border-radius: 1rem;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: rgba(13, 110, 253, 0.8);
    border-color: rgba(13, 110, 253, 0.4);
    color: white;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
}

.btn-primary:hover {
    background: rgba(13, 110, 253, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(13, 110, 253, 0.4);
}

.btn-outline-primary {
    background: rgba(13, 110, 253, 0.1);
    border-color: rgba(13, 110, 253, 0.4);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background: rgba(13, 110, 253, 0.8);
    color: white;
    transform: translateY(-2px);
}

.btn-sm {
    min-height: 44px;
    padding: 0.5rem 1rem;
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    min-height: 56px;
}

@media (max-width: 768px) {
    .btn {
        min-height: 48px;
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
    }
    
    .btn-lg {
        min-height: 56px;
        font-size: 1.1rem;
    }
    
    .btn-sm {
        min-height: 44px;
        font-size: 0.9rem;
    }
}

/* Progress bars */
.progress {
    border-radius: 1rem;
    background-color: rgba(0, 0, 0, 0.05);
}

.progress-bar {
    border-radius: 1rem;
    transition: width 0.6s ease;
}

/* List groups for mobile */
.list-group-item {
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem;
}

.list-group-item:last-child {
    border-bottom: none;
}

/* Floating Action Button */
.fab-container {
    position: fixed;
    bottom: 90px;
    right: 16px;
    z-index: 1050;
}

.fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: rgba(13, 110, 253, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 6px 24px rgba(13, 110, 253, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
}

.fab:hover {
    transform: translateY(-4px) scale(1.1);
    box-shadow: 
        0 15px 40px rgba(13, 110, 253, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: rgba(13, 110, 253, 0.9);
    color: white;
}

.fab:active {
    transform: translateY(-2px) scale(1.05);
}

/* Modal optimizations for mobile */
@media (max-width: 576px) {
    .modal-dialog-bottom {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        max-width: none;
    }
    
    .modal-dialog-bottom .modal-content {
        border-radius: 1rem 1rem 0 0;
        border: none;
        max-height: 80vh;
        overflow-y: auto;
    }
}

/* Glassmorphism Form Controls */
.form-control,
.form-select {
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    transition: all 0.4s ease;
    min-height: 44px;
    background: var(--bg-primary);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(13, 110, 253, 0.5);
    box-shadow: 
        0 0 0 0.25rem rgba(13, 110, 253, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    background: var(--bg-primary);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.form-control-lg,
.form-select-lg {
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
    min-height: 56px;
}

/* Number input optimizations for mobile */
input[type="number"].amount-input {
    font-size: 1.5rem;
    text-align: center;
    font-weight: bold;
}

@media (max-width: 768px) {
    input[type="number"].amount-input {
        font-size: 2rem;
        min-height: 60px;
    }
    
    .form-control,
    .form-select {
        font-size: 1rem;
        min-height: 48px;
    }
    
    .form-control-lg,
    .form-select-lg {
        font-size: 1.1rem;
        min-height: 56px;
    }
}

/* Table responsiveness */
@media (max-width: 768px) {
    .table-responsive {
        border: none;
    }
    
    .table td,
    .table th {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }
}

/* Badge styling */
.badge {
    font-weight: 600;
    padding: 0.5em 0.75em;
    border-radius: 0.5rem;
}

/* Alert enhancements */
.alert {
    border: none;
    border-radius: 0.75rem;
    font-weight: 500;
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Utility classes */
.min-width-0 {
    min-width: 0;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Chart containers */
.chart-container {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

/* Status indicators */
.status-good {
    color: #198754;
}

.status-warning {
    color: #fd7e14;
}

.status-danger {
    color: #dc3545;
}

/* Responsive text */
@media (max-width: 576px) {
    .display-4 {
        font-size: 2.5rem;
    }
    
    .lead {
        font-size: 1.1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Dark mode friendly shadows */
.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Improved focus indicators for accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

}

/* Mobile keyboard optimizations */
@media (max-width: 768px) {
    .modal-body {
        padding-bottom: 2rem;
    }
    
    /* Prevent zoom on input focus on iOS */
    input[type="number"],
    input[type="text"],
    select {
        font-size: 16px !important;
    }
}

/* Print styles */
@media print {
    .fab-container,
    .navbar,
    .bottom-nav,
    .btn,
    .modal {
        display: none !important;
    }
    
    .main-content {
        padding-top: 0;
        padding-bottom: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}

/* Glassmorphism Navigation */
.navbar {
    background: var(--nav-bg) !important;
    backdrop-filter: blur(var(--blur-strength));
    -webkit-backdrop-filter: blur(var(--blur-strength));
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

[data-bs-theme="dark"] .navbar {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Force navbar text visibility - comprehensive fix */
.navbar-light .navbar-nav .nav-link,
.navbar-expand-lg .navbar-nav .nav-link,
.navbar .navbar-nav .nav-link {
    color: #212529 !important;
}

/* Ensure theme toggle button is visible */
.theme-toggle {
    color: #212529 !important;
}

/* Fix navbar brand (logo) visibility - strongest selectors */
.navbar .navbar-brand,
.navbar-light .navbar-brand,
.navbar-dark .navbar-brand,
.navbar-expand-lg .navbar-brand,
body .navbar-brand,
html body .navbar-brand {
    color: #212529 !important;
    font-weight: bold;
    text-decoration: none;
}

/* Subtle hamburger menu - just clean lines without border */
.navbar .navbar-toggler,
.navbar-light .navbar-toggler,
.navbar-dark .navbar-toggler,
.navbar-expand-lg .navbar-toggler,
body .navbar-toggler,
html body .navbar-toggler,
.navbar-toggler {
    border: none !important;
    border-color: transparent !important;
    background-color: transparent !important;
    padding: 0.25rem 0.5rem !important;
    box-shadow: none !important;
    outline: none !important;
}

.navbar-toggler:focus {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.navbar .navbar-toggler-icon,
.navbar-light .navbar-toggler-icon,
.navbar-dark .navbar-toggler-icon,
.navbar-expand-lg .navbar-toggler-icon,
body .navbar-toggler-icon,
html body .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23212529' stroke-linecap='round' stroke-miterlimit='10' stroke-width='3' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
    opacity: 1 !important;
    filter: none !important;
    width: 1.5em !important;
    height: 1.5em !important;
}

.navbar .nav-link {
    transition: color 0.3s ease;
}

.navbar .nav-link:hover,
.navbar .navbar-nav .nav-link:hover {
    color: var(--primary) !important;
}

/* Force proper text contrast in light mode - stronger selectors */
.navbar-expand-lg .navbar-nav .nav-link,
.navbar .navbar-nav .nav-link,
[data-bs-theme="light"] .navbar .nav-link,
:root .navbar .nav-link {
    color: #212529 !important;
}

/* Dark mode navigation text */
[data-bs-theme="dark"] .navbar .navbar-nav .nav-link,
[data-bs-theme="dark"] .navbar .nav-link,
[data-bs-theme="dark"] .navbar-light .navbar-nav .nav-link {
    color: #ffffff !important;
}

/* Dark mode theme toggle */
[data-bs-theme="dark"] .theme-toggle {
    color: #ffffff !important;
}

/* Dark mode navbar brand and toggler - strongest selectors */
[data-bs-theme="dark"] .navbar .navbar-brand,
[data-bs-theme="dark"] .navbar-light .navbar-brand,
[data-bs-theme="dark"] .navbar-dark .navbar-brand,
[data-bs-theme="dark"] .navbar-expand-lg .navbar-brand,
[data-bs-theme="dark"] body .navbar-brand,
[data-bs-theme="dark"] html body .navbar-brand {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .navbar .navbar-toggler,
[data-bs-theme="dark"] .navbar-light .navbar-toggler,
[data-bs-theme="dark"] .navbar-dark .navbar-toggler,
[data-bs-theme="dark"] .navbar-expand-lg .navbar-toggler,
[data-bs-theme="dark"] body .navbar-toggler,
[data-bs-theme="dark"] html body .navbar-toggler,
[data-bs-theme="dark"] .navbar-toggler {
    border: none !important;
    border-color: transparent !important;
    background-color: transparent !important;
    padding: 0.25rem 0.5rem !important;
    box-shadow: none !important;
    outline: none !important;
}

[data-bs-theme="dark"] .navbar-toggler:focus {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

[data-bs-theme="dark"] .navbar .navbar-toggler-icon,
[data-bs-theme="dark"] .navbar-light .navbar-toggler-icon,
[data-bs-theme="dark"] .navbar-dark .navbar-toggler-icon,
[data-bs-theme="dark"] .navbar-expand-lg .navbar-toggler-icon,
[data-bs-theme="dark"] body .navbar-toggler-icon,
[data-bs-theme="dark"] html body .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-miterlimit='10' stroke-width='3' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
    opacity: 1 !important;
    filter: none !important;
    width: 1.5em !important;
    height: 1.5em !important;
}

.navbar .dropdown-menu {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
}

.navbar .dropdown-item {
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Light mode dropdown text */
[data-bs-theme="light"] .navbar .dropdown-item,
:root .navbar .dropdown-item {
    color: #212529;
}

[data-bs-theme="light"] .navbar .dropdown-item:hover,
:root .navbar .dropdown-item:hover {
    color: #212529;
}

/* Dark mode dropdown text */
[data-bs-theme="dark"] .navbar .dropdown-item {
    color: var(--text-primary);
}

[data-bs-theme="dark"] .navbar .dropdown-item:hover {
    color: var(--text-primary);
}

/* Dark mode button styles */
[data-bs-theme="dark"] .btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
    background-color: transparent;
}

[data-bs-theme="dark"] .btn-outline-primary:hover,
[data-bs-theme="dark"] .btn-outline-primary:focus {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

[data-bs-theme="dark"] .btn-outline-primary.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white !important;
}

/* Light mode button active state */
.btn-outline-primary.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white !important;
}

/* Fix button group text visibility */
[data-bs-theme="dark"] .btn-group .btn-outline-primary {
    color: #ffffff !important;
    border-color: var(--primary);
}

[data-bs-theme="dark"] .btn-group .btn-outline-primary.active {
    background-color: var(--primary);
    color: white !important;
}

/* Glassmorphism Modal Styles */
.modal-content {
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur-strength));
    -webkit-backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.modal-header {
    border-bottom: 1px solid var(--glass-border);
    border-radius: 1.5rem 1.5rem 0 0;
    background: rgba(255, 255, 255, 0.05);
}

.modal-footer {
    border-top: 1px solid var(--glass-border);
    border-radius: 0 0 1.5rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
}

.modal-backdrop {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

[data-bs-theme="dark"] .modal-content {
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Dark mode alert styles */
[data-bs-theme="dark"] .alert {
    border: 1px solid var(--border-color);
}

/* Dark mode chart background and text */
[data-bs-theme="dark"] .chart-container {
    background-color: var(--card-bg);
}

/* Dark mode text elements */
[data-bs-theme="dark"] .text-muted {
    color: #adb5bd !important;
}

[data-bs-theme="dark"] .text-secondary {
    color: #adb5bd !important;
}

[data-bs-theme="dark"] h1, 
[data-bs-theme="dark"] h2, 
[data-bs-theme="dark"] h3, 
[data-bs-theme="dark"] h4, 
[data-bs-theme="dark"] h5, 
[data-bs-theme="dark"] h6 {
    color: var(--text-primary) !important;
}

/* Chart legend styling fixes */
[data-bs-theme="dark"] canvas {
    filter: none !important;
}

/* Ensure all small text is visible in dark mode */
[data-bs-theme="dark"] small {
    color: #adb5bd !important;
}

/* Glassmorphism Progress Bar Styling */
.progress {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    border-radius: 1rem;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.progress-bar.bg-success {
    background: linear-gradient(135deg, var(--success), #20c997);
    box-shadow: 0 4px 15px rgba(25, 135, 84, 0.3);
}

.progress-bar.bg-warning {
    background: linear-gradient(135deg, var(--warning), #ffd43b);
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

.progress-bar.bg-danger {
    background: linear-gradient(135deg, var(--danger), #ea868f);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

[data-bs-theme="dark"] .progress {
    background: rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Chat Interface Styles */
.chat-message {
    animation: fadeInUp 0.3s ease-out;
}

.chat-message .user-message {
    margin-left: 20%;
}

.chat-message .ai-message {
    margin-right: 20%;
}

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

#chatContainer {
    min-height: 150px;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--glass-border);
}

.suggested-question {
    font-size: 0.875rem;
    border-radius: 20px;
    transition: all 0.2s ease;
    border: 1px solid var(--glass-border);
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur-strength));
}

.suggested-question:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--shadow);
    background: var(--bg-secondary);
}

/* Dark mode chat styles */
[data-bs-theme="dark"] #chatContainer {
    background: var(--card-bg);
    border-color: var(--glass-border);
}

[data-bs-theme="dark"] .chat-message .bg-light {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary);
}

[data-bs-theme="dark"] .suggested-question {
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--glass-border);
}

[data-bs-theme="dark"] .suggested-question:hover {
    background: var(--bg-secondary);
}

/* AI Error Message Styling */
.ai-message .bg-light {
    position: relative;
}

.ai-message .bg-light strong {
    display: block;
    margin-bottom: 0.5rem;
}

.ai-message .bg-light a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.ai-message .bg-light a:hover {
    text-decoration: underline;
}

/* AI Unavailable Indicator */
.ai-unavailable {
    opacity: 0.7;
    position: relative;
}

.ai-unavailable::before {
    content: "🚫";
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.8rem;
    z-index: 1;
}

/* Text contrast improvements for better readability */
.text-white-75 {
    color: rgba(255, 255, 255, 0.85) !important;
}

[data-bs-theme="dark"] .text-white-75 {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Net Worth card text improvements */
.bg-gradient-success .text-white-75 {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Responsive chat adjustments */
@media (max-width: 576px) {
    .chat-message .user-message {
        margin-left: 5%;
    }
    
    .chat-message .ai-message {
        margin-right: 5%;
    }
    
    .suggested-question {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}


/* Layout spacing improvements for better margins and breathing room */
.container-fluid {
    padding-left: max(15px, env(safe-area-inset-left));
    padding-right: max(15px, env(safe-area-inset-right));
}

/* Better spacing for mobile screens */
@media (max-width: 768px) {
    .main-content {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .card {
        margin-left: 5px;
        margin-right: 5px;
    }
    
    .card:hover {
        max-width: calc(100% - 10px);
        margin-left: 5px;
        margin-right: 5px;
    }
}

/* Tablet spacing improvements */
@media (min-width: 768px) and (max-width: 991px) {
    .main-content {
        padding-left: 20px;
        padding-right: 20px;
    }
}

/* Prevent elements from touching screen edges */
.row {
    margin-left: -8px;
    margin-right: -8px;
}

.row > * {
    padding-left: 8px;
    padding-right: 8px;
}

/* Improved card spacing */
.mb-4, .my-4 {
    margin-bottom: 2rem !important;
}

/* ============================================
   IMPROVED LOGIN FORM STYLING
   ============================================ */

/* Beautiful login page with better UX */
.login-hero-new {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 2rem 0;
}

.login-card-new {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 3rem 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    max-width: 400px;
    width: 100%;
}

.login-card-new h2 {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-card-new .text-muted {
    color: #6c757d !important;
    margin-bottom: 2rem;
}

.login-card-new .form-control {
    border-radius: 12px;
    padding: 1rem;
    border: 2px solid rgba(0, 0, 0, 0.1);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.login-card-new .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.login-card-new .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    padding: 1rem;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.login-card-new .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.login-card-new .form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

/* Dark theme support for login */
[data-bs-theme="dark"] .login-card-new {
    background: rgba(33, 37, 41, 0.95);
    color: #ffffff;
}

[data-bs-theme="dark"] .login-card-new h2 {
    color: #ffffff;
}

[data-bs-theme="dark"] .login-card-new .form-control {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

[data-bs-theme="dark"] .login-card-new .form-control::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

[data-bs-theme="dark"] .login-card-new .form-control:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: #667eea;
}

/* Mobile responsiveness for login */
@media (max-width: 576px) {
    .login-card-new {
        margin: 1rem;
        padding: 2rem 1.5rem;
        border-radius: 16px;
    }
    
    .login-hero-new {
        padding: 1rem 0;
    }
}

/* ============================================
   SWIPE TO DELETE ANIMATIONS
   ============================================ */

@media (max-width: 768px) {
    .btn-outline-danger[title*="Delete"],
    .expense-action-btn.text-danger[title*="Delete"] {
        display: none !important;
    }
}

/* ============================================
   IMPROVED LIGHT MODE VISIBILITY & CONTRAST
   ============================================ */

/* Enhanced card visibility in light mode */
[data-bs-theme="light"] .card {
    background-color: var(--card-bg) !important;
    backdrop-filter: blur(var(--blur-strength));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 
                0 1px 3px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* Enhanced button visibility in light mode */
[data-bs-theme="light"] .btn-outline-primary,
[data-bs-theme="light"] .btn-outline-secondary,
[data-bs-theme="light"] .btn-outline-success,
[data-bs-theme="light"] .btn-outline-info,
[data-bs-theme="light"] .btn-outline-warning,
[data-bs-theme="light"] .btn-outline-danger {
    border-width: 1.5px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Better form control visibility */
[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-select {
    border: 1.5px solid rgba(0, 0, 0, 0.15) !important;
    background-color: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15) !important;
}

/* Enhanced navbar in light mode */
[data-bs-theme="light"] .navbar {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

/* Better bottom nav visibility */
[data-bs-theme="light"] .bottom-nav {
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08) !important;
}

/* Enhanced glassmorphism cards */
[data-bs-theme="light"] .glassmorphism-card {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
}

/* Better list group visibility */
[data-bs-theme="light"] .list-group-item {
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    background-color: rgba(255, 255, 255, 0.8) !important;
}

/* Enhanced modal visibility */
[data-bs-theme="light"] .modal-content {
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
}

/* Better alert visibility */
[data-bs-theme="light"] .alert {
    border-width: 1px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

