/* ============================================
   FreelancerAI — Design System & Styles
   100% Local AI Invoice & Receipt Sorter
   ============================================ */

/* ---- CSS Variables / Design Tokens ---- */
:root {
    /* Core palette */
    --bg-primary: #06080d;
    --bg-secondary: #0c1018;
    --bg-card: rgba(14, 19, 30, 0.85);
    --bg-card-hover: rgba(20, 28, 45, 0.92);
    --bg-elevated: rgba(22, 30, 48, 0.95);
    --bg-glass: rgba(16, 22, 38, 0.65);

    /* Accent colors */
    --accent-primary: #6c5ce7;
    --accent-primary-light: #a29bfe;
    --accent-secondary: #00cec9;
    --accent-warm: #fd79a8;
    --accent-gold: #fdcb6e;
    --accent-green: #00b894;
    --accent-red: #e17055;
    --accent-blue: #74b9ff;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 50%, #74b9ff 100%);
    --gradient-warm: linear-gradient(135deg, #fd79a8 0%, #fdcb6e 100%);
    --gradient-cool: linear-gradient(135deg, #00cec9 0%, #6c5ce7 100%);
    --gradient-glass: linear-gradient(135deg, rgba(108, 92, 231, 0.12) 0%, rgba(0, 206, 201, 0.08) 100%);
    --gradient-card: linear-gradient(145deg, rgba(20, 28, 48, 0.6) 0%, rgba(10, 14, 24, 0.8) 100%);

    /* Text */
    --text-primary: #e8ecf4;
    --text-secondary: #8b95a8;
    --text-muted: #5a6478;
    --text-accent: #a29bfe;

    /* Borders */
    --border-subtle: rgba(108, 92, 231, 0.15);
    --border-medium: rgba(108, 92, 231, 0.25);
    --border-accent: rgba(108, 92, 231, 0.45);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 30px rgba(108, 92, 231, 0.2);
    --shadow-glow-accent: 0 0 40px rgba(0, 206, 201, 0.15);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Global Reset & Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ---- Animated Background ---- */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(108, 92, 231, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(108, 92, 231, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: 0;
    pointer-events: none;
}

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
    animation: float 20s ease-in-out infinite;
}

.bg-glow-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(108, 92, 231, 0.25) 0%, transparent 70%);
    top: -200px;
    left: -100px;
    animation-delay: 0s;
}

.bg-glow-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(0, 206, 201, 0.18) 0%, transparent 70%);
    bottom: -150px;
    right: -100px;
    animation-delay: -7s;
}

.bg-glow-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(253, 121, 168, 0.12) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -40px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(40px, 30px) scale(1.02); }
}

/* ---- Header ---- */
#app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(6, 8, 13, 0.82);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-md) var(--space-xl);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
}

.logo-group {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.logo-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-glow);
    transition: transform var(--transition-spring);
}

.logo-icon:hover {
    transform: rotate(-6deg) scale(1.08);
}

.logo-icon i {
    width: 24px;
    height: 24px;
    color: white;
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-badge {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.8;
}

.header-nav {
    display: flex;
    gap: var(--space-xs);
    background: rgba(14, 19, 30, 0.6);
    padding: 4px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.825rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.nav-btn i {
    width: 16px;
    height: 16px;
}

.nav-btn:hover {
    color: var(--text-primary);
    background: rgba(108, 92, 231, 0.1);
}

.nav-btn.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 12px rgba(108, 92, 231, 0.35);
}

.header-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(0, 184, 148, 0.08);
    border: 1px solid rgba(0, 184, 148, 0.2);
    border-radius: var(--radius-full);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 184, 148, 0.6); }
    50% { box-shadow: 0 0 0 6px rgba(0, 184, 148, 0); }
}

.status-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-green);
    letter-spacing: 0.02em;
}

/* ---- Main Content ---- */
#app-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-xl);
    position: relative;
    z-index: 1;
}

