:root {
    --bg: #0f1720;
    --surface: #182233;
    --surface-alt: #202c40;
    --border: #2b374a;
    --text: #eef2f7;
    --text-muted: #9aa7ba;
    --accent: #4f7cff;
    --accent-dark: #3b62db;
    --success: #34c77b;
    --warning: #f2b84b;
    --danger: #ef5a5a;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    margin: 0;
}

.app-container {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-wrap {
    width: 100%;
    max-width: 420px;
}

.login-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2.25rem 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    animation: fade-in 0.35s ease-out;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.brand-section { text-align: center; margin-bottom: 1.5rem; }

.app-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.75rem;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.4rem;
}

.login-brand-title { font-weight: 700; margin: 0; }
.login-brand-subtitle { color: var(--text-muted); margin: 0; }
.login-heading { font-size: 1.3rem; margin-bottom: 0.25rem; }
.login-sub { color: var(--text-muted); }

.field-group { display: flex; flex-direction: column; gap: 0.9rem; margin-bottom: 1.5rem; }

.field-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    padding: 0.7rem 0.9rem;
}

.field-icon { color: var(--text-muted); }

.field-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 1rem;
    min-width: 0;
}

.field-action { background: none; border: none; color: var(--text-muted); cursor: pointer; }

.btn-primary-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border: none;
    color: white;
    font-weight: 600;
    border-radius: 0.6rem;
    padding: 0.75rem 1rem;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn-primary-accent:active { transform: scale(0.98); }
.btn-primary-accent:disabled { opacity: 0.7; }

.w-100 { width: 100%; }

/* ---- Simple app shell for Home / gated screens ---- */
.topbar-simple {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.page-wrap { max-width: 720px; margin: 0 auto; padding: 1.5rem; }

.status-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    padding: 1.5rem;
    text-align: center;
}

.status-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }

/* ---- Skeleton loading ---- */
.skeleton-bar {
    height: 0.85rem;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 50%, var(--surface-alt) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .skeleton-bar { animation: none; background: var(--surface-alt); }
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---- Task status colors ---- */
.task-running { border-left: 4px solid var(--success); }
.task-upcoming { border-left: 4px solid var(--accent); }
.task-paused { border-left: 4px solid var(--warning); }
.task-ended { border-left: 4px solid var(--text-muted); }

/* ---- Task list (Home/History) ---- */
.page-topbar {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 0.75rem; flex-wrap: wrap;
}
.page-topbar h2 { margin: 0; font-size: 1.15rem; }
.btn-outline-accent {
    background: transparent; border: 1px solid var(--accent); color: var(--accent);
    border-radius: 0.5rem; padding: 0.45rem 0.85rem; font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.btn-outline-accent:disabled { opacity: 0.6; cursor: default; }
.btn-text-link { background: none; border: none; color: var(--accent); font-size: 0.85rem; cursor: pointer; padding: 0.4rem 0; }

.task-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 0.7rem;
    padding: 0.9rem 1rem; margin-bottom: 0.75rem; cursor: pointer;
    transition: transform 0.1s ease;
}
.task-card:active { transform: scale(0.99); }
.task-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.task-card-title { font-weight: 600; margin: 0; }
.task-card-sub { color: var(--text-muted); font-size: 0.85rem; margin: 0.2rem 0 0; }
.task-card-time { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.4rem; }
.task-status-pill {
    font-size: 0.7rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 999px;
    background: var(--surface-alt); color: var(--text-muted); white-space: nowrap;
}
.task-status-pill.running { background: rgba(52, 199, 123, 0.15); color: var(--success); }
.task-status-pill.upcoming { background: rgba(79, 124, 255, 0.15); color: var(--accent); }
.task-status-pill.paused { background: rgba(242, 184, 75, 0.18); color: var(--warning); }
.task-card-accept-btn {
    margin-top: 0.6rem; background: var(--accent); border: none; color: #fff; font-weight: 600;
    border-radius: 0.5rem; padding: 0.45rem 0.9rem; font-size: 0.85rem;
}
.task-card-accept-btn:disabled { opacity: 0.6; }
.empty-state { text-align: center; color: var(--text-muted); padding: 2rem 1rem; }
.load-more-sentinel { height: 1px; }
.list-skeleton-card {
    height: 76px; border-radius: 0.7rem; margin-bottom: 0.75rem;
    background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 50%, var(--surface-alt) 75%);
    background-size: 200% 100%; animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

/* ---- Self-service Emirates ID profile completion form (Home page) ---- */
.profile-form-card { text-align: left; }
.profile-form-card h3, .profile-form-card .login-sub { text-align: center; }
.profile-form { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 1.25rem; }
.profile-photo-row { padding: 0; }
.profile-photo-label {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 0.7rem 0.9rem; cursor: pointer; color: var(--text-muted); font-size: 0.95rem;
    width: 100%;
}

/* ---- Notification bell + toast (live push via SignalR) ---- */
.notif-bell-btn { position: relative; }
.notif-bell-badge {
    position: absolute; top: -2px; right: -2px; background: var(--danger); color: #fff;
    border-radius: 999px; font-size: 0.65rem; line-height: 1; padding: 0.2rem 0.4rem; min-width: 1.1rem; text-align: center;
}

.toast-stack {
    position: fixed; top: 1rem; right: 1rem; z-index: 3000; display: flex; flex-direction: column; gap: 0.5rem;
    max-width: calc(100vw - 2rem);
}

.app-toast {
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--success);
    border-radius: 0.5rem; padding: 0.65rem 0.9rem; display: flex; align-items: center; gap: 0.5rem;
    box-shadow: 0 8px 20px rgba(0,0,0,0.35); opacity: 0; transform: translateY(-6px); transition: opacity 0.2s ease, transform 0.2s ease;
    color: var(--text); font-size: 0.9rem; max-width: 320px;
}
.app-toast.show { opacity: 1; transform: translateY(0); }
.app-toast.app-toast-danger { border-left-color: var(--danger); }
.app-toast-icon { color: var(--success); flex-shrink: 0; }
.app-toast-danger .app-toast-icon { color: var(--danger); }

