/* ===== EMPLOYEE DASHBOARD — Mobile-First CSS ===== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --brand-navy: #0D2249;
    --brand-blue: #3498DB;
    --brand-blue-light: #5DADE2;
    --brand-blue-pale: rgba(52,152,219,0.08);
    --brand-blue-glow: rgba(52,152,219,0.15);
    --brand-topbar: #245a8c;

    --bg: #F4F6F9;
    --bg-white: #FFFFFF;
    --text: #1A1D23;
    --text-secondary: #5F6B7A;
    --text-muted: #9CA3AF;
    --border: #E2E8F0;
    --border-light: #F1F3F5;

    --green: #10B981;
    --green-bg: #ECFDF5;
    --orange: #F59E0B;
    --orange-bg: #FFFBEB;
    --red: #EF4444;
    --red-bg: #FEF2F2;
    --purple: #7C3AED;
    --purple-bg: #EDE9FE;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ===== AUTH SCREEN ===== */
#auth-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 20px;
    background: linear-gradient(135deg, var(--brand-navy) 0%, #1a3a6b 100%);
}

.auth-card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 32px 24px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.auth-logo { font-size: 48px; margin-bottom: 12px; }
.auth-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.auth-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; }

.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-white);
    color: var(--text);
    margin-bottom: 10px;
    transition: background 0.2s, box-shadow 0.2s;
}
.oauth-btn:hover { background: var(--bg); box-shadow: var(--shadow-sm); }

.apple-btn { background: #000; color: #fff; border-color: #000; }
.apple-btn:hover { background: #222; }

#join-screen { margin-top: 20px; }
#join-screen .auth-card input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: var(--font);
    margin-bottom: 12px;
}

.text-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font);
}
.text-btn:hover { color: var(--text-secondary); }

/* ===== APP WRAPPER ===== */
.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

/* ===== TOPBAR ===== */
.topbar {
    background: var(--brand-topbar);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    -webkit-app-region: drag;
}
.topbar-left { display: flex; align-items: center; gap: 8px; }
.topbar-emoji { font-size: 22px; }
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.topbar-logo {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    object-fit: contain;
    background: rgba(255,255,255,0.15);
}

.topbar-btn:hover { background: rgba(255,255,255,0.25); }

/* ===== NAVIGATION ===== */
.nav-bar {
    display: flex;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 15;
    padding: 0;
}

.nav-btn {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 10px 0 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
    border-bottom: 2px solid transparent;
}

.nav-btn.active {
    color: var(--brand-blue);
    border-bottom-color: var(--brand-blue);
}

.nav-btn svg { flex-shrink: 0; opacity: 0.6; }
.nav-btn.active svg { opacity: 1; }

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

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

/* ===== WELCOME CARD ===== */
.welcome-card {
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-light));
    color: white;
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.welcome-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.welcome-sub { font-size: 13px; opacity: 0.85; }

/* ===== STATS ROW ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    padding: 14px 10px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.stat-number { font-size: 24px; font-weight: 700; color: var(--brand-blue); }
.stat-label { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-top: 2px; }

/* ===== QUICK ACTIONS ===== */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}
.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font);
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.quick-action-btn:hover { background: var(--brand-blue-pale); border-color: var(--brand-blue); }
.quick-action-btn svg { color: var(--brand-blue); flex-shrink: 0; }

/* ===== SECTION HEADER ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.section-header h3 { font-size: 15px; font-weight: 600; color: var(--text); }

/* ===== FILTER ROW ===== */
.filter-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 10px;
    -webkit-overflow-scrolling: touch;
}
.filter-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-white);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}
.filter-btn.active {
    background: var(--brand-blue);
    color: white;
    border-color: var(--brand-blue);
}

/* ===== SEARCH BAR ===== */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}
.search-bar svg { color: var(--text-muted); flex-shrink: 0; }
.search-bar input {
    border: none;
    outline: none;
    font-size: 14px;
    font-family: var(--font);
    color: var(--text);
    width: 100%;
    background: transparent;
}

/* ===== LIST CONTAINER ===== */
.list-container { display: flex; flex-direction: column; gap: 8px; }

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: box-shadow 0.2s;
}
.list-item:hover { box-shadow: var(--shadow); }
.list-item:active { transform: scale(0.99); }

.list-item-left { flex: 1; min-width: 0; }
.list-item-id {
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-blue);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.list-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.list-item-sub {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.list-item-right { flex-shrink: 0; margin-left: 12px; }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-active  { background: var(--green-bg); color: var(--green); }
.badge-proceed { background: var(--purple-bg); color: var(--purple); }
.badge-delayed { background: var(--red-bg); color: var(--red); }
.badge-complete { background: #F3F4F6; color: #6B7280; }

.labour-tag {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg);
    padding: 1px 6px;
    border-radius: 4px;
}

/* ===== FORM CARD ===== */
.form-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.form-card label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    margin-top: 14px;
}
.form-card label:first-child { margin-top: 0; }

.optional-label { font-weight: 400; color: var(--text-muted); }

.form-card input, .form-card select, .form-card textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-white);
    transition: border-color 0.2s;
}
.form-card input:focus, .form-card select:focus, .form-card textarea:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px var(--brand-blue-pale);
}
.form-card textarea { resize: vertical; }

/* ===== JOB SELECT ROW ===== */
.job-select-row {
    display: flex;
    gap: 8px;
}
.job-select-row select { flex: 1; }

.small-btn {
    padding: 8px 14px;
    border: 1px solid var(--brand-blue);
    background: var(--brand-blue-pale);
    color: var(--brand-blue);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    white-space: nowrap;
}
.small-btn:hover { background: var(--brand-blue); color: white; }

