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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #1d1d1f;
    line-height: 1.6;
    min-height: 100vh;
}

/* Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 1rem 0;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #007aff;
}

.nav-menu {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.theme-switcher {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-btn {
    background: none;
    border: 2px solid rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #86868b;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn:hover {
    border-color: #007aff;
    color: #007aff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.theme-btn.active {
    border-color: #007aff;
    background: #007aff;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.nav-btn {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #86868b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(0, 122, 255, 0.1);
    color: #007aff;
    transform: translateY(-1px);
}

.nav-btn.active {
    background: #007aff;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

/* Hero Section */
.hero {
    padding: 8rem 2rem 4rem;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.hero-container {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
    font-weight: 300;
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

.feature-item i {
    font-size: 1.1rem;
}

.cta-button {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 1rem 2rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.cta-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}

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

/* Warning Banner */
.warning-banner {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
    animation: pulse 2s infinite;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #007aff, #5856d6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: #1d1d1f;
}

.stat-label {
    color: #86868b;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #1d1d1f;
}

.card-title i {
    color: #007aff;
}

/* Category Items */
.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(0, 122, 255, 0.05);
    border-radius: 8px;
    border-left: 4px solid #007aff;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.category-item:hover {
    background: rgba(0, 122, 255, 0.1);
    transform: translateX(4px);
}

/* Trend Chart */
.trend-chart {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trend-chart canvas {
    max-width: 100%;
    height: auto;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #1d1d1f;
}

.add-expense-btn, .refresh-btn {
    background: #007aff;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.add-expense-btn:hover, .refresh-btn:hover {
    background: #0056cc;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

/* Expenses Table */
.expenses-table-container {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.expenses-table {
    width: 100%;
    border-collapse: collapse;
}

.expenses-table th {
    background: rgba(0, 122, 255, 0.1);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    color: #1d1d1f;
}

.expenses-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.expenses-table tr:hover {
    background: rgba(0, 122, 255, 0.05);
}

/* Insights Grid */
.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.insight-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.insight-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.insight-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.insight-header i {
    color: #007aff;
    font-size: 1.2rem;
}

.insight-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0;
}

.insight-content {
    color: #86868b;
    line-height: 1.6;
}

.insight-content p {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: rgba(0, 122, 255, 0.05);
    border-radius: 6px;
    border-left: 3px solid #007aff;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    animation: modalFadeIn 0.3s ease-out;
}

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

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1d1d1f;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #86868b;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #1d1d1f;
}

/* Form Styles */
.expense-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #1d1d1f;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
    background: white;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #007aff;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.btn-primary:hover {
    background: #0056cc;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.1);
    color: #1d1d1f;
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 122, 255, 0.1);
    border-top: 3px solid #007aff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: #86868b;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
    }
    
    .nav-menu {
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .nav-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .theme-switcher {
        margin-left: 0.5rem;
        padding-left: 0.5rem;
        gap: 0.25rem;
    }
    
    .theme-btn {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }
    
    .hero {
        padding: 6rem 1rem 3rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-features {
        flex-direction: column;
        gap: 1rem;
    }
    
    .main-content {
        padding: 0 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .insights-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .expenses-table {
        font-size: 0.9rem;
    }
    
    .expenses-table th,
    .expenses-table td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .nav-menu {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .theme-switcher {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        padding-top: 0.5rem;
        margin-top: 0.5rem;
        width: 100%;
        justify-content: center;
    }
    
    .theme-btn {
        width: 32px;
        height: 32px;
        font-size: 0.7rem;
    }
}

/* CSS Variables for Theming */
:root {
    /* Default Theme */
    --primary-color: #007aff;
    --primary-hover: #0056cc;
    --primary-light: rgba(0, 122, 255, 0.1);
    --primary-shadow: rgba(0, 122, 255, 0.3);
    --secondary-color: #5856d6;
    --background-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --hero-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-background: rgba(255, 255, 255, 0.9);
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --border-color: rgba(0, 0, 0, 0.1);
    --warning-color: #ff6b6b;
    --warning-hover: #ee5a52;
}

/* Monochrome Theme (Black & White) */
[data-theme="monochrome"] {
    --primary-color: #000000;
    --primary-hover: #333333;
    --primary-light: rgba(0, 0, 0, 0.1);
    --primary-shadow: rgba(0, 0, 0, 0.3);
    --secondary-color: #666666;
    --background-gradient: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    --hero-gradient: linear-gradient(135deg, #000000 0%, #333333 100%);
    --card-background: rgba(255, 255, 255, 0.95);
    --text-primary: #000000;
    --text-secondary: #666666;
    --border-color: rgba(0, 0, 0, 0.2);
    --warning-color: #000000;
    --warning-hover: #333333;
}

/* Gold Theme (Gold & Black) */
[data-theme="gold"] {
    --primary-color: #ffd700;
    --primary-hover: #ffed4e;
    --primary-light: rgba(255, 215, 0, 0.1);
    --primary-shadow: rgba(255, 215, 0, 0.3);
    --secondary-color: #b8860b;
    --background-gradient: linear-gradient(135deg, #fff8dc 0%, #f0e68c 100%);
    --hero-gradient: linear-gradient(135deg, #ffd700 0%, #b8860b 100%);
    --card-background: rgba(255, 255, 255, 0.9);
    --text-primary: #000000;
    --text-secondary: #8b7355;
    --border-color: rgba(184, 134, 11, 0.2);
    --warning-color: #ff6b6b;
    --warning-hover: #ee5a52;
}

/* Nature Theme (Green & Purple) */
[data-theme="nature"] {
    --primary-color: #4caf50;
    --primary-hover: #45a049;
    --primary-light: rgba(76, 175, 80, 0.1);
    --primary-shadow: rgba(76, 175, 80, 0.3);
    --secondary-color: #9c27b0;
    --background-gradient: linear-gradient(135deg, #e8f5e8 0%, #f3e5f5 100%);
    --hero-gradient: linear-gradient(135deg, #4caf50 0%, #9c27b0 100%);
    --card-background: rgba(255, 255, 255, 0.9);
    --text-primary: #2e7d32;
    --text-secondary: #6a1b9a;
    --border-color: rgba(76, 175, 80, 0.2);
    --warning-color: #f44336;
    --warning-hover: #d32f2f;
}

/* Apply theme variables to elements */
body {
    background: var(--background-gradient);
    color: var(--text-primary);
}

.nav-logo {
    color: var(--primary-color);
}

.nav-btn.active {
    background: var(--primary-color);
    box-shadow: 0 4px 12px var(--primary-shadow);
}

.nav-btn:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.hero {
    background: var(--hero-gradient);
}

.stat-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    box-shadow: 0 4px 12px var(--primary-shadow);
}

.card-title i {
    color: var(--primary-color);
}

.category-item {
    background: var(--primary-light);
    border-left-color: var(--primary-color);
}

.category-item:hover {
    background: var(--primary-light);
}

.add-expense-btn, .refresh-btn {
    background: var(--primary-color);
    box-shadow: 0 4px 12px var(--primary-shadow);
}

.add-expense-btn:hover, .refresh-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 20px var(--primary-shadow);
}

.expenses-table th {
    background: var(--primary-light);
}

.expenses-table tr:hover {
    background: var(--primary-light);
}

.insight-header i {
    color: var(--primary-color);
}

.insight-content p {
    background: var(--primary-light);
    border-left-color: var(--primary-color);
}

.btn-primary {
    background: var(--primary-color);
    box-shadow: 0 4px 12px var(--primary-shadow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 20px var(--primary-shadow);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.warning-banner {
    background: linear-gradient(135deg, var(--warning-color), var(--warning-hover));
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.spinner {
    border-color: var(--primary-light);
    border-top-color: var(--primary-color);
}

.theme-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 4px 12px var(--primary-shadow);
}

.theme-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

/* Theme-specific adjustments */
[data-theme="monochrome"] .hero-title,
[data-theme="monochrome"] .hero-subtitle {
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.3);
}

[data-theme="gold"] .hero-title,
[data-theme="gold"] .hero-subtitle {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="nature"] .hero-title,
[data-theme="nature"] .hero-subtitle {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Special effects for themes */
[data-theme="monochrome"] .stat-card,
[data-theme="monochrome"] .dashboard-card,
[data-theme="monochrome"] .insight-card {
    border: 1px solid var(--border-color);
}

[data-theme="gold"] .stat-card,
[data-theme="gold"] .dashboard-card,
[data-theme="gold"] .insight-card {
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.1);
}

[data-theme="nature"] .stat-card,
[data-theme="nature"] .dashboard-card,
[data-theme="nature"] .insight-card {
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(76, 175, 80, 0.1);
}