/* ---- Task detail page ---- */
.back-btn { background: none; border: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; }
.detail-card { background: var(--surface); border: 1px solid var(--border); border-radius: 0.85rem; padding: 1.25rem; margin-bottom: 1rem; }
.detail-title { font-weight: 700; font-size: 1.2rem; margin: 0 0 0.75rem; }
.detail-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.detail-row:last-child { border-bottom: none; }
.detail-row-label { color: var(--text-muted); }
.detail-map { width: 100%; height: 200px; border-radius: 0.6rem; margin-top: 0.75rem; background: var(--surface-alt); }
.detail-actions { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1rem; }
.btn-success-accent { background: var(--success); border: none; color: #fff; font-weight: 600; border-radius: 0.6rem; padding: 0.75rem 1rem; }
.btn-warning-accent { background: var(--warning); border: none; color: #1a1400; font-weight: 600; border-radius: 0.6rem; padding: 0.75rem 1rem; }
.btn-danger-accent { background: var(--danger); border: none; color: #fff; font-weight: 600; border-radius: 0.6rem; padding: 0.75rem 1rem; }
.detail-actions button:disabled { opacity: 0.65; }
.tracking-indicator { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--success); margin-top: 0.5rem; }
.tracking-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: tracking-pulse 1.4s ease-in-out infinite; }
@keyframes tracking-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---- Chat with admin (floating FAB + bottom-sheet panel) ---- */
.chat-fab {
    position: fixed; right: 1.25rem; bottom: 1.25rem; width: 52px; height: 52px; border-radius: 50%;
    background: var(--accent); color: #fff; border: none; font-size: 1.3rem; box-shadow: 0 8px 20px rgba(0,0,0,0.35);
    display: flex; align-items: center; justify-content: center; z-index: 1500;
}
.chat-fab-dot { position: absolute; top: 4px; right: 4px; width: 11px; height: 11px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg); }

.chat-panel-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1600;
    display: none; align-items: flex-end; justify-content: center;
}
.chat-panel-overlay.open { display: flex; }
.chat-sheet {
    width: 100%; max-width: 480px; height: 72vh; background: var(--surface); border-radius: 1rem 1rem 0 0;
    display: flex; flex-direction: column; border: 1px solid var(--border); border-bottom: none;
}
.chat-sheet-header { display: flex; justify-content: space-between; align-items: center; padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); font-weight: 700; }
.chat-sheet-body { flex: 1; overflow-y: auto; padding: 0.75rem 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.chat-sheet-load-more { text-align: center; font-size: 0.75rem; color: var(--text-muted); padding: 0.25rem 0 0.4rem; }
.chat-sheet-empty { text-align: center; color: var(--text-muted); padding: 2rem 1rem; }

.chat-bubble { max-width: 78%; padding: 0.5rem 0.75rem; border-radius: 12px; font-size: 0.88rem; line-height: 1.4; overflow-wrap: anywhere; }
.chat-bubble-admin { align-self: flex-start; background: var(--surface-alt); color: var(--text); border-bottom-left-radius: 2px; }
.chat-bubble-interviewer { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 2px; }
.chat-bubble-time { font-size: 0.65rem; opacity: 0.65; margin-top: 0.2rem; }
.chat-bubble-attachment img { max-width: 100%; border-radius: 8px; margin-top: 0.25rem; display: block; }

.chat-sheet-input-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.65rem 0.85rem; border-top: 1px solid var(--border); }
.chat-sheet-input-row input[type="text"] { flex: 1; border: 1px solid var(--border); border-radius: 20px; padding: 0.5rem 0.9rem; font-size: 0.88rem; background: var(--surface-alt); color: var(--text); }
.chat-sheet-input-row button { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; }
.chat-sheet-input-row .chat-sheet-send-btn { background: var(--accent); color: #fff; border-radius: 50%; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ---- Tablet responsiveness (target down to ~7-11in landscape/portrait tablets) ---- */
@media (min-width: 600px) and (max-width: 1200px) {
    .page-wrap { max-width: 90%; }
}

@media (max-width: 420px) {
    .login-content { padding: 1.75rem 1.25rem; }
}