.view {
    display: none;
    animation: fadeInUp 0.5s var(--transition-smooth) both;
}

.view.active {
    display: block;
}

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

.section-header {
    margin-bottom: var(--space-xl);
}

.section-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-sm);
}

.section-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 600px;
}

/* ---- Upload Zone ---- */
.upload-zone {
    position: relative;
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-xl);
    padding: var(--space-3xl) var(--space-xl);
    text-align: center;
    cursor: pointer;
    background: var(--gradient-glass);
    backdrop-filter: blur(16px);
    transition: all var(--transition-smooth);
    overflow: hidden;
}

.upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-smooth);
    z-index: 0;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent-primary);
    background: rgba(108, 92, 231, 0.08);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.upload-zone.drag-over::before {
    opacity: 0.06;
}

.upload-zone-inner {
    position: relative;
    z-index: 1;
}

.upload-icon-ring {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
    background: rgba(108, 92, 231, 0.1);
    border: 2px solid rgba(108, 92, 231, 0.25);
    border-radius: 50%;
    transition: all var(--transition-spring);
}

.upload-zone:hover .upload-icon-ring {
    transform: scale(1.1);
    background: rgba(108, 92, 231, 0.18);
    border-color: var(--accent-primary);
}

.upload-icon-ring i {
    width: 36px;
    height: 36px;
    color: var(--accent-primary-light);
}

.upload-zone h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    letter-spacing: -0.01em;
}

.upload-zone > .upload-zone-inner > p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: var(--space-lg);
}

.upload-features {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.upload-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(14, 19, 30, 0.6);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
}

.upload-chip i {
    width: 14px;
    height: 14px;
    color: var(--accent-secondary);
}

/* ---- Processing Section ---- */
.processing-section {
    margin-top: var(--space-xl);
}

.processing-section h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    color: var(--accent-primary-light);
}

.spin {
    animation: spin 1.5s linear infinite;
}

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

.processing-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.processing-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    animation: fadeInUp 0.3s ease both;
}

.processing-item .file-name {
    font-size: 0.875rem;
    font-weight: 500;
    flex: 1;
}

.processing-item .progress-bar {
    width: 140px;
    height: 6px;
    background: rgba(108, 92, 231, 0.15);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.processing-item .progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
    box-shadow: 0 0 10px rgba(108, 92, 231, 0.4);
}

.processing-item .status-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 90px;
    text-align: right;
}

/* ---- Results Grid ---- */
.recent-section {
    margin-top: var(--space-2xl);
}

.recent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.recent-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.recent-header h3 i {
    color: var(--accent-gold);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-lg);
}

.result-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-smooth);
    animation: fadeInUp 0.4s ease both;
}

.result-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-accent);
    box-shadow: var(--shadow-glow);
}

.result-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.result-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-full);
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent-primary-light);
    border: 1px solid rgba(108, 92, 231, 0.25);
}

.result-card-header .result-amount {
    font-size: 1.2rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-green);
}

.result-card-body {
    padding: var(--space-lg);
}

.result-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
}

.result-field:not(:last-child) {
    border-bottom: 1px solid rgba(108, 92, 231, 0.06);
}

.result-field-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.result-field-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-card-actions {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-subtle);
}

.result-card-actions button {
    flex: 1;
}

