/* ═══════════════════════════════════════════════════════════
   SafeHouse Security PWA — Global Styles
   Theme: Dark Slate / Security
   ═══════════════════════════════════════════════════════════ */

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

:root {
    --bg:           #0f172a;
    --bg-surface:   #1e293b;
    --bg-card:      #1e293b;
    --bg-elevated:  #273549;
    --border:       #334155;
    --text:         #f1f5f9;
    --text-muted:   #94a3b8;
    --text-dim:     #64748b;
    --primary:      #3b82f6;
    --primary-dark: #2563eb;
    --danger:       #ef4444;
    --danger-dark:  #dc2626;
    --success:      #22c55e;
    --amber:        #f59e0b;
    --green:        #22c55e;
    --nav-height:   64px;
    --radius:       12px;
    --radius-sm:    8px;
}

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

a { color: var(--primary); text-decoration: none; }

/* ── Splash ─────────────────────────────────────────────────── */
.splash-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 0.75rem;
}
.splash-logo   { font-size: 3rem; }
.splash-title  { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.splash-spinner{
    width: 28px; height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-top: 0.5rem;
}

/* ── Bottom Nav ─────────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--nav-height);
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    z-index: 100;
}
.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    transition: color 0.15s;
    text-decoration: none;
}
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 1.3rem; }
.nav-label { font-size: 0.65rem; font-weight: 500; }

/* ── Page structure ─────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 0.5rem;
}
.page-title  { font-size: 1.3rem; font-weight: 700; }
.section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 1.25rem 0 0.6rem;
}

/* ── Buttons ─────────────────────────────────────────────────── */
button { cursor: pointer; border: none; font-family: inherit; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-danger {
    background: var(--danger);
    color: #fff;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
}
.btn-danger:hover:not(:disabled) { background: var(--danger-dark); }
.btn-danger:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-danger-sm {
    background: var(--danger);
    color: #fff;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--border);
}
.btn-secondary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    border: 1px solid var(--border);
}
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-full { width: 100%; }
.btn-sm   { padding: 0.35rem 0.85rem; font-size: 0.8rem; }
.btn-link { background: none; color: var(--primary); font-size: inherit; text-decoration: underline; }
.back-btn {
    background: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.25rem 0;
}
.btn-logout {
    width: 100%;
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 0.7rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
}
.btn-scan {
    background: var(--primary);
    color: #fff;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
}
.btn-checkin {
    width: 100%;
    background: var(--success);
    color: #fff;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    margin-top: 0.5rem;
}
.btn-checkin:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-checkout {
    width: 100%;
    background: var(--amber);
    color: #0f172a;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    margin-top: 0.5rem;
}
.btn-checkout:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group  { margin-bottom: 1rem; }
.form-label  { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.35rem; font-weight: 500; }
.form-control {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
.form-control:focus { border-color: var(--primary); }
.form-control::placeholder { color: var(--text-dim); }
textarea.form-control { resize: vertical; }

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
}
.form-actions button { flex: 1; }
.req { color: var(--danger); }

/* ── Filter pills ────────────────────────────────────────────── */
.filter-pills {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.pill {
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: all 0.15s;
}
.pill-active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.priority-pills { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert-error {
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.4);
    color: #fca5a5;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}
.alert-success {
    background: rgba(34,197,94,0.15);
    border: 1px solid rgba(34,197,94,0.4);
    color: #86efac;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* ── Loaders ─────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-ring {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}
.page-loading, .list-loading {
    display: flex; align-items: center; justify-content: center;
    padding: 3rem 0;
}

/* ── Empty / error states ────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.empty-text { font-size: 1rem; margin-bottom: 1rem; }
.error-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ── Search bar ──────────────────────────────────────────────── */
.search-bar { margin-bottom: 0.75rem; }
.search-input {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.6rem 0.9rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
}
.search-input:focus { border-color: var(--primary); }
.search-input::placeholder { color: var(--text-dim); }

/* ── Login ───────────────────────────────────────────────────── */
.login-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    gap: 1.5rem;
}
.login-brand  { text-align: center; }
.login-logo   { font-size: 3.5rem; margin-bottom: 0.5rem; }
.login-title  { font-size: 1.4rem; font-weight: 700; }
.login-sub    { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }
.login-card {
    width: 100%;
    max-width: 360px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.btn-login {
    width: 100%;
    background: var(--primary);
    color: #fff;
    padding: 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    margin-top: 0.5rem;
    transition: background 0.15s;
}
.btn-login:hover:not(:disabled) { background: var(--primary-dark); }
.btn-login:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Dashboard ───────────────────────────────────────────────── */
.dashboard { padding-bottom: 0.5rem; }
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}
.dash-greeting { font-size: 1.2rem; font-weight: 700; }
.dash-sub      { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.dash-date     { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-bottom: 0.25rem;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;
}
.stat-card:hover { background: var(--bg-elevated); }
.stat-number { font-size: 2rem; font-weight: 800; }
.stat-label  { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.stat-blue   .stat-number { color: var(--primary); }
.stat-amber  .stat-number { color: var(--amber); }
.stat-green  .stat-number { color: var(--green); }
.stat-red    .stat-number { color: var(--danger); }

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-bottom: 0.25rem;
}
.qa-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.qa-btn:hover { background: var(--bg-elevated); }
.qa-icon { font-size: 1.4rem; }

/* ── Arrivals list ───────────────────────────────────────────── */
.arrivals-list { display: flex; flex-direction: column; gap: 0.5rem; }
.arrival-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    cursor: pointer;
}
.arrival-name  { font-weight: 600; font-size: 0.95rem; }
.arrival-meta  { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.25rem; }
.arrival-code  { font-family: monospace; font-size: 0.8rem; color: var(--text-muted); background: var(--bg-elevated); padding: 0.1rem 0.4rem; border-radius: 4px; }
.arrival-time  { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ── Visitor list / card ─────────────────────────────────────── */
.visitor-list { display: flex; flex-direction: column; gap: 0.6rem; }
.visitor-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
}
.visitor-card:hover { background: var(--bg-elevated); }
.visitor-top  { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.visitor-info { flex: 1; min-width: 0; }
.visitor-name { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visitor-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.visitor-bottom { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; font-size: 0.8rem; color: var(--text-muted); }
.access-code-sm { font-family: monospace; background: var(--bg-elevated); padding: 0.1rem 0.4rem; border-radius: 4px; color: var(--text); font-size: 0.78rem; }
.visitor-date {}
.meta-sep { color: var(--text-dim); }

/* ── Visitor detail ──────────────────────────────────────────── */
.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.detail-title { font-size: 1.2rem; font-weight: 700; }
.detail-sub   { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.detail-section { border-top: 1px solid var(--border); padding-top: 0.85rem; margin-top: 0.85rem; }
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.3rem 0;
    font-size: 0.88rem;
}
.dr-label { color: var(--text-muted); white-space: nowrap; }
.dr-value  { text-align: right; }
.access-code-block {
    background: var(--bg-elevated);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    text-align: center;
    margin: 0.75rem 0;
}
.ac-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.ac-value  { font-size: 1.5rem; font-weight: 800; font-family: monospace; letter-spacing: 0.1em; color: var(--primary); margin-top: 0.25rem; }
.action-section { border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 1rem; }
.action-note { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }

/* ── Scan page ───────────────────────────────────────────────── */
.scan-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    max-width: 360px;
    margin: 0 auto;
}
.scan-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.scan-hint { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 1rem; }
.scan-input { text-align: center; font-size: 1.1rem; font-family: monospace; letter-spacing: 0.05em; }

/* ── Incident list / card ────────────────────────────────────── */
.incident-list { display: flex; flex-direction: column; gap: 0.6rem; }
.incident-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
}
.incident-top  { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; }
.incident-title{ font-weight: 600; font-size: 0.95rem; flex: 1; min-width: 0; }
.incident-meta { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

/* ── Status badges ───────────────────────────────────────────── */
.vis-badge, .status-badge, .arr-badge {
    flex-shrink: 0;
    padding: 0.2rem 0.55rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.vis-pending, .arr-pending     { background: rgba(245,158,11,0.2); color: #fcd34d; }
.vis-confirmed, .arr-confirmed { background: rgba(59,130,246,0.2); color: #93c5fd; }
.vis-validated, .arr-validated { background: rgba(34,197,94,0.2);  color: #86efac; }
.vis-completed, .arr-completed { background: rgba(100,116,139,0.2);color: #94a3b8; }
.vis-cancelled, .arr-cancelled { background: rgba(239,68,68,0.2);  color: #fca5a5; }
.vis-sent                      { background: rgba(59,130,246,0.15); color: #7dd3fc; }

.status-submitted   { background: rgba(245,158,11,0.2);  color: #fcd34d; }
.status-inprogress  { background: rgba(59,130,246,0.2);  color: #93c5fd; }
.status-resolved    { background: rgba(34,197,94,0.2);   color: #86efac; }
.status-completed   { background: rgba(100,116,139,0.2); color: #94a3b8; }

/* ── Priority dots ───────────────────────────────────────────── */
.priority-dot { font-size: 0.6rem; }
.priority-low       { color: #22c55e; }
.priority-normal    { color: #94a3b8; }
.priority-high      { color: #f59e0b; }
.priority-emergency { color: #ef4444; }

/* ── Profile ─────────────────────────────────────────────────── */
.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}
.profile-avatar { font-size: 4rem; margin-bottom: 0.5rem; }
.profile-name   { font-size: 1.3rem; font-weight: 700; }
.profile-role   { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.2rem; }
.verified-badge {
    display: inline-block;
    margin-top: 0.5rem;
    background: rgba(34,197,94,0.15);
    color: #86efac;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* ── Utilities ───────────────────────────────────────────────── */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }

/* ── Blazor error UI ─────────────────────────────────────────── */
#blazor-error-ui {
    background: var(--danger);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #fff;
    font-size: 0.85rem;
}
#blazor-error-ui .dismiss { cursor: pointer; float: right; }
