/* ============================================
   GLOBAL STYLES - DARK THEME
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Dark Theme Color Palette */
    --bg-primary: #0a0e27;
    --bg-secondary: #141b2d;
    --bg-tertiary: #1a2332;
    --bg-card: #1e2a3a;
    --bg-hover: #253142;
    
    /* Accent Colors */
    --accent-teal: #00d4ff;
    --accent-teal-dark: #00a8cc;
    --accent-orange: #ff6b35;
    --accent-orange-dark: #e55a2b;
    --accent-red: #ff4757;
    --accent-red-dark: #ee3542;
    --accent-green: #2ed573;
    --accent-green-dark: #26c463;
    --accent-purple: #a55eea;
    --accent-blue: #5352ed;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #b8c5d1;
    --text-tertiary: #7a8a9a;
    --text-muted: #5a6775;
    
    /* Border & Shadow */
    --border-color: #2a3441;
    --border-hover: #3a4552;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.2);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-teal: linear-gradient(135deg, #00d4ff 0%, #00a8cc 100%);
    --gradient-orange: linear-gradient(135deg, #ff6b35 0%, #e55a2b 100%);
    --gradient-green: linear-gradient(135deg, #2ed573 0%, #26c463 100%);
    --gradient-red: linear-gradient(135deg, #ff4757 0%, #ee3542 100%);
    --gradient-bg: linear-gradient(135deg, #0a0e27 0%, #141b2d 50%, #1a2332 100%);
    
    /* Admin Panel Colors (Dark) */
    --admin-bg: #0d1117;
    --admin-card-bg: #161b22;
    --admin-text: #c9d1d9;
    --admin-text-light: #8b949e;
    --admin-border: #30363d;
    --admin-primary: #1f6feb;
    --admin-accent: #a55eea;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--gradient-bg);
    background-attachment: fixed;
    min-height: 100vh;
    transition: background var(--transition-normal);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 10;
}

/* Main app container */
#main-app {
    position: relative;
    z-index: 10;
    min-height: 1vh;
}

/* Page Views Routing System */
/* ============================================
   PAGE VIEW SYSTEM (STRUCTURAL)
   ============================================ */
.page-view {
    display: none !important;
    position: relative;
    z-index: 20;
    min-height: auto;
    background: transparent;
    opacity: 1;
    filter: none;
    margin-top: 0;
    padding-top: 0;
    height: auto;
}

.page-view.active {
    display: block !important;
    animation: fadeIn 0.3s ease;
}

.page-view.active > .page-view {
    display: block !important;
}

.page-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 10px 20px 40px 20px;
    position: relative;
    z-index: 10;
    background: transparent;
    margin-top: 0;
    min-height: auto;
}

/* About Page Styles */
.about-page-content {
    color: var(--text-primary);
    line-height: 1.8;
    background: transparent;
    position: relative;
    z-index: 10;
    opacity: 1;
    margin-top: 0;
    padding-top: 0;
    filter: none;
    width: 100%;
}

#view-about,
#view-contact,
#view-goals {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

#view-about .page-container,
#view-contact .page-container,
#view-goals .page-container {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.about-page-content h1 {
    font-size: 36px;
    margin-top: 0;
    margin-bottom: 12px;
    background: var(--gradient-teal);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.about-page-content .about-subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    margin-top: 0;
}

.about-page-content .about-section {
    margin-bottom: 28px;
    margin-top: 0;
}

.about-page-content .about-section:first-of-type {
    margin-top: 0;
}

.about-page-content .about-section h2 {
    font-size: 24px;
    margin-bottom: 16px;
    color: var(--accent-teal);
}

.about-page-content .about-section p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.about-page-content .about-section ul {
    margin-left: 24px;
    margin-bottom: 24px;
    color: var(--text-secondary);
}

.about-page-content .about-section ul li {
    margin-bottom: 8px;
}

.about-page-content .about-footer {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    color: var(--text-tertiary);
    text-align: center;
}

/* Level 8: Goals Page Styles */
.goal-status-completed {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.goal-status-ontrack {
    background: rgba(33, 150, 243, 0.2);
    color: #2196F3;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.goal-status-behind {
    background: rgba(255, 152, 0, 0.2);
    color: #ff9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

#goals-list-container {
    margin-top: 24px;
}

#goals-empty-state {
    margin-top: 24px;
}

