/* rider-app.css — functional, minimal styling shared by RiderLogin.aspx
   and rider-dashboard.aspx. Not a design system, just enough for a usable
   mobile-first console (riders use this on a phone while delivering). */

:root {
    --clr-primary: #2E7D32;
    --clr-primary-dark: #1B5E20;
    --clr-bg: #F4F6F8;
    --clr-surface: #FFFFFF;
    --clr-border: #E8EAED;
    --clr-text: #1A1A2E;
    --clr-muted: #6B7280;
    --clr-danger: #D32F2F;
    --clr-warning: #FF9F1C;
    --r-md: 10px;
    --r-lg: 16px;
}

* { box-sizing: border-box; }

body.rider-body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--clr-bg);
    color: var(--clr-text);
}

/* ── Login screen ───────────────────────────────────────────── */

body.rider-body--login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-shell { width: 100%; max-width: 360px; }

.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand__mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--clr-primary); color: #fff;
    font-weight: 800; font-size: 1.1rem;
}
.login-brand__tag { margin: 8px 0 0; color: var(--clr-muted); font-size: .875rem; }

.login-card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--r-lg);
    padding: 24px;
    box-shadow: 0 4px 16px rgba(0,0,0,.06);
}
.login-card__title { margin: 0 0 4px; font-size: 1.25rem; }
.login-card__sub { margin: 0 0 20px; color: var(--clr-muted); font-size: .875rem; }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: .8125rem; font-weight: 600; color: var(--clr-muted); }
.field input {
    width: 100%; padding: 11px 14px; border-radius: var(--r-md);
    border: 1.5px solid var(--clr-border); font-size: .9375rem;
    background: var(--clr-bg);
}
.field input:focus { outline: none; border-color: var(--clr-primary); background: #fff; }

.field-error { color: var(--clr-danger); font-size: .8125rem; margin: -8px 0 16px; }

.btn-primary {
    background: var(--clr-primary); color: #fff; border: none;
    border-radius: 999px; padding: 12px 20px; font-weight: 700;
    font-size: .9375rem; cursor: pointer; transition: background .15s;
}
.btn-primary:hover { background: var(--clr-primary-dark); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-primary--full { width: 100%; }

.login-footnote { text-align: center; color: var(--clr-muted); font-size: .8125rem; margin-top: 20px; }

/* ── Dashboard shell ────────────────────────────────────────── */

.rider-topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    background: var(--clr-surface);
    border-bottom: 1px solid var(--clr-border);
    box-shadow: 0 1px 8px rgba(15, 23, 42, .04);
    padding: 12px 16px;
}

.rider-topbar__identity { display: flex; align-items: center; gap: 11px; min-width: 0; }

.rider-avatar {
    flex-shrink: 0;
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-dark));
    color: #fff; font-weight: 800; font-size: .8125rem; letter-spacing: .02em;
    box-shadow: 0 2px 6px rgba(46,125,50,.3);
}

.rider-topbar__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.rider-topbar__greeting {
    font-weight: 800; font-size: .9375rem; color: var(--clr-text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rider-topbar__role {
    font-size: .6875rem; font-weight: 600; color: var(--clr-muted);
    text-transform: uppercase; letter-spacing: .04em;
}

.rider-topbar__actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.rider-topbar__logout {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    border: 1px solid var(--clr-border); background: var(--clr-surface);
    color: var(--clr-danger); cursor: pointer;
    transition: background .15s, border-color .15s;
}
.rider-topbar__logout svg { width: 16px; height: 16px; }
.rider-topbar__logout:hover { background: rgba(211,47,47,.08); border-color: rgba(211,47,47,.3); }

.conn-status {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: .6875rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; padding: 5px 10px; border-radius: 999px;
    white-space: nowrap;
}
.conn-status__dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: currentColor; flex-shrink: 0;
}
.conn-status--connecting { background: rgba(255,159,28,.12); color: #b97400; }
.conn-status--connecting .conn-status__dot { animation: conn-status-pulse 1.1s ease-in-out infinite; }
.conn-status--live { background: rgba(46,125,50,.12); color: var(--clr-primary-dark); }
.conn-status--offline { background: rgba(211,47,47,.12); color: var(--clr-danger); cursor: pointer; }

@keyframes conn-status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}

.rider-main { max-width: 560px; margin: 0 auto; padding: 12px; padding-bottom: 84px; }

.tab-panel { animation: rider-fade-in .15s ease; }
@keyframes rider-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── Compact order card ────────────────────────────────────────
   One tight block: id + status + amount on a single row, one
   customer line, one (clamped) address line, then a slim action
   row. No wasted vertical space — riders scan many of these. */

.order-card {
    background: var(--clr-surface); border: 1px solid var(--clr-border);
    border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
    transition: box-shadow .15s, transform .15s;
}
.order-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,.07); transform: translateY(-1px); }