/* ---- Stats Grid ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: all var(--transition-smooth);
}

.stat-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(108, 92, 231, 0.12);
    border: 1px solid rgba(108, 92, 231, 0.2);
}

.stat-icon i {
    width: 22px;
    height: 22px;
    color: var(--accent-primary-light);
}

#stat-total .stat-icon {
    background: rgba(0, 184, 148, 0.12);
    border-color: rgba(0, 184, 148, 0.2);
}
#stat-total .stat-icon i { color: var(--accent-green); }

#stat-count .stat-icon {
    background: rgba(116, 185, 255, 0.12);
    border-color: rgba(116, 185, 255, 0.2);
}
#stat-count .stat-icon i { color: var(--accent-blue); }

#stat-avg .stat-icon {
    background: rgba(253, 203, 110, 0.12);
    border-color: rgba(253, 203, 110, 0.2);
}
#stat-avg .stat-icon i { color: var(--accent-gold); }

#stat-categories .stat-icon {
    background: rgba(253, 121, 168, 0.12);
    border-color: rgba(253, 121, 168, 0.2);
}
#stat-categories .stat-icon i { color: var(--accent-warm); }

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -0.02em;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

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

.dash-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.dash-card.full-width {
    margin-top: 0;
}

.dash-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-secondary);
}

.dash-card h3 i {
    width: 18px;
    height: 18px;
    color: var(--accent-primary-light);
}

/* Category Bars */
.category-bars {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.category-bar-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.category-bar-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-bar-name {
    font-size: 0.825rem;
    font-weight: 500;
}

.category-bar-amount {
    font-size: 0.825rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-primary-light);
}

.category-bar-track {
    width: 100%;
    height: 8px;
    background: rgba(108, 92, 231, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.category-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 0 10px currentColor;
}

/* Timeline */
.timeline-chart {
    display: flex;
    align-items: flex-end;
    gap: var(--space-sm);
    min-height: 180px;
    padding-top: var(--space-md);
}

.timeline-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.timeline-bar-fill {
    width: 100%;
    min-height: 4px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: height 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 -4px 15px rgba(108, 92, 231, 0.25);
}

.timeline-bar-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
}

.timeline-bar-amount {
    font-size: 0.7rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
}

/* ---- Receipts Table ---- */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.table-controls {
    display: flex;
    gap: var(--space-sm);
}

.filter-select {
    padding: var(--space-sm) var(--space-md);
    background: rgba(14, 19, 30, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.receipts-table-wrapper {
    overflow-x: auto;
}

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

.receipts-table th {
    padding: var(--space-md);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.receipts-table td {
    padding: var(--space-md);
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(108, 92, 231, 0.06);
    color: var(--text-primary);
}

.receipts-table tbody tr {
    transition: background var(--transition-fast);
}

.receipts-table tbody tr:hover {
    background: rgba(108, 92, 231, 0.05);
}

.receipts-table .amount-cell {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--accent-green);
}

.receipts-table .category-cell {
    display: inline-flex;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(108, 92, 231, 0.1);
    border-radius: var(--radius-full);
    color: var(--accent-primary-light);
    border: 1px solid rgba(108, 92, 231, 0.2);
}

.receipts-table .action-btns {
    display: flex;
    gap: var(--space-xs);
}

/* ---- Export Section ---- */
.export-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.export-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    transition: all var(--transition-smooth);
}

.export-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.export-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
    background: rgba(108, 92, 231, 0.1);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(108, 92, 231, 0.2);
}

.export-icon i {
    width: 28px;
    height: 28px;
    color: var(--accent-primary-light);
}

.export-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.export-card p {
    font-size: 0.825rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    line-height: 1.5;
}

/* Privacy Banner */
.privacy-banner {
    display: flex;
    align-items: flex-start;
    gap: var(--space-lg);
    padding: var(--space-lg);
    background: rgba(0, 206, 201, 0.05);
    border: 1px solid rgba(0, 206, 201, 0.15);
    border-radius: var(--radius-lg);
}

.privacy-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 206, 201, 0.12);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.privacy-icon i {
    width: 24px;
    height: 24px;
    color: var(--accent-secondary);
}

.privacy-content h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
    color: var(--accent-secondary);
}

.privacy-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ---- Buttons ---- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 2px 10px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(108, 92, 231, 0.45);
}

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

