/* ── Reset & Base ───────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #1565C0;
    --primary-dark: #0D47A1;
    --success: #2E7D32;
    --warning: #E65100;
    --danger: #C62828;
    --surface: #FFFFFF;
    --background: #F5F7FA;
    --text: #212121;
    --text-muted: #757575;
    --border: #E0E0E0;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --offline-bg: #FFF3E0;
    --offline-border: #FF6F00;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

/* ── App Shell ──────────────────────── */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.app-content {
    flex: 1;
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.app-footer {
    text-align: center;
    padding: 12px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* ── Page Header ────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

/* ── Connectivity ───────────────────── */
.connectivity-badge {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

    .connectivity-badge.online {
        background: #E8F5E9;
        color: var(--success);
    }

    .connectivity-badge.offline {
        background: var(--offline-bg);
        color: var(--warning);
    }

.offline-banner {
    background: var(--offline-bg);
    border-left: 4px solid var(--offline-border);
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-weight: 500;
    font-size: 14px;
}

/* ── Task Cards ─────────────────────── */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.task-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    cursor: pointer;
    border: 1px solid var(--border);
    transition: transform 0.1s, box-shadow 0.1s;
}

    .task-card:active {
        transform: scale(0.98);
        box-shadow: none;
    }

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.task-id {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary);
}

.task-customer {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.task-vehicle,
.task-date,
.task-media-count {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

/* ── Detail Card ────────────────────── */
.detail-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

    .info-row:last-child {
        border-bottom: none;
    }

.label {
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Camera ─────────────────────────── */
.camera-section {
    margin-bottom: 16px;
}

    .camera-section.hidden {
        display: none;
    }

    .camera-section.visible {
        display: block;
    }

.camera-preview {
    width: 100%;
    border-radius: var(--radius);
    background: #000;
    max-height: 50dvh;
    object-fit: cover;
    display: block;
}

/* ── Control Panel ──────────────────── */
.control-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

/* ── Buttons ────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 18px;
    border-radius: var(--radius);
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    min-width: 140px;
    transition: opacity 0.15s;
}

    .btn:disabled {
        opacity: 0.5;
        pointer-events: none;
    }

    .btn:active {
        opacity: 0.8;
    }

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-secondary {
    background: #546E7A;
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-back {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px;
}

/* ── Notes ──────────────────────────── */
.notes-section {
    margin-bottom: 16px;
}

.notes-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    resize: vertical;
    font-family: inherit;
}

    .notes-input:focus {
        outline: 2px solid var(--primary);
    }

/* ── Action Buttons ─────────────────── */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

/* ── Status Message ─────────────────── */
.status-message {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    font-size: 0.9rem;
    font-weight: 500;
}

    .status-message.success {
        background: #E8F5E9;
        color: var(--success);
        border-left: 4px solid var(--success);
    }

    .status-message.error {
        background: #FFEBEE;
        color: var(--danger);
        border-left: 4px solid var(--danger);
    }

/* ── Badges ─────────────────────────── */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-pending {
    background: #FFF8E1;
    color: #F57F17;
}

.badge-pending-sync {
    background: #E3F2FD;
    color: #1565C0;
}

.badge-synced {
    background: #E8F5E9;
    color: #2E7D32;
}

/* ── Media Grid ─────────────────────── */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.media-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.media-type-badge {
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    background: var(--background);
}

.media-thumbnail {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.media-placeholder {
    width: 100%;
    height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--background);
    cursor: pointer;
    gap: 6px;
    color: var(--text-muted);
    font-size: 13px;
}

.media-placeholder-icon {
    font-size: 2rem;
}

.media-meta {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.media-size, .media-date {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Loading & Empty ────────────────── */
.loading-spinner {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
}

/* ── Blazor Error UI ────────────────── */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--danger);
    color: white;
    padding: 12px;
    text-align: center;
    z-index: 999;
}

    #blazor-error-ui a {
        color: white;
    }

/* ── PWA Install Banner ── */
.pwa-install-banner {
    background: #1565C0;
    color: white;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pwa-icon { font-size: 1.8rem; }

.pwa-install-text {
    display: flex;
    flex-direction: column;
}

.pwa-install-text strong { font-size: 0.9rem; }
.pwa-install-text small  { font-size: 0.75rem; opacity: 0.85; }

.pwa-install-actions {
    display: flex;
    gap: 8px;
}

.pwa-btn-install {
    flex: 1;
    background: white;
    color: #1565C0;
    border: none;
    border-radius: 8px;
    padding: 8px;
    font-weight: 700;
    cursor: pointer;
}

.pwa-btn-dismiss {
    background: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
}

/* ── Connectivity pill in navbar ── */
.connectivity-pill {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
}
.connectivity-pill.online  { background: #e8f5e9; color: #2e7d32; }
.connectivity-pill.offline { background: #ffebee; color: #c62828; }
