/* Blue Collar Receipts - Dark Navy Theme, Mobile-First */

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

:root {
    --primary: #1a365d;
    --primary-light: #2d5a87;
    --accent: #4299e1;
    --success: #38a169;
    --warning: #d69e2e;
    --error: #e53e3e;
    --text: #2d3748;
    --text-sec: #718096;
    --text-light: #a0aec0;
    --border: #e2e8f0;
    --bg: #f7fafc;
    --bg-card: #fff;
    --sidebar-bg: #1a365d;
    --sidebar-text: #fff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* === BUTTONS === */
.btn-primary, .btn-secondary, .btn-ghost, .btn-ghost-dark, .btn-danger {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border: 2px solid transparent; border-radius: 8px;
    font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.15s;
    text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-secondary:hover { background: var(--primary); color: #fff; }
.btn-ghost { background: transparent; color: var(--sidebar-text); border: 1px solid rgba(255,255,255,0.3); }
.btn-ghost:hover { background: rgba(255,255,255,0.1); }
.btn-ghost-dark { background: transparent; color: var(--text); border: 1px solid var(--border); padding: 6px 14px; font-size: 13px; }
.btn-ghost-dark:hover { background: var(--bg); }
.btn-danger { background: var(--error); color: #fff; border-color: var(--error); }
.btn-danger:hover { background: #c53030; }
.btn-small { padding: 6px 14px; font-size: 13px; }
.btn-large { padding: 14px 28px; font-size: 17px; }
.btn-full { width: 100%; }

/* === FORMS === */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 12px; border: 2px solid var(--border); border-radius: 8px; font-size: 16px; transition: border-color 0.15s;
    background: #fff; color: var(--text);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.radio-row { display: flex; gap: 20px; flex-wrap: wrap; }
.radio-label { display: flex; align-items: center; gap: 6px; font-size: 15px; cursor: pointer; }

/* === LANDING PAGE === */
.landing-page { min-height: 100vh; background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; }
.landing-header { padding: 20px 0; background: rgba(0,0,0,0.1); }
.landing-header .container { display: flex; flex-direction: column; align-items: center; gap: 16px; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.logo-section { display: flex; align-items: center; gap: 12px; }
.logo { height: 300px; width: auto; max-width: 90vw; border-radius: 16px; }
.logo-text { display: none; }
.landing-header .container { flex-direction: column; align-items: center; }
.landing-nav { display: flex; gap: 12px; }
.hero { padding: 60px 20px; text-align: center; }
.hero-content { max-width: 700px; margin: 0 auto; }
.hero-content h1 { font-size: 2.2rem; margin-bottom: 20px; line-height: 1.1; }
.hero-subtitle { font-size: 1.15rem; margin-bottom: 28px; opacity: 0.9; }
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.features { padding: 60px 20px; background: #fff; color: var(--text); }
.features h2 { text-align: center; margin-bottom: 40px; color: var(--primary); font-size: 2rem; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; max-width: 1200px; margin: 0 auto; }
.feature-card { text-align: center; padding: 30px 20px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); transition: transform 0.15s; }
.feature-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.feature-icon { font-size: 2.5rem; margin-bottom: 16px; }
.feature-card h3 { color: var(--primary); margin-bottom: 8px; }

/* === AUTH MODAL === */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 20px; }
.modal-content { background: #fff; padding: 32px; border-radius: 16px; max-width: 480px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-large { max-width: 600px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-header h2 { color: var(--primary); font-size: 1.4rem; }
.modal-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; gap: 12px; }
.modal-actions > div { display: flex; gap: 8px; }
.close { color: var(--text-sec); font-size: 28px; font-weight: bold; cursor: pointer; line-height: 1; }
.close:hover { color: var(--text); }
.auth-form h2 { text-align: center; color: var(--primary); margin-bottom: 24px; }
.auth-links { text-align: center; margin-top: 16px; font-size: 14px; }
.auth-links a { color: var(--accent); text-decoration: none; }

/* === MAIN APP LAYOUT === */
.main-app { display: flex; height: 100vh; position: relative; }

/* Mobile header */
.mobile-header {
    display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 90;
    background: var(--primary); color: #fff; padding: 12px 16px;
    display: flex; align-items: center; justify-content: space-between;
}
.hamburger { background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; padding: 4px 8px; }
.mobile-title { font-weight: 700; font-size: 16px; }
.close-sidebar { display: none; background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; }

/* Sidebar overlay */
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 99; }

/* Sidebar */
.sidebar {
    width: 260px; min-width: 260px; background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column; overflow-y: auto; z-index: 100;
}
.sidebar-header { padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; min-height: 140px; position: relative; }
.sidebar-header .close-sidebar { position: absolute; top: 12px; right: 12px; }
.sidebar-title { font-weight: 700; font-size: 20px; }
.sidebar-logo { height: 120px; width: 120px; border-radius: 12px; object-fit: cover; }
.company-switcher { padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.company-switcher label { display: block; margin-bottom: 6px; font-size: 12px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.5px; }
.company-switcher select {
    width: 100%; padding: 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1); color: #fff; font-size: 14px;
}
.company-switcher select option { color: var(--text); background: #fff; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 12px 20px; color: var(--sidebar-text); text-decoration: none; transition: background 0.15s; font-size: 15px; }
.nav-item:hover { background: rgba(255,255,255,0.08); }
.nav-item.active { background: rgba(255,255,255,0.12); border-right: 3px solid var(--accent); }
.nav-icon { font-size: 16px; width: 24px; text-align: center; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.user-info { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }

/* Main content */
.main-content { flex: 1; padding: 24px; overflow-y: auto; background: var(--bg); }

/* === VIEWS === */
.view-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.view-header h1 { font-size: 1.8rem; color: var(--primary); }
.subtitle { color: var(--text-sec); font-size: 14px; margin-top: 4px; }

/* Cards */
.card { background: var(--bg-card); border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 16px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--primary); }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); padding: 16px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); text-align: center; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.stat-label { color: var(--text-sec); font-size: 13px; }

/* Dashboard nav cards */
.dash-nav-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.dash-nav-card {
    background: var(--bg-card); padding: 24px; border-radius: 12px; text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08); cursor: pointer; transition: all 0.15s;
    border: 2px solid transparent;
}
.dash-nav-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.dash-nav-icon { font-size: 2.5rem; margin-bottom: 8px; }
.dash-nav-count { font-size: 2rem; font-weight: 800; color: var(--primary); }
.dash-nav-label { font-size: 1rem; color: var(--text-sec); font-weight: 600; }

/* Job section in dashboard */
.job-breakdown { margin-bottom: 16px; }
.job-breakdown-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; cursor: pointer; }
.job-breakdown-header:hover { color: var(--accent); }
.job-breakdown-name { font-weight: 700; color: var(--primary); }
.job-breakdown-total { font-weight: 700; color: var(--primary); }

/* Lang toggle */
.lang-toggle { font-size: 12px; font-weight: 700; padding: 4px 10px; min-width: auto; }

/* Dashboard grid */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Filters */
.filters-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: flex-end; }
.filter-input { padding: 10px 12px; border: 2px solid var(--border); border-radius: 8px; font-size: 14px; min-width: 120px; flex: 1; }
.filter-select { padding: 10px 12px; border: 2px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; min-width: 120px; }