/* ===== INLINE NEW JOB ===== */
.inline-new-job {
    background: var(--brand-blue-pale);
    border: 1px solid var(--brand-blue);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-top: 10px;
}
.inline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 14px;
    color: var(--brand-blue);
}
.inline-new-job input, .inline-new-job select {
    margin-bottom: 8px;
}

/* ===== TIME ROW ===== */
.time-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ===== WEEK TOTAL ===== */
.week-total {
    font-size: 16px;
    font-weight: 700;
    color: var(--brand-blue);
}

/* ===== HOURS ENTRY LIST ===== */
.hours-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}
.hours-entry-left { flex: 1; }
.hours-entry-job { font-size: 13px; font-weight: 600; color: var(--text); }
.hours-entry-date { font-size: 11px; color: var(--text-muted); }
.hours-entry-notes { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.hours-entry-amount {
    font-size: 18px;
    font-weight: 700;
    color: var(--brand-blue);
    margin-left: 12px;
}
.hours-entry-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
}
.hours-entry-delete:hover { color: var(--red); }

/* ===== PHOTO UPLOAD ===== */
.photo-upload-area {
    margin-top: 6px;
}
.photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}
.photo-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg);
}
.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-thumb-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-add-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-muted);
    font-size: 14px;
    font-family: var(--font);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    width: 100%;
    justify-content: center;
}
.photo-add-btn:hover { border-color: var(--brand-blue); color: var(--brand-blue); }

/* ===== REPORT HISTORY ===== */
.report-entry {
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
}
.report-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.report-entry-job { font-size: 13px; font-weight: 600; color: var(--brand-blue); }
.report-entry-date { font-size: 11px; color: var(--text-muted); }
.report-entry-notes { font-size: 13px; color: var(--text); line-height: 1.5; }
.report-entry-materials { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.report-entry-photos {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    overflow-x: auto;
}
.report-photo-mini {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

/* ===== ACTION BUTTONS ===== */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    background: var(--brand-blue);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.action-btn:hover { filter: brightness(1.1); }
.action-btn:active { transform: scale(0.98); }
.action-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.outline-btn {
    background: transparent;
    color: var(--brand-blue);
    border: 2px solid var(--brand-blue);
}
.outline-btn:hover { background: var(--brand-blue-pale); filter: none; }

.close-btn {
    padding: 10px 20px;
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
}

/* ===== OVERLAYS & MODALS ===== */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.edit-modal {
    background: var(--bg-white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 90dvh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.edit-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--brand-blue);
    color: white;
    border-radius: var(--radius) var(--radius) 0 0;
    position: sticky;
    top: 0;
}
.edit-modal-header h3 { font-size: 16px; font-weight: 600; }
.edit-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.8;
}
.edit-close-btn:hover { opacity: 1; }

.settings-body { padding: 20px; }
.settings-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.settings-account-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.settings-provider-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: var(--brand-blue-pale);
    color: var(--brand-blue);
}
.settings-account-email { color: var(--text-secondary); font-size: 13px; }
.settings-logout-btn {
    width: 100%;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font);
    color: var(--text-secondary);
    cursor: pointer;
}
.settings-logout-btn:hover { background: var(--red-bg); color: var(--red); border-color: var(--red); }

/* ===== JOB DETAIL ===== */
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}
.detail-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.detail-value { font-size: 14px; color: var(--text); font-weight: 500; text-align: right; max-width: 60%; }
.detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.detail-actions .action-btn { flex: 1; }

/* ===== SUCCESS CARD ===== */
.success-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 320px;
    width: 100%;
}
.success-icon {
    width: 56px;
    height: 56px;
    background: var(--green-bg);
    color: var(--green);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ===== SPINNER ===== */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== TAB HEADER ===== */
.tab-header {
    margin-bottom: 16px;
}
.tab-header h2 {
    font-size: 22px;
    font-weight: 700;
}

/* ===== UPLOAD PROGRESS ===== */
.upload-progress {
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--brand-blue-pale);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--brand-blue);
    text-align: center;
}

/* ===== DESKTOP ENHANCEMENTS (768px+) ===== */
@media (min-width: 768px) {
    .app-wrapper {
        display: grid;
        grid-template-columns: 220px 1fr;
        grid-template-rows: auto 1fr;
        height: 100vh;
        overflow: hidden;
    }

    .topbar {
        grid-column: 1 / -1;
        grid-row: 1;
        padding: 14px 28px;
    }

    /* Sidebar nav */
    .nav-bar {
        grid-column: 1;
        grid-row: 2;
        flex-direction: column;
        border-bottom: none;
        border-right: 1px solid var(--border);
        position: static;
        padding: 16px 0;
        overflow-y: auto;
        background: var(--bg-white);
    }

    .nav-btn {
        flex: 0 0 auto;
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        padding: 12px 24px;
        font-size: 14px;
        font-weight: 500;
        border-bottom: none;
        border-left: 3px solid transparent;
        border-radius: 0;
        transition: background 0.15s, color 0.15s;
    }

    .nav-btn:hover {
        background: var(--brand-blue-pale);
        color: var(--brand-blue);
    }

    .nav-btn.active {
        color: var(--brand-blue);
        border-bottom: none;
        border-left-color: var(--brand-blue);
        background: var(--brand-blue-pale);
        font-weight: 600;
    }

    .nav-btn svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .nav-btn span {
        white-space: nowrap;
    }

    /* Main content area */
    .main-content {
        grid-column: 2;
        grid-row: 2;
        overflow-y: auto;
        background: var(--bg);
        max-width: none;
        margin: 0;
        padding: 24px;
    }
}