/* Contact Page Styles */
.contact-page-content {
    color: var(--text-primary);
    background: transparent;
    position: relative;
    z-index: 10;
    opacity: 1;
    margin-top: 0;
    padding-top: 0;
    filter: none;
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.contact-page-header {
    text-align: center;
    margin-bottom: 48px;
    padding: 0 20px;
}

.contact-page-content h1 {
    font-size: 36px;
    margin-top: 0;
    margin-bottom: 12px;
    background: var(--gradient-teal);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.contact-page-subtitle {
    margin-top: 0;
    margin-bottom: 0;
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1.6;
}

.contact-page-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 32px;
    padding: 0 20px;
}

.contact-info-section {
    margin-top: 0;
    padding: 32px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    filter: none;
    opacity: 1;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.contact-info-section h2 {
    font-size: 24px;
    margin-top: 0;
    margin-bottom: 28px;
    color: var(--text-primary);
    font-weight: 600;
}

.contact-info-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-info-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: var(--bg-hover);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.contact-info-item:hover {
    background: var(--bg-card);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.contact-info-icon {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
}

.contact-info-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.contact-info-label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contact-link {
    color: var(--accent-teal);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: color var(--transition-fast);
    word-break: break-word;
}

.contact-link:hover {
    color: var(--accent-teal-hover);
    text-decoration: underline;
}

.contact-form-section {
    padding: 2.5rem;
    margin-top: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    max-width: 550px;
    margin-left: auto;
    margin-right: auto;
}

.contact-form-section h2 {
    font-size: 1.75rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 700;
    text-align: center;
}

.contact-form-section .form-field {
    margin-bottom: 1.25rem;
}

.contact-form-section .form-field label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
}

.contact-form-section .input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.contact-form-section .input:focus {
    outline: none;
    border-color: var(--accent-teal);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.contact-form-message {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: 12px;
    display: none;
    font-size: 0.875rem;
    line-height: 1.5;
}

.btn-submit {
    width: 100%;
    padding: 1rem;
    background: var(--gradient-teal);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 212, 255, 0.3);
}

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

/* Active navigation button */
.header-btn.active {
    background: var(--accent-teal);
    color: white;
    border-color: var(--accent-teal);
}

/* Spinning loader animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   RESPONSIVE BREAKPOINTS - COMPREHENSIVE
   ============================================ */

/* Extra Small Phones (320px - 359px) */
@media (max-width: 359px) {
    .container {
        padding: 8px;
        max-width: 100%;
    }
    
    .page-container {
        padding: 12px 8px;
        margin-top: 0;
    }
    
    .overview-card,
    .content-card {
        padding: 12px;
        min-width: 0;
    }
    
    .card-value {
        font-size: 18px;
        word-break: break-word;
    }
    
    .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        padding: 12px;
    }
    
    .header-btn {
        font-size: 12px;
        padding: 8px 12px;
        min-height: 40px;
        white-space: normal;
        word-break: break-word;
    }
    
    .logo-text h1 {
        font-size: 18px;
    }
    
    .section-title {
        font-size: 16px;
        word-break: break-word;
    }
    
    .savings-amount {
        font-size: 24px;
        word-break: break-word;
    }
    
    .chart-container {
        height: 180px;
        min-width: 0;
    }
    
    /* Prevent overflow on very small screens */
    .dashboard-cards,
    .flexible-categories-grid,
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    /* Optimize text wrapping */
    .card-label,
    .card-description,
    .section-subtitle,
    p {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
}

/* Small Phones (360px - 479px) */
@media (min-width: 360px) and (max-width: 479px) {
    .container {
        padding: 10px;
        max-width: 100%;
    }
    
    .page-container {
        padding: 14px 10px;
    }
    
    .overview-card,
    .content-card {
        padding: 14px;
    }
    
    .card-value {
        font-size: 20px;
    }
    
    .modal-content {
        width: 95%;
        padding: 16px;
    }
    
    .header-btn {
        font-size: 13px;
        padding: 10px 14px;
    }
}

/* Mobile responsiveness for page views */
@media (max-width: 768px) {
    .page-container {
        padding: 16px;
        margin-top: 0;
    }
    
    .page-view {
        margin-top: 0;
        padding-top: 0;
    }
    
    .about-page-content,
    .contact-page-content {
        margin-top: 0;
        padding-top: 0;
    }
    
    .about-page-content h1,
    .contact-page-content h1 {
        font-size: 28px;
        margin-top: 0;
        margin-bottom: 20px;
    }
    
    .contact-page-header {
        margin-bottom: 32px;
        padding: 0 16px;
    }
    
    .contact-page-subtitle {
        font-size: 16px;
    }
    
    .contact-page-layout {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 0 16px;
    }
    
    .about-page-content .about-section h2,
    .contact-info-section h2,
    .contact-form-section h2 {
        font-size: 20px;
        margin-top: 0;
        margin-bottom: 20px;
    }
    
    .contact-info-section,
    .contact-form-section {
        padding: 1.5rem;
        margin-top: 0;
    }
    
    .contact-info-grid {
        gap: 16px;
    }
    
    .contact-info-item {
        padding: 14px;
    }
    
    .contact-form-section .form-field {
        margin-bottom: 1rem;
    }
    
    .contact-form-actions .btn {
        width: 100%;
    }
    
    .about-page-content .about-section {
        margin-top: 24px;
        margin-bottom: 28px;
    }
    
    .about-page-content .about-section:first-of-type {
        margin-top: 0;
    }
}

/* Mobile-only polish: prevent horizontal scroll + improve wrapping without changing desktop */
@media (max-width: 768px) {
    .container,
    .page-container,
    .main-header,
    .dashboard-section,
    .content-card,
    .ai-chatbot-panel {
        max-width: 100%;
        overflow-x: hidden;
        /* Prevent layout shifts */
        min-width: 0;
    }
    .btn,
    .header-btn,
    .ai-chatbot-suggestion-btn {
        white-space: normal;
        word-break: break-word;
        /* Prevent text overflow */
        overflow-wrap: break-word;
    }
    /* Ensure all grid/flex containers respect viewport */
    .dashboard-cards,
    .flexible-categories-grid,
    .charts-grid,
    .main-content {
        min-width: 0;
        width: 100%;
    }
    /* Fix potential overflow in cards */
    .overview-card,
    .content-card {
        min-width: 0;
        overflow: hidden;
    }
}

/* ============================================
   USER WEBSITE STYLES - DARK THEME
   ============================================ */

.user-page {
    background: var(--gradient-bg);
    background-attachment: fixed;
    min-height: 100vh;
    position: relative;
}

.user-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(0, 212, 255, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(165, 94, 234, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 50% 20%, rgba(46, 213, 115, 0.03) 0%, transparent 50%),
                radial-gradient(circle at 0% 0%, rgba(83, 82, 237, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    animation: gradientShift 25s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% {
        background: radial-gradient(circle at 20% 50%, rgba(0, 212, 255, 0.05) 0%, transparent 50%),
                    radial-gradient(circle at 80% 80%, rgba(165, 94, 234, 0.05) 0%, transparent 50%),
                    radial-gradient(circle at 50% 20%, rgba(46, 213, 115, 0.03) 0%, transparent 50%),
                    radial-gradient(circle at 0% 0%, rgba(83, 82, 237, 0.02) 0%, transparent 50%);
    }
    33% {
        background:                     radial-gradient(circle at 80% 30%, rgba(0, 212, 255, 0.05) 0%, transparent 50%),
                    radial-gradient(circle at 20% 90%, rgba(165, 94, 234, 0.05) 0%, transparent 50%),
                    radial-gradient(circle at 60% 60%, rgba(46, 213, 115, 0.03) 0%, transparent 50%),
                    radial-gradient(circle at 100% 100%, rgba(83, 82, 237, 0.02) 0%, transparent 50%);
    }
    66% {
        background: radial-gradient(circle at 50% 70%, rgba(0, 212, 255, 0.05) 0%, transparent 50%),
                    radial-gradient(circle at 10% 20%, rgba(165, 94, 234, 0.05) 0%, transparent 50%),
                    radial-gradient(circle at 90% 40%, rgba(46, 213, 115, 0.03) 0%, transparent 50%),
                    radial-gradient(circle at 40% 80%, rgba(83, 82, 237, 0.02) 0%, transparent 50%);
    }
}

.user-page::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 212, 255, 0.005) 2px,
            rgba(0, 212, 255, 0.005) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(165, 94, 234, 0.005) 2px,
            rgba(165, 94, 234, 0.005) 4px
        );
    pointer-events: none;
    z-index: 0;
    opacity: 0.1;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

.user-page .container {
    position: relative;
    z-index: 10;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    margin-bottom: 32px;
    animation: fadeInDown 0.6s ease;
    position: relative;
    z-index: 100;
    flex-wrap: wrap;
    gap: 16px;
    background: transparent;
}

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

.logo-section {
    display: flex;
    align-items: center;
    gap: 14px;
}

.hero-logo-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: var(--shadow-glow);
    transition: transform var(--transition-fast);
    animation: pulse 2s ease-in-out infinite;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: var(--gradient-teal);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    box-shadow: var(--shadow-glow);
    transition: transform var(--transition-fast);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.logo-icon:hover,
.hero-logo-img:hover {
    transform: scale(1.1) rotate(5deg);
}

.logo-text h1 {
    font-size: 26px;
    font-weight: 700;
    background: var(--gradient-teal);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    letter-spacing: -0.5px;
}

.tagline {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.header-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition-fast);
    min-height: 44px; /* Touch-friendly tap target */
    white-space: nowrap;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.2s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.header-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-icon {
    font-size: 16px;
}

/* Section Title */
.section-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    letter-spacing: -0.3px;
}

/* Financial Overview Cards */
.dashboard-section {
    margin-bottom: 40px;
    animation: fadeInUp 0.6s ease 0.2s both;
    position: relative;
    z-index: 10;
}

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

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

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.overview-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    z-index: 10;
}

.overview-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-teal);
    transform: scaleX(0);
    transition: transform var(--transition-normal);
}

.overview-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.overview-card:hover::before {
    transform: scaleX(1);
}

.card-icon-wrapper {
    flex-shrink: 0;
}

.card-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    transition: transform var(--transition-fast);
}

.overview-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
}