/* List items */
.list-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.list-item:last-child { border-bottom: none; }
.list-item-title { font-weight: 600; font-size: 15px; }
.list-item-sub { font-size: 13px; color: var(--text-sec); margin-top: 2px; }
.list-item-amount { font-weight: 700; font-size: 16px; color: var(--primary); white-space: nowrap; }

/* Breakdown rows */
.breakdown-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.breakdown-row:last-child { border-bottom: none; }
.breakdown-info { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 14px; }
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.3s; }

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-sec); font-size: 15px; }

/* === EXPENSE CARDS === */
.expense-card {
    padding: 14px; border: 1px solid var(--border); border-radius: 10px;
    margin-bottom: 8px; cursor: pointer; transition: box-shadow 0.15s;
}
.expense-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.expense-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.expense-card-vendor { font-weight: 600; font-size: 15px; }
.expense-card-amount { font-weight: 700; font-size: 16px; color: var(--primary); }
.expense-card-details { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text-sec); }
.expense-card-notes { font-size: 13px; color: var(--text-sec); margin-top: 4px; font-style: italic; }

/* === JOB CARDS === */
.job-card {
    padding: 16px; border: 1px solid var(--border); border-radius: 10px;
    margin-bottom: 10px; cursor: pointer; transition: box-shadow 0.15s;
}
.job-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.job-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.job-card-name { font-weight: 700; font-size: 16px; color: var(--primary); }
.job-card-customer { font-size: 14px; color: var(--text-sec); margin-top: 2px; }
.job-card-desc { font-size: 14px; color: var(--text-sec); margin-bottom: 10px; }
.job-card-stats { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-sec); border-top: 1px solid var(--border); padding-top: 10px; }
.job-card-total { font-weight: 700; color: var(--primary); }

