/* Personal Finance Manager - Styles */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --success-color: #16a34a;
    --danger-color: #dc2626;
    --warning-color: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

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

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

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.auth-container {
    max-width: 400px;
    margin: 80px auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-img {
    height: 100px;
    width: auto;
    border-radius: 10px;
}

/* Auth Page Logo */
.auth-logo {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo-img {
    height: 120px;
    width: auto;
    border-radius: 12px;
}

/* Footer logo styling */
.landing-footer .logo-img {
    height: 72px;
    border-radius: 8px;
}

/* Landing header logo */
.landing-header .logo-img {
    height: 120px;
}

.nav {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.user-email {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

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

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.form-input,
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

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

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #15803d;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

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

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

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

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value.positive {
    color: var(--success-color);
}

.stat-value.negative {
    color: var(--danger-color);
}

.stat-value.warning {
    color: var(--warning-color);
}

.stat-card-alert {
    border: 2px solid var(--danger-color);
    background: rgba(239, 68, 68, 0.05);
}

.stat-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.table .amount {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.table .amount.income {
    color: var(--success-color);
}

.table .amount.expense {
    color: var(--danger-color);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
}

.badge-income {
    background: #dcfce7;
    color: #166534;
}

.badge-expense {
    background: #fee2e2;
    color: #991b1b;
}

.badge-paid {
    background: #dcfce7;
    color: #166534;
}

.badge-unpaid {
    background: #fef3c7;
    color: #92400e;
}

/* Expense List */
.expense-list {
    list-style: none;
}

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

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

.expense-info {
    flex: 1;
}

.expense-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.expense-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.expense-amount {
    font-weight: 600;
    margin-right: 16px;
    font-variant-numeric: tabular-nums;
}

.expense-item.paid {
    opacity: 0.6;
}

.expense-item.paid .expense-name {
    text-decoration: line-through;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.2s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}

.modal-body {
    padding: 20px;
}

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

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
}

.tab {
    padding: 12px 24px;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

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

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

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

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 12px;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 1.125rem;
    margin-bottom: 16px;
}

/* Utilities */
.text-center {
    text-align: center;
}

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

.mt-4 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}

.hidden {
    display: none !important;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-top: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
}

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

/* Settings / Danger Zone */
.danger-zone {
    border: 1px solid var(--danger-color);
    background: rgba(220, 38, 38, 0.02);
}

.danger-zone .card-title {
    color: var(--danger-color);
}

.danger-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    gap: 20px;
}

.danger-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.danger-item:first-of-type {
    padding-top: 0;
}

.danger-info {
    flex: 1;
}

.danger-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.danger-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.modal-warning {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

@media (max-width: 640px) {
    .danger-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .danger-item .btn {
        width: 100%;
    }
}

/* Actions */
.actions {
    display: flex;
    gap: 8px;
}

/* Interval Label Helper */
.interval-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Month Navigation */
.month-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: relative;
}

.month-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.25rem;
}

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

.month-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.month-nav-current {
    font-size: 1.25rem;
    font-weight: 600;
    min-width: 200px;
    text-align: center;
}

.month-nav-today {
    position: absolute;
    right: 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 12px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.month-nav-today:hover {
    background: var(--background);
    color: var(--primary-color);
}

/* ==================
   Landing Page Styles
   ================== */

.landing-page {
    background: var(--surface);
}

/* Landing Header */
.landing-header {
    padding: 20px 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.landing-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.landing-nav {
    display: flex;
    gap: 12px;
}

/* Hero Section */
.hero {
    padding: 140px 0 80px;
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4f8 100%);
    min-height: 90vh;
    display: flex;
    align-items: center;
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 32px;
    max-width: 500px;
}

.hero-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.1rem;
}

/* Hero Mockup */
.hero-visual {
    display: flex;
    justify-content: center;
}

.hero-mockup {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    width: 100%;
    max-width: 400px;
}

.mockup-header {
    background: var(--background);
    padding: 12px 16px;
    display: flex;
    gap: 8px;
}

.mockup-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-color);
}

.mockup-dot:first-child {
    background: #ff6b6b;
}

.mockup-dot:nth-child(2) {
    background: #ffd93d;
}

.mockup-dot:nth-child(3) {
    background: #6bcb77;
}

.mockup-content {
    padding: 24px;
}

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

.mockup-stat:last-child {
    border-bottom: none;
}

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

.mockup-value {
    font-weight: 700;
    font-size: 1.1rem;
    font-variant-numeric: tabular-nums;
}

.mockup-value.positive {
    color: var(--success-color);
}

/* Section Styles */
.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 48px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Features Section */
.features {
    padding: 100px 0;
    background: var(--background);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.feature-card {
    background: var(--surface);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.feature-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.feature-description {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* How It Works Section */
.how-it-works {
    padding: 100px 0;
    background: var(--surface);
}

.steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 24px;
    max-width: 900px;
    margin: 0 auto;
}

.step {
    flex: 1;
    text-align: center;
    max-width: 250px;
}

.step-number {
    width: 56px;
    height: 56px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto 20px;
}

.step-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.step-description {
    color: var(--text-secondary);
    line-height: 1.6;
}

.step-divider {
    width: 60px;
    height: 2px;
    background: var(--border-color);
    margin-top: 28px;
    flex-shrink: 0;
}

/* CTA Section */
.cta {
    padding: 100px 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.cta-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.cta-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: white;
    margin-bottom: 16px;
}

.cta-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 32px;
}

.cta .btn-primary {
    background: white;
    color: var(--primary-color);
}

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

/* Landing Footer */
.landing-footer {
    padding: 60px 0 30px;
    background: var(--text-primary);
    color: white;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-brand .logo {
    color: white;
    font-size: 1.25rem;
}

.footer-tagline {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    margin-top: 8px;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    padding-top: 30px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 12px;
    }
    
    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .expense-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .expense-amount {
        margin-right: 0;
    }
    
    .table th,
    .table td {
        padding: 8px 12px;
    }
    
    .month-nav {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .month-nav-current {
        min-width: auto;
        width: 100%;
        order: -1;
    }
    
    /* Landing Page Responsive */
    .hero {
        padding: 120px 0 60px;
        min-height: auto;
    }
    
    .hero .container {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }
    
    .hero-title {
        font-size: 2.25rem;
    }
    
    .hero-subtitle {
        margin-left: auto;
        margin-right: auto;
    }
    
    .hero-actions {
        justify-content: center;
    }
    
    .hero-visual {
        order: -1;
    }
    
    .hero-mockup {
        max-width: 320px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .steps {
        flex-direction: column;
        align-items: center;
    }
    
    .step-divider {
        width: 2px;
        height: 40px;
        margin: 0;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    .cta-title {
        font-size: 1.75rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 24px;
        text-align: center;
    }
    
    .landing-nav {
        gap: 8px;
    }
    
    .landing-nav .btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero-title {
        font-size: 2.75rem;
    }
}