.income-icon {
    background: var(--gradient-teal);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.expense-icon {
    background: var(--gradient-orange);
    color: white;
    font-weight: bold;
    font-size: 28px;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.flexible-icon {
    background: var(--gradient-green);
    color: white;
    box-shadow: 0 4px 12px rgba(46, 213, 115, 0.3);
}

.savings-icon {
    background: var(--gradient-red);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

.card-content {
    flex: 1;
}

.card-label {
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    font-weight: 600;
}

.card-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.card-description {
    font-size: 13px;
    color: var(--text-secondary);
}

.income-card::before {
    background: var(--gradient-teal);
}

.expense-card::before {
    background: var(--gradient-orange);
}

.flexible-card::before {
    background: var(--gradient-green);
}

.savings-card::before {
    background: var(--gradient-red);
}

/* Main Content - Two Column Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
    animation: fadeInUp 0.6s ease 0.4s both;
}

/* Mobile-first: stack columns on small screens */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.left-column,
.right-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Content Cards */
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    position: relative;
    z-index: 10;
}

.content-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.section-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.content-card:hover .section-icon {
    transform: scale(1.1) rotate(5deg);
}

.income-section-icon {
    background: var(--gradient-teal);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.fixed-section-icon {
    background: var(--gradient-orange);
    color: white;
    font-weight: bold;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.flexible-section-icon {
    background: var(--gradient-green);
    color: white;
    font-weight: bold;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(46, 213, 115, 0.3);
}

.savings-section-icon {
    background: var(--gradient-red);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

.affordability-icon {
    background: var(--gradient-green);
    color: white;
    box-shadow: 0 4px 12px rgba(46, 213, 115, 0.3);
}

.section-header-text {
    flex: 1;
}

.section-header-text h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.section-amount {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
}

.status-tag {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: auto;
    transition: all var(--transition-fast);
}

.savings-section.zero .status-tag,
.savings-section.critical .status-tag {
    background: var(--gradient-red);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.3);
}

.savings-section.low .status-tag {
    background: var(--gradient-orange);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.savings-section.healthy .status-tag {
    background: var(--gradient-green);
    color: white;
    box-shadow: 0 2px 8px rgba(46, 213, 115, 0.3);
}

.savings-section.very-low .status-tag {
    background: var(--gradient-orange);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

/* Empty State */
.empty-state {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 14px;
    margin-bottom: 20px;
    background: rgba(30, 42, 58, 0.5);
    transition: all var(--transition-fast);
}

.empty-state:hover {
    border-color: var(--border-hover);
    background: rgba(30, 42, 58, 0.7);
}

/* Income/Expense Items List */
.income-items-list,
.expense-items-list {
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.income-items-list::-webkit-scrollbar,
.expense-items-list::-webkit-scrollbar {
    width: 6px;
}

.income-items-list::-webkit-scrollbar-track,
.expense-items-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.income-items-list::-webkit-scrollbar-thumb,
.expense-items-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.income-items-list::-webkit-scrollbar-thumb:hover,
.expense-items-list::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

.income-item,
.expense-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all var(--transition-fast);
}

.income-item:hover,
.expense-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    transform: translateX(4px);
}

.item-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    gap: 16px;
}

.item-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.item-amount {
    color: var(--accent-teal);
    font-weight: 700;
    font-size: 15px;
}

.delete-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0 10px;
    line-height: 1;
    transition: all var(--transition-fast);
    border-radius: 4px;
}

.delete-btn:hover {
    color: var(--accent-red);
    background: rgba(255, 71, 87, 0.1);
    transform: scale(1.2);
}

/* Add Buttons */
.add-btn {
    width: 100%;
    padding: 14px;
    background: var(--gradient-green);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(46, 213, 115, 0.3);
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(46, 213, 115, 0.4);
}

.add-btn:active {
    transform: translateY(0);
}

.add-icon {
    font-size: 20px;
    font-weight: 300;
}

.expense-add-btn {
    background: var(--bg-secondary);
    color: var(--accent-green);
    border: 2px solid var(--accent-green);
    box-shadow: none;
}

.expense-add-btn:hover {
    background: rgba(46, 213, 115, 0.1);
    box-shadow: 0 4px 12px rgba(46, 213, 115, 0.2);
}

/* Section Subtitle */
.section-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

/* Flexible Spending Categories */
.flexible-categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* Desktop/Laptop: Show 4 separate cards in 2x2 grid */
@media (min-width: 769px) {
    .flexible-categories-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Mobile/Small screens: Stack to 1 column */
@media (max-width: 768px) {
    .flexible-categories-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.category-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all var(--transition-fast);
}

.category-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.category-icon {
    font-size: 36px;
    margin-bottom: 12px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.category-card label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.currency-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol {
    position: absolute;
    left: 14px;
    color: var(--text-secondary);
    font-weight: 600;
    z-index: 1;
}

.currency-input {
    width: 100%;
    padding: 12px 14px 12px 32px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.currency-input:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(46, 213, 115, 0.1);
}

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

/* Savings Section */
.savings-content {
    margin-bottom: 28px;
}

.savings-amount {
    font-size: 42px;
    font-weight: 800;
    color: var(--accent-red);
    margin-bottom: 14px;
    letter-spacing: -1px;
    text-shadow: 0 2px 8px rgba(255, 71, 87, 0.3);
}

.savings-section.healthy .savings-amount {
    color: var(--accent-green);
    text-shadow: 0 2px 8px rgba(46, 213, 115, 0.3);
}

.savings-section.low .savings-amount {
    color: var(--accent-orange);
    text-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.savings-warning {
    font-size: 14px;
    color: var(--accent-red);
    line-height: 1.6;
}

.savings-section.healthy .savings-warning {
    color: var(--accent-green);
}

.savings-section.low .savings-warning {
    color: var(--accent-orange);
}

.savings-rate-section {
    margin-top: 28px;
}

.savings-rate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.target-rate {
    color: var(--text-tertiary);
}

.progress-bar-container {
    width: 100%;
    height: 28px;
    background: var(--bg-secondary);
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
}

.progress-bar {
    height: 100%;
    background: var(--gradient-red);
    border-radius: 14px;
    transition: width var(--transition-slow), background var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 10px;
    min-width: 50px;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.3);
}

.savings-section.healthy .progress-bar {
    background: var(--gradient-green);
    box-shadow: 0 2px 8px rgba(46, 213, 115, 0.3);
}

.savings-section.low .progress-bar {
    background: var(--gradient-orange);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.progress-text {
    font-size: 11px;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Affordability Tool */
.affordability-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: stretch;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.purchase-type-buttons {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.purchase-type-btn {
    padding: 18px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.purchase-type-btn:hover {
    border-color: var(--accent-green);
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.purchase-type-btn.active {
    border-color: var(--accent-green);
    background: rgba(46, 213, 115, 0.1);
    box-shadow: 0 0 0 3px rgba(46, 213, 115, 0.1);
}

.purchase-type-btn {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.type-description {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
}

.check-affordability-btn {
    width: 100%;
    padding: 16px;
    background: var(--gradient-green);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(46, 213, 115, 0.3);
    letter-spacing: 0.3px;
}

.check-affordability-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(46, 213, 115, 0.4);
}

.check-affordability-btn:active {
    transform: translateY(0);
}

.check-affordability-btn:disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.check-affordability-btn:disabled:hover {
    transform: none !important;
    box-shadow: 0 4px 12px rgba(46, 213, 115, 0.3);
}

.affordability-result {
    margin-top: 24px;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.affordability-result-box {
    padding: 24px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid;
    animation: slideInUp 0.4s ease;
}

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

.affordability-result-box h3 {
    font-size: 20px;
    margin-bottom: 14px;
    font-weight: 700;
}

.result-safe {
    background: rgba(46, 213, 115, 0.1);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.result-risky {
    background: rgba(255, 107, 53, 0.1);
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

.result-not-affordable {
    background: rgba(139, 0, 0, 0.15);
    border-color: #8b0000;
    color: #1f0101;
}

.result-difficult {
    background: rgba(139, 0, 0, 0.25);
    border-color: #ff6b6b;
    color: #ffcccc;
}

.result-impact {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
}

.result-timestamp {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: slideInUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.input:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(46, 213, 115, 0.1);
}

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

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--gradient-green);
    color: white;
    box-shadow: 0 4px 12px rgba(46, 213, 115, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(46, 213, 115, 0.4);
}

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

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

/* Footer */
.main-footer {
    text-align: center;
    padding: 24px 0;
    color: var(--text-tertiary);
    font-size: 13px;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

/* Charts Section */
.charts-section {
    margin-top: 50px;
    animation: fadeInUp 0.6s ease 0.8s both;
    position: relative;
    z-index: 10;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 28px;
    margin-top: 28px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 28px;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    z-index: 10;
}

.chart-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-teal);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.chart-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 12px 40px rgba(0, 212, 255, 0.15);
    transform: translateY(-4px);
}

.chart-card:hover::before {
    opacity: 1;
}

.chart-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--gradient-teal);
    border-radius: 2px;
}

.chart-container {
    position: relative;
    height: 320px;
    animation: chartFadeIn 0.8s ease 0.2s both;
}

@keyframes chartFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.chart-container {
    position: relative;
    height: 320px;
    animation: chartFadeIn 0.8s ease 0.2s both;
}

@keyframes chartFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* History Section */
.history-section {
    margin-top: 40px;
    animation: fadeInUp 0.6s ease 0.8s both;
}

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

.history-controls {
    display: flex;
    gap: 12px;
}

.history-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all var(--transition-fast);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideInUp 0.4s ease backwards;
}

.history-item:nth-child(1) { animation-delay: 0.05s; }
.history-item:nth-child(2) { animation-delay: 0.1s; }
.history-item:nth-child(3) { animation-delay: 0.15s; }
.history-item:nth-child(4) { animation-delay: 0.2s; }
.history-item:nth-child(5) { animation-delay: 0.25s; }
.history-item:nth-child(n+6) { animation-delay: 0.3s; }

.history-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    transform: translateX(4px);
}

.history-item-content {
    flex: 1;
}

.history-item-type {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.history-item-amount {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.history-item-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.history-item-category {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

/* ============================================
   RECENT ACTIVITY SECTION
   ============================================ */

.recent-activity-section {
    margin-top: 24px;
}

.activity-icon {
    background: linear-gradient(135deg, #a55eea 0%, #8b4ddb 100%);
}

.recent-activity-container {
    min-height: 200px;
}

.activity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all var(--transition-fast);
    animation: fadeIn 0.2s ease backwards;
    position: relative;
    z-index: 10;
}

.activity-item:nth-child(1) { animation-delay: 0.05s; }
.activity-item:nth-child(2) { animation-delay: 0.1s; }
.activity-item:nth-child(3) { animation-delay: 0.15s; }
.activity-item:nth-child(4) { animation-delay: 0.2s; }
.activity-item:nth-child(5) { animation-delay: 0.25s; }

.activity-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.activity-item-left {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.activity-icon-small {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.activity-icon-small.income {
    background: rgba(46, 213, 115, 0.15);
    color: var(--accent-green);
}

.activity-icon-small.expense {
    background: rgba(255, 71, 87, 0.15);
    color: var(--accent-red);
}

.activity-icon-small.savings {
    background: rgba(0, 212, 255, 0.15);
    color: var(--accent-teal);
}

.activity-details {
    flex: 1;
}

.activity-category {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.activity-action {
    font-size: 12px;
    color: var(--text-secondary);
}

.activity-amount {
    font-size: 16px;
    font-weight: 700;
    text-align: right;
}

.activity-amount.positive {
    color: var(--accent-green);
}

.activity-amount.negative {
    color: var(--accent-red);
}

.activity-date {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
    text-align: right;
}

.activity-footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-teal);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-link:hover {
    color: var(--accent-teal-dark);
    transform: translateX(4px);
}

.privacy-note {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.activity-skeleton .skeleton-item {
    height: 60px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 8px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

/* ============================================
   HISTORY MODAL
   ============================================ */

.history-modal-content {
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.history-modal-content .modal-body {
    flex: 1;
    overflow-y: auto;
    min-height: 400px;
}

.history-modal-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 20px;
}

.history-stats {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

.history-actions {
    display: flex;
    gap: 8px;
}

.btn-icon-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon-text:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.btn-icon-text.btn-danger,
.btn-icon-text.btn-warning {
    color: var(--accent-orange);
    border-color: rgba(255, 107, 53, 0.5);
    background: transparent;
}

.btn-icon-text.btn-danger:hover,
.btn-icon-text.btn-warning:hover {
    background: rgba(255, 107, 53, 0.1);
    border-color: var(--accent-orange);
    transform: scale(1.05);
}

.btn-danger,
.btn-warning {
    background: transparent;
    border: 2px solid rgba(255, 107, 53, 0.6);
    color: var(--accent-orange);
    box-shadow: none;
}

.btn-danger:hover,
.btn-warning:hover {
    background: rgba(255, 107, 53, 0.1);
    border-color: var(--accent-orange);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.2);
    transform: translateY(-1px);
}

.history-loading {
    padding: 20px 0;
}

.history-skeleton .skeleton-item {
    height: 70px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 12px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.history-grouped-container {
    animation: fadeIn 0.3s ease;
}

.history-month-group {
    margin-bottom: 32px;
}

.history-month-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 20px;
    margin-top: 24px;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.history-month-group:first-child .history-month-header {
    margin-top: 0;
}

.history-month-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.history-month-count {
    font-size: 12px;
    color: var(--text-tertiary);
    background: var(--bg-card);
    padding: 4px 10px;
    border-radius: 12px;
}

.history-date-group {
    margin-bottom: 16px;
}

.history-date-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    margin-top: 16px;
    padding-left: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-date-group:first-child .history-date-header {
    margin-top: 0;
}

.history-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    margin-bottom: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all var(--transition-fast);
    position: relative;
    z-index: 10;
}

.history-entry:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.history-entry-left {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-entry-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.history-entry-icon.income {
    background: rgba(46, 213, 115, 0.15);
    color: var(--accent-green);
}

.history-entry-icon.expense {
    background: rgba(255, 71, 87, 0.15);
    color: var(--accent-red);
}

.history-entry-icon.savings {
    background: rgba(0, 212, 255, 0.15);
    color: var(--accent-teal);
}

.history-entry-details {
    flex: 1;
}

.history-entry-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.history-entry-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.history-entry-category {
    padding: 2px 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
}

.history-entry-time {
    color: var(--text-tertiary);
}

.history-entry-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.history-entry-amount {
    font-size: 18px;
    font-weight: 700;
    text-align: right;
}

.history-entry-amount.positive {
    color: var(--accent-green);
}

.history-entry-amount.negative {
    color: var(--accent-red);
}

.history-entry-delete {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    opacity: 0;
}

.history-entry:hover .history-entry-delete {
    opacity: 1;
}

.history-entry-delete:hover {
    background: rgba(255, 71, 87, 0.1);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
}

.confirm-modal-content {
    max-width: 500px;
}

.confirm-text {
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.6;
}

.confirm-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
}

.btn-danger {
    background: var(--gradient-red);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 71, 87, 0.4);
}

.btn-warning {
    background: transparent;
    border: 2px solid var(--accent-orange);
    color: var(--accent-orange);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.2);
}

.btn-warning:hover {
    background: rgba(255, 107, 53, 0.1);
    border-color: var(--accent-orange);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
    transform: translateY(-1px);
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Sign Out Button Styles */
.signout-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.signout-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

@keyframes skeletonPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Hide old history container */
#history {
    display: none;
}

/* ============================================
   ANIMATION ENHANCEMENTS
   ============================================ */

/* Animated Background Canvas - Optimized */
/* ============================================
   BACKGROUND ANIMATION LAYER (ISOLATED)
   ============================================ */
#animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.1;
    will-change: contents;
    transform: translateZ(0); /* GPU acceleration */
}

/* Ensure background container is isolated */
#background-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Cursor animation canvas for auth page */
#auth-cursor-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    will-change: contents;
    transform: translateZ(0);
}

/* Hide cursor animation on mobile */
@media (max-width: 768px) {
    #auth-cursor-canvas {
        display: none;
    }
}

/* Auth Spinner */
.auth-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
}

.auth-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 212, 255, 0.2);
    border-top-color: var(--accent-teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Auth Success/Error Messages */
.auth-success-message {
    color: var(--accent-green);
    padding: 12px;
    background: rgba(46, 213, 115, 0.1);
    border: 1px solid rgba(46, 213, 115, 0.3);
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
}

.auth-error {
    animation: fadeInDown 0.3s ease;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Enhanced Input Focus States */
.form-field.focused .input {
    border-color: var(--accent-teal);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
    transform: translateY(-2px);
}

.form-field.focused label {
    color: var(--accent-teal);
    transform: translateY(-2px);
}

/* Card Hover Enhancements */
.overview-card:hover,
.content-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Button Hover Enhancements */
.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary:hover {
    box-shadow: 0 8px 20px rgba(46, 213, 115, 0.4);
}

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

/* Modal Animation Enhancements */
.modal.active .modal-content {
    animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal {
    z-index: 1000;
}

.modal.active {
    animation: modalBackdropFadeIn 0.3s ease;
}

@keyframes modalBackdropFadeIn {
    from {
        background-color: rgba(0, 0, 0, 0);
    }
    to {
        background-color: rgba(0, 0, 0, 0.7);
    }
}

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

/* Staggered Card Animations */
@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Progress Bar Smooth Animation */
.progress-bar {
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Chart Container Animations */
.chart-container {
    animation: fadeIn 0.6s ease 0.3s both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Smooth Number Counter */
.card-value {
    transition: all 0.3s ease;
}

/* Enhanced Skeleton Loaders */
@keyframes skeletonPulse {
    0%, 100% {
        opacity: 1;
        background: var(--bg-secondary);
    }
    50% {
        opacity: 0.6;
        background: var(--bg-tertiary);
    }
}

.skeleton {
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

/* Activity Item Hover */
.activity-item {
    animation: none !important;
}

.activity-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* History Entry Hover */
.history-entry:hover {
    transform: translateX(6px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Add Button Hover */
.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.3);
}

.add-btn:active {
    transform: translateY(0);
}

/* Category Card Hover */
.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Currency Input Focus */
.currency-input:focus {
    border-color: var(--accent-teal);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
    transform: scale(1.02);
}

/* Smooth Transitions for All Interactive Elements */
* {
    transition-property: transform, opacity, background-color, border-color, box-shadow, color;
    transition-duration: 0.2s;
    transition-timing-function: ease;
}

/* Performance Optimizations */
.overview-card,
.content-card,
.chart-card,
.activity-item,
.history-entry,
.btn {
    will-change: transform, opacity;
    transform: translateZ(0); /* Force GPU acceleration */
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Optimize images and media for performance */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Lazy loading support */
img[loading="lazy"] {
    content-visibility: auto;
}

/* Optimize font rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Content visibility optimization for off-screen content */
.charts-section:not(.active),
.history-section:not(.active) {
    content-visibility: auto;
    contain-intrinsic-size: 400px;
}

/* Optimize rendering for large lists */
.income-items-list,
.expense-items-list,
.history-grouped-container {
    contain: layout style paint;
}

/* Reduce repaints on scroll */
.overview-card,
.content-card,
.chart-card {
    contain: layout style;
}

/* Optimize animations for mobile */
@media (max-width: 768px) {
    .overview-card,
    .content-card,
    .chart-card {
        will-change: auto;
    }
    
    /* Mobile-safe animations - keep but optimize */
    .overview-card,
    .content-card,
    .chart-card,
    .activity-item,
    .history-entry {
        animation: fadeInUp 0.3s ease !important;
    }
    
    /* Reduce animation duration but keep them */
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.2s !important;
    }
    
    /* Header mobile layout - hamburger menu */
    .main-header {
        flex-wrap: wrap;
        position: relative;
    }
    
    .mobile-menu-toggle {
        display: flex;
        order: 2;
    }
    
    .header-actions {
        width: 100%;
        flex-direction: column;
        gap: 8px;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, opacity 0.3s ease;
        opacity: 0;
        order: 3;
        padding: 0;
    }
    
    .header-actions.active {
        max-height: 600px;
        opacity: 1;
        margin-top: 16px;
        padding: 0;
    }
    
    .header-btn {
        width: 100%;
        justify-content: center;
        min-height: 48px; /* Touch-friendly */
    }
    
    /* Ensure page views work on mobile */
    .page-container {
        padding: 24px 16px;
    }
}

/* Performance: Optimize for small screens */
@media (max-width: 480px) {
    /* Disable background canvas on very small screens */
    #animated-background {
        display: none !important;
    }
    
    /* Cursor animation already disabled via JS, but ensure CSS compliance */
    #auth-cursor-canvas {
        display: none !important;
    }
    
    /* Keep animations but make them instant */
    .chart-card,
    .overview-card {
        animation: fadeIn 0.2s ease !important;
    }
    
    /* Mobile header adjustments */
    .logo-section {
        width: 100%;
    }
    
    .header-actions {
        width: 100%;
        gap: 8px;
        flex-direction: column;
    }
    
    .header-btn {
        width: 100%;
        font-size: 13px;
        padding: 12px;
        justify-content: center;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
}

/* Mobile smoothness & touch improvements (mobile-only; desktop unaffected) */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
        -webkit-text-size-adjust: 100%;
    }
    body {
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: manipulation;
        /* GPU acceleration for smooth scrolling */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
    /* Improve tap responsiveness without changing desktop layout */
    button, .btn, .check-affordability-btn, input, select, textarea {
        touch-action: manipulation;
        /* Prevent 300ms tap delay on mobile */
        -webkit-tap-highlight-color: transparent;
    }
    /* Optimize scrolling containers */
    .ai-chatbot-messages,
    .history-grouped-container,
    .modal-body,
    .income-items-list,
    .expense-items-list {
        -webkit-overflow-scrolling: touch;
        will-change: scroll-position;
        transform: translateZ(0);
    }
}

/* Respect user preferences for reduced motion - but allow minimal animations */
@media (prefers-reduced-motion: reduce) {
    /* Keep essential fade animations but remove motion */
    *,
    *::before,
    *::after {
        animation-duration: 0.15s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.15s !important;
    }
    
    /* Remove transform-based animations but keep opacity */
    .overview-card,
    .content-card,
    .chart-card {
        animation: fadeIn 0.15s ease !important;
    }
    
    #animated-background {
        display: none !important;
    }
    
    /* Remove slide and translate animations */
    @keyframes fadeInUp {
        from, to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

/* Disable transitions on page load for instant render */
.page-loading * {
    transition: none !important;
}

/* Re-enable after load */
body:not(.page-loading) * {
    transition-property: transform, opacity, background-color, border-color, box-shadow, color;
    transition-duration: 0.2s;
    transition-timing-function: ease;
}

/* Tab Animation */
.auth-tab.active {
    position: relative;
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-green);
    animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 39, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.loading-overlay .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 212, 255, 0.2);
    border-top-color: var(--accent-teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Chart Animation Enhancement */
.chart-card {
    animation: slideUpFade 0.6s ease backwards;
}

.chart-card:nth-child(1) { animation-delay: 0.1s; }
.chart-card:nth-child(2) { animation-delay: 0.2s; }
.chart-card:nth-child(3) { animation-delay: 0.3s; }

/* ============================================
   MOBILE RESPONSIVENESS - COMPREHENSIVE
   ============================================ */

/* Mobile First - Base styles are mobile */
/* Tablet Styles */
@media (max-width: 1024px) and (min-width: 769px) {
    .container {
        padding: 16px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .overview-card,
    .content-card {
        padding: 20px;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    /* Base Layout */
    .container {
        padding: 12px;
        max-width: 100%;
    }
    
    body {
        font-size: 14px;
    }
    
    /* Header */
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 16px 0;
        margin-bottom: 24px;
    }
    
    .logo-section {
        width: 100%;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .header-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    /* Dashboard Cards */
    .dashboard-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .overview-card {
        padding: 16px;
        min-height: auto;
    }
    
    .card-value {
        font-size: 24px;
    }
    
    .card-label {
        font-size: 13px;
    }
    
    /* Content Cards */
    .content-card {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .card-header {
        margin-bottom: 16px;
    }
    
    .section-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    .section-header-text h3 {
        font-size: 18px;
    }
    
    /* Dashboard Grid */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .left-column,
    .right-column {
        width: 100%;
    }
    
    /* Income/Expense Lists */
    .income-items-list,
    .expense-items-list {
        gap: 8px;
    }
    
    .income-item,
    .expense-item {
        padding: 12px;
        font-size: 13px;
    }
    
    /* Category Cards */
    .flexible-categories-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .category-card {
        padding: 16px;
    }
    
    .category-icon {
        font-size: 24px;
    }
    
    /* Charts */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .chart-card {
        padding: 16px;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .chart-title {
        font-size: 16px;
        margin-bottom: 16px;
    }
    
    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    .add-btn {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }
    
    /* Modals */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 10px;
        max-height: 90vh;
        padding: 20px;
    }
    
    .modal-header h3 {
        font-size: 18px;
    }
    
    .form-field {
        margin-bottom: 16px;
    }
    
    .form-field label {
        font-size: 13px;
    }
    
    .input {
        padding: 12px;
        font-size: 14px;
    }
    
    /* Currency Input */
    .currency-input-wrapper {
        padding: 12px;
    }
    
    .currency-input {
        font-size: 16px;
    }
    
    /* Recent Activity */
    .recent-activity-container {
        min-height: 150px;
    }
    
    .activity-item {
        padding: 10px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .activity-item-left {
        width: 100%;
    }
    
    .activity-item-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .activity-amount {
        font-size: 18px;
    }
    
    /* History Modal */
    .history-modal-content {
        max-height: 85vh;
    }
    
    .history-modal-controls {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }
    
    .history-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .btn-icon-text {
        flex: 1;
        justify-content: center;
    }
    
    .history-entry {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .history-entry-left {
        width: 100%;
    }
    
    .history-entry-right {
        width: 100%;
        justify-content: space-between;
        margin-top: 8px;
    }
    
    /* Progress Bar */
    .progress-bar-container {
        height: 8px;
    }
    
    /* Savings Section */
    .savings-amount {
        font-size: 32px;
    }
    
    .savings-warning {
        font-size: 13px;
    }
    
    /* Affordability Section */
    .purchase-type-buttons {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .purchase-type-btn {
        padding: 12px;
    }
    
    /* Welcome Screen */
    .welcome-screen {
        padding: 20px;
    }
    
    .welcome-content {
        max-width: 100%;
        padding: 24px 16px;
    }
    
    .welcome-content h1 {
        font-size: 28px;
    }
    
    .welcome-content .tagline {
        font-size: 16px;
    }
    
    /* Auth Modal */
    .auth-modal-content {
        padding: 20px;
    }
    
    .auth-tabs {
        gap: 8px;
    }
    
    .auth-tab {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    /* Footer */
    .main-footer {
        padding: 16px 0;
        font-size: 12px;
    }
    
    /* Animations - Reduce on mobile for performance */
    .overview-card,
    .content-card,
    .chart-card {
        animation-duration: 0.4s;
    }
    
    /* Touch Targets */
    .btn,
    .add-btn,
    .header-btn,
    .delete-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Hide animated background on mobile for performance */
    #animated-background {
        display: none;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .container {
        padding: 8px;
        max-width: 100%;
    }
    
    .overview-card,
    .content-card {
        padding: 12px;
        min-width: 0;
    }
    
    .card-value {
        font-size: 20px;
        word-break: break-word;
    }
    
    .modal-content {
        width: 92%;
        max-width: 420px;
        margin: auto;
        border-radius: 16px;
        max-height: 85vh;
        height: auto;
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .modal-body {
        padding: 16px;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-footer {
        padding: 16px;
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    .charts-grid {
        gap: 12px;
        min-width: 0;
    }
    
    .chart-container {
        height: 200px;
        min-width: 0;
    }
    
    .activity-item {
        padding: 8px;
        min-width: 0;
    }
    
    .history-entry {
        padding: 10px;
        min-width: 0;
    }
    
    .savings-amount {
        font-size: 28px;
        word-break: break-word;
    }
    
    /* Prevent text overflow on small screens */
    .card-label,
    .card-description,
    .section-subtitle {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Optimize input fields */
    .currency-input,
    .input {
        font-size: 16px; /* Prevents zoom on iOS */
        min-width: 0;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-content {
        max-height: 95vh;
    }
    
    .chart-container {
        height: 200px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .overview-card:hover,
    .content-card:hover,
    .chart-card:hover {
        transform: none;
    }
    
    /* Larger touch targets */
    .delete-btn {
        width: 44px;
        height: 44px;
        font-size: 20px;
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Better scrolling with GPU acceleration */
    .history-grouped-container,
    .modal-body,
    .ai-chatbot-messages,
    .income-items-list,
    .expense-items-list {
        -webkit-overflow-scrolling: touch;
        transform: translateZ(0);
        will-change: scroll-position;
    }
    
    /* Optimize button touch targets */
    .btn,
    .header-btn,
    .add-btn,
    .check-affordability-btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .chart-container,
    .chart-card {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print Styles */
@media print {
    #animated-background,
    .header-actions,
    .add-btn,
    .btn,
    .modal {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .overview-card,
    .content-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ============================================
   ADMIN PANEL STYLES - DARK THEME
   ============================================ */

.admin-page {
    background: var(--admin-bg);
    color: var(--admin-text);
    min-height: 100vh;
}

/* Login Screen */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--gradient-bg);
}

.login-box {
    background: var(--admin-card-bg);
    border: 1px solid var(--admin-border);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 100%;
    animation: fadeInUp 0.6s ease;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 10px;
    color: var(--admin-text);
}

.login-subtitle {
    text-align: center;
    color: var(--admin-text-light);
    margin-bottom: 30px;
}

.login-box .form-group {
    flex-direction: column;
    margin-bottom: 20px;
}

.login-box label {
    margin-bottom: 8px;
    color: var(--admin-text);
    font-weight: 500;
}

.login-box .input {
    background: var(--admin-bg);
    border: 1px solid var(--admin-border);
    color: var(--admin-text);
    min-width: auto;
}

.login-box .input:focus {
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 3px rgba(165, 94, 234, 0.1);
}

.error-message {
    color: var(--accent-red);
    text-align: center;
    margin-top: 15px;
    font-size: 0.9em;
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 20px;
    color: var(--admin-text-light);
    text-decoration: none;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--admin-text);
}

/* Admin Dashboard */
.admin-dashboard {
    min-height: 100vh;
}

.admin-header {
    background: var(--admin-card-bg);
    border-bottom: 2px solid var(--admin-border);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    color: var(--admin-text);
    font-size: 1.8em;
}

.admin-header-actions {
    display: flex;
    gap: 15px;
}

.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

.admin-section {
    background: var(--admin-card-bg);
    border: 1px solid var(--admin-border);
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.admin-section h2 {
    color: var(--admin-text);
    margin-bottom: 25px;
    font-size: 1.5em;
    border-bottom: 2px solid var(--admin-border);
    padding-bottom: 10px;
}

/* Admin Dashboard Cards */
.admin-dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.admin-card {
    background: var(--admin-bg);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    overflow: hidden;
}

.admin-card-header {
    background: var(--admin-primary);
    padding: 15px;
    border-bottom: 1px solid var(--admin-border);
}

.admin-card-header h3 {
    color: var(--admin-text);
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-card-body {
    padding: 20px;
}

.admin-card-value {
    font-size: 2em;
    font-weight: bold;
    color: var(--admin-text);
    margin-bottom: 8px;
}

.admin-card-subtitle {
    font-size: 0.9em;
    color: var(--admin-text-light);
}

/* Health Alerts */
.health-alerts {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.health-alert {
    padding: 20px;
    border-radius: 6px;
    border-left: 4px solid;
}

.health-alert strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.health-alert p {
    margin: 0;
    line-height: 1.6;
}

.health-alert-success {
    background: rgba(46, 213, 115, 0.1);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.health-alert-warning {
    background: rgba(255, 107, 53, 0.1);
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

.health-alert-danger {
    background: rgba(255, 71, 87, 0.1);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

/* Admin Controls */
.admin-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

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

.filter-group label {
    color: var(--admin-text);
    font-weight: 500;
}

.admin-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--admin-bg);
    border-radius: 6px;
    overflow: hidden;
}

.admin-table thead {
    background: var(--admin-primary);
}

.admin-table th {
    padding: 15px;
    text-align: left;
    color: var(--admin-text);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
}

.admin-table td {
    padding: 15px;
    border-top: 1px solid var(--admin-border);
    color: var(--admin-text-light);
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.empty-table {
    text-align: center;
    color: var(--admin-text-light);
    font-style: italic;
    padding: 30px !important;
}

.log-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
}

.log-safe {
    background: rgba(46, 213, 115, 0.2);
    color: var(--accent-green);
}

.log-risky {
    background: rgba(255, 107, 53, 0.2);
    color: var(--accent-orange);
}

.log-not-affordable {
    background: rgba(255, 71, 87, 0.2);
    color: var(--accent-red);
}

/* Settings Form */
.settings-form {
    max-width: 600px;
}

/* About Page Styles */
.about-page {
    padding: 0;
    color: var(--text-primary);
    min-height: 400px;
}

.about-content {
    max-width: 100%;
    width: 100%;
    padding: 0;
}

.about-content h2 {
    font-size: 28px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* About modal full height on mobile */
@media (max-width: 768px) {
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .about-page {
        min-height: auto;
    }
}

.about-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.about-content h3 {
    font-size: 20px;
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--accent-teal);
}

.about-section {
    margin-bottom: 28px;
}

.about-section:last-of-type {
    margin-bottom: 0;
}

.about-content p {
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.about-content ul {
    margin-left: 24px;
    margin-bottom: 24px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.about-content ul li {
    margin-bottom: 8px;
}

.about-footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-tertiary);
    text-align: center;
}

/* Contact Page Styles */
.contact-page {
    padding: 20px 0;
}

.contact-info-section {
    margin-bottom: 32px;
}

.contact-info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.contact-info-item:hover {
    background: var(--bg-hover);
}

.contact-info-item a {
    color: var(--accent-teal);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.contact-info-item a:hover {
    color: var(--accent-teal-dark);
}

@media (max-width: 480px) {
    .contact-info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .contact-info-item a {
        display: block;
        width: 100%;
        padding: 8px 0;
    }
}

.contact-page textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

.contact-page .form-field {
    margin-bottom: 20px;
}

.contact-message-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

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

/* ============================================
   AI CHATBOT STYLES
   ============================================ */

.ai-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: inherit;
}

.ai-chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-teal);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ai-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.4);
}

.ai-chatbot-toggle.active {
    background: var(--accent-teal-dark);
}

.ai-chatbot-icon {
    display: block;
}

.ai-chatbot-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUpFade 0.3s ease;
}

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

.ai-chatbot-panel.hidden {
    display: none;
}

.ai-chatbot-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--bg-secondary);
}

.ai-chatbot-header-content h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-chatbot-subtitle {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.ai-chatbot-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.ai-chatbot-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.ai-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-chatbot-message {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.ai-chatbot-message-user {
    justify-content: flex-end;
}

.ai-chatbot-message-assistant {
    justify-content: flex-start;
}

.ai-chatbot-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.ai-chatbot-message-user .ai-chatbot-message-content {
    background: var(--accent-teal);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-chatbot-message-assistant .ai-chatbot-message-content {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.ai-chatbot-message-content p {
    margin: 0 0 8px 0;
}

.ai-chatbot-message-content p:last-child {
    margin-bottom: 0;
}

.ai-chatbot-message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-chatbot-message-content li {
    margin-bottom: 4px;
}

.ai-chatbot-typing {
    opacity: 0.7;
}

.ai-chatbot-typing-dots {
    display: inline-flex;
    gap: 4px;
}

.ai-chatbot-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: typingDot 1.4s infinite;
}

.ai-chatbot-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-chatbot-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

.ai-chatbot-input-container {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    background: var(--bg-secondary);
}

.ai-chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.ai-chatbot-input:focus {
    outline: none;
    border-color: var(--accent-teal);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.ai-chatbot-input::placeholder {
    color: var(--text-muted);
}

.ai-chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--accent-teal);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.ai-chatbot-send:hover {
    background: var(--accent-teal-dark);
    transform: translateX(2px);
}

.ai-chatbot-send:active {
    transform: translateX(0);
}

.ai-chatbot-suggestions {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: var(--bg-secondary);
    max-height: 120px;
    overflow-y: auto;
}

.ai-chatbot-suggestion-btn {
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    font-family: inherit;
}

.ai-chatbot-suggestion-btn:hover {
    background: var(--accent-teal);
    border-color: var(--accent-teal);
    color: white;
    transform: translateY(-1px);
}

.ai-chatbot-suggestion-btn:active {
    transform: translateY(0);
}

/* AI Summary Section */
.ai-summary-section {
    margin-bottom: 24px;
}

.ai-summary-icon {
    font-size: 24px;
}

.ai-summary-content {
    padding: 16px 0;
}

.ai-summary-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

/* Mobile responsiveness for chatbot */
@media (max-width: 768px) {
    .ai-chatbot-container {
        position: static;
        bottom: auto;
        right: auto;
    }

    .ai-chatbot-toggle {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }

    .ai-chatbot-panel {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        max-height: 80vh;
        bottom: 76px;
        right: 0;
    }

    .ai-chatbot-message-content {
        max-width: 85%;
    }

    .ai-chatbot-suggestions {
        padding: 10px 12px;
        max-height: 100px;
    }

    .ai-chatbot-suggestion-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
}

/* Mobile responsiveness for admin messages */
@media (max-width: 768px) {
    .contact-message-card {
        padding: 16px !important;
    }
    
    #admin-messages-container {
        max-height: 70vh !important;
    }
}

@media (max-width: 480px) {
    .contact-message-card {
        padding: 12px !important;
    }
    
    .contact-message-card h4 {
        font-size: 16px !important;
    }
    
    .contact-message-card p {
        font-size: 13px !important;
    }
}

.settings-form .form-group {
    flex-direction: column;
    margin-bottom: 25px;
}

.settings-form label {
    margin-bottom: 8px;
    color: var(--admin-text);
    font-weight: 500;
}

.settings-form .input {
    background: var(--admin-bg);
    border: 1px solid var(--admin-border);
    color: var(--admin-text);
    min-width: auto;
}

.settings-form .input:focus {
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 3px rgba(165, 94, 234, 0.1);
}

.form-help {
    font-size: 0.85em;
    color: var(--admin-text-light);
    margin-top: 5px;
}

.checkbox {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Authentication UI */
.auth-modal-content {
    max-width: 450px;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

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

.auth-tab.active {
    color: var(--accent-green);
    background: rgba(46, 213, 115, 0.1);
}

.auth-error {
    color: var(--accent-red);
    font-size: 13px;
    margin-bottom: 16px;
    padding: 10px;
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--accent-red);
    border-radius: 6px;
    display: none;
}

.auth-error:not(:empty) {
    display: block;
}

.auth-loading {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

/* Welcome Screen */
.welcome-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--gradient-bg);
    background-attachment: fixed;
    position: relative;
    z-index: 10;
}

.welcome-content {
    text-align: center;
    max-width: 600px;
    animation: fadeInUp 0.8s ease;
}

.welcome-content h1 {
    margin-bottom: 12px;
}

/* Skeleton Loaders */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 8px;
}

.skeleton-text-small {
    height: 0.8em;
    width: 60%;
}

.skeleton-card {
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

.skeleton-item {
    height: 60px;
    margin-bottom: 10px;
}

/* Loading States */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 39, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.data-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Smooth Transitions */
.card-value,
.card-description,
.section-amount,
.savings-amount {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.card-value.loading {
    opacity: 0;
}

.card-value.loaded {
    opacity: 1;
    animation: fadeInUp 0.4s ease;
}

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

/* Mobile-First Responsive Improvements */
@media (max-width: 768px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .overview-card {
        padding: 20px;
    }

    .card-value {
        font-size: 22px;
    }

    .main-content {
        gap: 16px;
    }

    .content-card {
        padding: 20px;
    }

    .flexible-categories-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .main-header {
        padding: 16px 0;
        flex-wrap: wrap;
    }

    .header-actions {
        width: 100%;
        margin-top: 12px;
    }

    .section-title {
        font-size: 18px;
    }

    .card-value {
        font-size: 20px;
    }

    .savings-amount {
        font-size: 32px;
    }
}

/* Utility */
.hidden {
    display: none !important;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .flexible-categories-grid {
        grid-template-columns: 1fr;
    }

    .purchase-type-buttons {
        grid-template-columns: 1fr;
    }

    .admin-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .admin-header-actions {
        width: 100%;
        flex-direction: column;
    }

    .admin-header-actions .btn {
        width: 100%;
    }

    .admin-dashboard-cards {
        grid-template-columns: 1fr;
    }

    .admin-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-controls-grid {
        grid-template-columns: 1fr;
    }

    .table-container {
        overflow-x: scroll;
    }

    .admin-table {
        font-size: 0.9em;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .container {
        padding: 12px;
    }

    .content-card {
        padding: 16px;
    }

    .login-box {
        padding: 30px 20px;
    }
    
    .chart-container {
        height: 220px;
    }

    .overview-card {
        padding: 16px;
    }

    .card-value {
        font-size: 20px;
    }

    .card-icon {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }

    .main-header {
        padding: 16px 0;
    }

    .logo-text h1 {
        font-size: 20px;
    }

    .section-title {
        font-size: 18px;
        margin-bottom: 16px;
    }

    .header-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .add-btn {
        padding: 12px;
        font-size: 14px;
    }

    .check-affordability-btn {
        padding: 14px;
        font-size: 15px;
    }

    .purchase-type-btn {
        padding: 14px;
    }

    .history-item {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .history-item-category {
        align-self: flex-end;
    }
}

/* ============================================
   ABOUT & CONTACT MODALS
   ============================================ */

.about-content,
.contact-content {
    padding: 8px 0;
}

.about-section {
    margin-bottom: 28px;
}

.about-section:last-child {
    margin-bottom: 0;
}

.contact-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.contact-item {
    text-align: center;
    padding: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all var(--transition-normal);
}

.contact-item:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.contact-icon {
    margin: 0 auto 16px;
}

.contact-item h4 {
    margin-bottom: 12px;
}

.contact-item a {
    transition: color var(--transition-fast);
}

.contact-item a:hover {
    color: var(--accent-teal);
    text-decoration: underline;
}

.welcome-footer-links {
    display: flex;
    gap: 24px;
    justify-content: center;
    flex-wrap: wrap;
}

.welcome-footer-links .btn-link {
    color: var(--text-secondary);
    font-size: 14px;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.welcome-footer-links .btn-link:hover {
    color: var(--accent-teal);
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-2px);
}

.welcome-btn {
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.welcome-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.welcome-btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Responsive About & Contact */
@media (max-width: 768px) {
    .contact-items {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .contact-item {
        padding: 20px;
    }
    
    .about-content,
    .contact-content {
        padding: 4px 0;
    }
    
    .about-section {
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .contact-items {
        gap: 12px;
    }
    
    .contact-item {
        padding: 16px;
    }
    
    .welcome-footer-links {
        flex-direction: column;
        gap: 12px;
    }
}

/* ===== PAGE HEIGHT & GAP FIX ===== */
.page,
.section,
.about-section,
.contact-section {
  min-height: auto !important;
  height: auto !important;
}

main {
  padding-bottom: 0 !important;
}

body {
  overflow-x: hidden;
}

.page {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }
  
  /* FIX HEADER GAP FOR STATIC PAGES */
.no-header-gap {
    margin-top: -32px !important;
    padding-top: 0 !important;
}

/* ===============================
   FIX: ABOUT & CONTACT PAGE GAP
   =============================== */

.page-section,
#aboutPage,
#contactPage {
  position: relative;
  top: 0 !important;
  margin-top: 0 !important;
  padding-top: 20px; /* keeps space below navbar */
  min-height: 100vh;
  z-index: 2;
}

.background-animation {
  pointer-events: none;
  z-index: 0;
}

/* ===============================
   HARD FIX: REMOVE TOP GAP
   =============================== */

.no-navbar-gap {
  margin-top: -80px !important;
  padding-top: 80px !important;
}

.page-section {
  scroll-margin-top: 80px;
}

/* Universal Mobile Fix */
@media (max-width: 768px) {

    .container,
    .page-container,
    .content-card,
    .overview-card {
        min-width: 0;
        width: 100%;
    }

    .charts-grid,
    .cards-grid,
    .overview-grid {
        grid-template-columns: 1fr !important;
    }

    button, input, select {
        min-height: 44px;
    }

    .modal-body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Performance: avoid rendering off-screen content until needed (safe containers only) */
.dashboard-container,
.cards-container,
.chart-container,
.main-container {
  content-visibility: auto;
  contain-intrinsic-size: 500px;
}