/* === BADGES === */
.badge {
    display: inline-block; padding: 2px 10px; border-radius: 12px;
    font-size: 12px; font-weight: 600; text-transform: capitalize;
    background: var(--border); color: var(--text-sec);
}
.badge-active { background: #c6f6d5; color: #22543d; }
.badge-completed { background: #bee3f8; color: #2a4365; }
.badge-archived { background: #e2e8f0; color: #4a5568; }
.badge-cash { background: #c6f6d5; color: #22543d; }
.badge-credit { background: #bee3f8; color: #2a4365; }
.badge-check { background: #fefcbf; color: #744210; }

/* === RECEIPT CAPTURE === */
.receipt-capture-row { display: flex; gap: 10px; margin-bottom: 16px; }
.receipt-capture-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px; border: 2px dashed var(--border); border-radius: 10px;
    background: var(--bg); cursor: pointer; font-size: 15px; font-weight: 600; transition: all 0.15s;
}
.receipt-capture-btn:hover { border-color: var(--accent); background: #edf2f7; }
.ocr-status { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 12px; border-radius: 6px; background: #ebf8ff; color: var(--primary-light); font-size: 14px; }
.receipt-thumb-preview { margin-bottom: 12px; text-align: center; }
.receipt-thumb-preview img { max-width: 160px; max-height: 120px; border-radius: 8px; border: 1px solid var(--border); object-fit: cover; }

/* Report quick links */
.report-quick-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

/* Settings */
.settings-info .list-item { font-size: 15px; }

/* === TOAST === */
.toast {
    position: fixed; top: 20px; right: 20px; padding: 14px 20px; border-radius: 10px;
    background: var(--success); color: #fff; font-weight: 600; font-size: 15px;
    z-index: 2000; transform: translateX(120%); transition: transform 0.3s ease;
    max-width: 90vw;
}
.toast.show { transform: translateX(0); }
.toast.error { background: var(--error); }
.toast.warning { background: var(--warning); }

/* === SPINNER === */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid #ccc; border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === RESPONSIVE — MOBILE FIRST === */
@media (max-width: 768px) {
    .mobile-header { display: flex; }
    .close-sidebar { display: block; }

    .main-app { flex-direction: column; }

    .sidebar {
        position: fixed; top: 0; left: -280px; bottom: 0; width: 280px;
        transition: left 0.3s ease; z-index: 100;
    }
    .sidebar.sidebar-open { left: 0; }
    .sidebar.sidebar-open ~ .sidebar-overlay { display: block; }

    .main-content { padding: 72px 16px 24px; width: 100%; }

    .view-header { flex-direction: column; }
    .view-header h1 { font-size: 1.4rem; }

    .dashboard-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-value { font-size: 1.4rem; }

    .form-row { grid-template-columns: 1fr; }
    .filters-row { flex-direction: column; }
    .filter-input, .filter-select { min-width: 100%; }

    .modal-content { padding: 20px; margin: 10px; border-radius: 12px; }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions > div { width: 100%; display: flex; gap: 8px; }
    .modal-actions > div button { flex: 1; }
    .modal-actions > button { width: 100%; }

    .hero-content h1 { font-size: 1.8rem; }
    .hero-actions { flex-direction: column; }
    .hero-actions .btn-large { width: 100%; }

    .logo { height: 180px; }
    .dash-nav-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-nav-count { font-size: 1.6rem; }
}

/* Report list rows */
.report-list-row { display: flex; align-items: center; padding: 12px 8px; border-bottom: 1px solid var(--border); gap: 12px; }
.report-list-row:last-child { border-bottom: none; }
.report-list-label { font-weight: 600; flex: 1; }
.report-list-meta { color: var(--text-sec); font-size: 13px; white-space: nowrap; }
.report-list-amount { font-weight: 700; font-size: 16px; white-space: nowrap; }
.breakdown-clickable { cursor: pointer; border-radius: 8px; transition: background 0.15s; }
.breakdown-clickable:hover { background: rgba(66, 153, 225, 0.08); }
.breakdown-clickable:active { background: rgba(66, 153, 225, 0.15); }

/* Desktop: hide mobile header */
@media (min-width: 769px) {
    .mobile-header { display: none !important; }
    .close-sidebar { display: none !important; }
    .sidebar-overlay { display: none !important; }
}