.btn-primary i {
    width: 16px;
    height: 16px;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-ghost:hover {
    background: rgba(108, 92, 231, 0.08);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.btn-ghost i {
    width: 14px;
    height: 14px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(108, 92, 231, 0.12);
    color: var(--accent-primary-light);
    border-color: var(--border-medium);
}

.btn-icon.danger:hover {
    background: rgba(225, 112, 85, 0.12);
    color: var(--accent-red);
    border-color: rgba(225, 112, 85, 0.3);
}

.btn-icon i {
    width: 15px;
    height: 15px;
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    animation: fadeIn 0.2s ease;
}

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

.modal-card {
    width: 100%;
    max-width: 480px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: modalPop 0.3s var(--transition-spring);
}

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

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

.modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.modal-header h3 i {
    width: 18px;
    height: 18px;
    color: var(--accent-primary-light);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(225, 112, 85, 0.1);
    color: var(--accent-red);
    border-color: rgba(225, 112, 85, 0.3);
}

.modal-close i {
    width: 16px;
    height: 16px;
}

.modal-body {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-subtle);
}

/* ---- Form Elements ---- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    padding: var(--space-sm) var(--space-md);
    background: rgba(14, 19, 30, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

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

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

/* ---- Toast Notifications ---- */
.toast-container {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    z-index: 300;
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.4s var(--transition-spring);
    max-width: 380px;
}

.toast.leaving {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

.toast-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.toast.success .toast-icon {
    background: rgba(0, 184, 148, 0.15);
    color: var(--accent-green);
}

.toast.error .toast-icon {
    background: rgba(225, 112, 85, 0.15);
    color: var(--accent-red);
}

.toast.info .toast-icon {
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent-primary-light);
}

.toast-icon i {
    width: 18px;
    height: 18px;
}

.toast-message {
    font-size: 0.825rem;
    font-weight: 500;
    line-height: 1.4;
}

/* ---- Empty States ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
    text-align: center;
}

.empty-state i {
    width: 40px;
    height: 40px;
    margin-bottom: var(--space-md);
    opacity: 0.4;
}

.empty-state.small {
    padding: var(--space-xl);
}

.empty-state.small i {
    width: 28px;
    height: 28px;
}

.empty-state p {
    font-size: 0.85rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    #app-header {
        padding: var(--space-sm) var(--space-md);
    }

    .header-inner {
        flex-wrap: wrap;
        gap: var(--space-sm);
    }

    .header-nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .header-status {
        order: 2;
    }

    #app-main {
        padding: var(--space-md);
    }

    .section-header h2 {
        font-size: 1.4rem;
    }

    .upload-zone {
        padding: var(--space-xl) var(--space-md);
    }

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

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

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

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .nav-btn span {
        display: none;
    }

    .toast-container {
        left: var(--space-md);
        right: var(--space-md);
    }

    .toast {
        max-width: 100%;
    }
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(108, 92, 231, 0.25);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(108, 92, 231, 0.4);
}

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

/* Category color mappings */
[data-category="Food & Dining"] .category-bar-fill { background: var(--accent-warm); color: var(--accent-warm); }
[data-category="Transportation"] .category-bar-fill { background: var(--accent-blue); color: var(--accent-blue); }
[data-category="Office Supplies"] .category-bar-fill { background: var(--accent-gold); color: var(--accent-gold); }
[data-category="Software & Subscriptions"] .category-bar-fill { background: var(--accent-primary); color: var(--accent-primary); }
[data-category="Travel"] .category-bar-fill { background: var(--accent-secondary); color: var(--accent-secondary); }
[data-category="Utilities"] .category-bar-fill { background: var(--accent-green); color: var(--accent-green); }
[data-category="Professional Services"] .category-bar-fill { background: #e056a0; color: #e056a0; }
[data-category="Marketing"] .category-bar-fill { background: #e17055; color: #e17055; }
[data-category="Equipment"] .category-bar-fill { background: #00b4d8; color: #00b4d8; }
[data-category="Other"] .category-bar-fill { background: var(--text-muted); color: var(--text-muted); }