.order-card__head {
    display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.order-card__id { font-weight: 800; font-size: .9375rem; }
.order-card__amount { font-weight: 800; font-size: .9375rem; color: var(--clr-primary-dark); margin-left: auto; }

.order-card__customer {
    font-size: .8125rem; font-weight: 600; margin: 0 0 1px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.order-card__address {
    font-size: .75rem; color: var(--clr-muted); margin: 0 0 8px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.order-card__meta { font-size: .75rem; color: var(--clr-muted); margin-bottom: 8px; }

.order-card__status {
    display: inline-block; font-size: .625rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .03em;
    padding: 2px 8px; border-radius: 999px; flex-shrink: 0;
}
.status-pending  { background: rgba(255,159,28,.12); color: #b97400; }
.status-progress { background: rgba(37,99,235,.1);   color: #1d4ed8; }
.status-transit  { background: rgba(255,159,28,.14);  color: #b45309; }
.status-done     { background: rgba(46,125,50,.12);   color: var(--clr-primary-dark); }

.order-card__actions { display: flex; gap: 6px; }
.btn-details {
    border: 1.5px solid var(--clr-border); background: var(--clr-surface);
    color: var(--clr-text); border-radius: var(--r-md);
    padding: 9px 14px; font-weight: 700; font-size: .8125rem; cursor: pointer;
    transition: border-color .15s, background .15s;
}
.btn-details:hover { border-color: var(--clr-primary); background: var(--clr-bg); }
.btn-accept, .btn-advance {
    flex: 1; border: none; border-radius: var(--r-md);
    padding: 9px; font-weight: 700; font-size: .8125rem; cursor: pointer;
    background: var(--clr-primary); color: #fff;
    transition: background .15s, transform .08s;
}
.btn-accept:hover, .btn-advance:hover { background: var(--clr-primary-dark); }
.btn-accept:active, .btn-advance:active { transform: scale(.98); }
.btn-advance--delivered { background: var(--clr-warning); }
.btn-advance--delivered:hover { background: #e08c00; }

.empty-state { text-align: center; color: var(--clr-muted); font-size: .875rem; padding: 48px 16px; }

/* ── Bottom tab bar ─────────────────────────────────────────── */

.rider-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; background: var(--clr-surface);
    border-top: 1px solid var(--clr-border);
    box-shadow: 0 -2px 12px rgba(0,0,0,.05);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.rider-tab {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 3px; padding: 10px 4px 8px; border: none; background: none;
    color: var(--clr-muted); font-size: .6875rem; font-weight: 700;
    cursor: pointer; position: relative;
}
.rider-tab svg { width: 22px; height: 22px; }
.rider-tab.active { color: var(--clr-primary-dark); }
.rider-tab__badge {
    position: absolute; top: 4px; right: calc(50% - 22px);
    min-width: 16px; height: 16px; background: var(--clr-primary);
    color: #fff; font-size: .625rem; font-weight: 800;
    line-height: 16px; text-align: center; border-radius: 999px;
    padding: 0 3px; border: 2px solid var(--clr-surface);
}

/* ── Order details bottom sheet ────────────────────────────── */

.detail-sheet { position: fixed; inset: 0; z-index: 500; }
.detail-sheet[hidden] { display: none; }

.detail-sheet__backdrop {
    position: absolute; inset: 0; background: rgba(15,15,30,.45);
    opacity: 0; transition: opacity .2s ease;
}
.detail-sheet.is-active .detail-sheet__backdrop { opacity: 1; }

.detail-sheet__panel {
    position: absolute; left: 0; right: 0; bottom: 0;
    max-width: 560px; margin: 0 auto;
    background: var(--clr-surface);
    border-radius: 20px 20px 0 0;
    max-height: 82vh; display: flex; flex-direction: column;
    transform: translateY(100%); transition: transform .22s ease;
    box-shadow: 0 -8px 30px rgba(0,0,0,.15);
}
.detail-sheet.is-active .detail-sheet__panel { transform: translateY(0); }

.detail-sheet__handle {
    width: 36px; height: 4px; border-radius: 999px;
    background: var(--clr-border); margin: 10px auto 0;
}
.detail-sheet__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 18px 6px;
}
.detail-sheet__header h3 { margin: 0; font-size: 1.0625rem; font-weight: 800; }
.detail-sheet__close {
    border: none; background: var(--clr-bg); color: var(--clr-muted);
    width: 30px; height: 30px; border-radius: 50%; font-size: 1.25rem;
    line-height: 1; cursor: pointer;
}
.detail-sheet__body { padding: 8px 18px 24px; overflow-y: auto; }

.detail-loading { color: var(--clr-muted); font-size: .875rem; padding: 24px 0; text-align: center; }

.detail-block { margin: 12px 0; }
.detail-row {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 6px 0; font-size: .8125rem; border-bottom: 1px solid var(--clr-bg);
}
.detail-row span { color: var(--clr-muted); }
.detail-row strong { text-align: right; font-weight: 600; }
.detail-row--total { border-bottom: none; padding-top: 10px; font-size: .9375rem; }
.detail-row--total span, .detail-row--total strong { color: var(--clr-text); font-weight: 800; }

.detail-block--totals { border-top: 1px dashed var(--clr-border); padding-top: 4px; }

.detail-items { border-top: 1px solid var(--clr-bg); border-bottom: 1px solid var(--clr-bg); padding: 4px 0; }
.detail-line {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 7px 0; font-size: .8125rem;
}
.detail-line__name { color: var(--clr-text); }
.detail-line__amount { font-weight: 600; flex-shrink: 0; }

/* ── Shared global loader ───────────────────────────────────── */

.app-loader {
    position: fixed; inset: 0; z-index: 999;
    background: rgba(255,255,255,.7); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity .15s ease;
}
.app-loader.is-active {
    opacity: 1; pointer-events: auto;
}
.app-loader[hidden] {
    display: none;
}
.app-loader__panel {
    background: #fff; border-radius: var(--r-lg); padding: 20px 28px;
    box-shadow: 0 10px 30px rgba(0,0,0,.1);
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.app-loader__spinner {
    width: 28px; height: 28px; border-radius: 50%;
    border: 3px solid var(--clr-border); border-top-color: var(--clr-primary);
    animation: rider-spin .7s linear infinite;
}
.app-loader__msg { margin: 0; font-size: .8125rem; font-weight: 600; }

@keyframes rider-spin { to { transform: rotate(360deg); } }
