/* =====================================================================
   components.css — Customer Portal component styles
   Consumes the tokens defined in theme.css. No hard-coded palette values
   except where a token would be circular.
   ===================================================================== */

/* ---------------------------------------------------------------- Buttons */
.customer-btn {
    --btn-bg: var(--primary-500);
    --btn-fg: #ffffff;
    --btn-border: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    min-height: 44px;
    padding: var(--space-12) var(--space-20);
    border: 1px solid var(--btn-border);
    border-radius: var(--radius-pill);
    background: var(--btn-bg);
    color: var(--btn-fg);
    font: inherit;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.12s ease, background 0.12s ease;
}

.customer-btn:hover { filter: brightness(1.06); text-decoration: none; }
.customer-btn:active { transform: translateY(1px); }
.customer-btn:disabled,
.customer-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; filter: none; }

.customer-btn--primary { --btn-bg: var(--brand); --btn-fg: var(--brand-contrast); }
.customer-btn--accent  { --btn-bg: var(--accent-500); --btn-fg: var(--primary-900); }
.customer-btn--ghost   { --btn-bg: transparent; --btn-fg: var(--text); }
.customer-btn--ghost:hover { background: var(--surface-3); }
.customer-btn--outline { --btn-bg: transparent; --btn-fg: var(--brand); --btn-border: color-mix(in srgb, var(--brand) 45%, transparent); }
.customer-btn--danger  { --btn-bg: #C62828; --btn-fg: #ffffff; }
.customer-btn--link    { --btn-bg: transparent; --btn-fg: var(--brand); padding: var(--space-4) var(--space-8); min-height: auto; }
.customer-btn--link:hover { text-decoration: underline; }
.customer-btn--block   { width: 100%; }
.customer-btn--sm      { min-height: 36px; padding: var(--space-8) var(--space-16); font-size: 0.875rem; }
.customer-btn--lg      { min-height: 52px; padding: var(--space-16) var(--space-24); font-size: 1.0625rem; }

/* ------------------------------------------------------------------ Cards */
.customer-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-20);
    box-shadow: var(--shadow-1);
    padding: var(--space-20);
}
.customer-card--accent {
    background: var(--gradient-card-accent);
    border-color: transparent;
    color: #fff;
}
.customer-card--flat { box-shadow: none; }
.customer-card--glass {
    background: var(--glass-bg);
    border-color: var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ------------------------------------------------------------------ Pills */
.customer-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-12);
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}
.customer-pill--success { background: var(--success-100); color: #0B6B4B; }
.customer-pill--warning { background: var(--warning-100); color: #7A5200; }
.customer-pill--error   { background: var(--error-100); color: #A32424; }
.customer-pill--info    { background: var(--info-100); color: #0F2F8F; }

/* ------------------------------------------------------------------ Forms */
.customer-form { display: grid; gap: var(--space-20); }

.customer-field { display: grid; gap: var(--space-8); }

.customer-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.customer-input,
.customer-select,
.customer-textarea {
    width: 100%;
    min-height: 44px;
    padding: var(--space-12) var(--space-16);
    border: 1px solid var(--border);
    border-radius: var(--radius-14);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}
.customer-textarea { min-height: 96px; resize: vertical; }

.customer-input:focus,
.customer-select:focus,
.customer-textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--focus-ring);
}

.customer-input.is-invalid,
.customer-select.is-invalid,
.customer-textarea.is-invalid { border-color: var(--error-500); }

.customer-hint { font-size: 0.8125rem; color: var(--text-muted); }

.field-error {
    min-height: 1em;
    font-size: 0.8125rem;
    color: #B42323;
}

/* --------------------------------------------------------------- OTP input */
.customer-otp {
    display: flex;
    gap: var(--space-8);
    justify-content: space-between;
}
.customer-otp__box {
    flex: 1 1 0;
    min-width: 0;
    height: 56px;
    text-align: center;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: var(--radius-14);
    background: var(--surface);
    color: var(--text);
}
.customer-otp__box:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--focus-ring);
}
.customer-otp.is-invalid .customer-otp__box { border-color: var(--error-500); }

/* ------------------------------------------------------------------ Sheet */
.customer-sheet {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.customer-sheet[hidden] { display: none; }
.customer-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 12, 30, 0.5);
    backdrop-filter: blur(2px);
}
.customer-sheet__panel {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow: auto;
    padding: var(--space-16) var(--space-20) var(--space-24);
    background: var(--surface);
    border-radius: var(--radius-28) var(--radius-28) 0 0;
    box-shadow: var(--shadow-3);
    animation: customer-sheet-up 0.22s ease;
}
.customer-sheet__grabber {
    display: block;
    width: 44px;
    height: 4px;
    margin: 0 auto var(--space-12);
    border-radius: var(--radius-pill);
    background: var(--neutral-300);
}
.customer-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-12);
    margin-bottom: var(--space-12);
}
.customer-sheet__title { margin: 0; font-size: 1.125rem; }
.customer-sheet__close {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
}
.customer-sheet__footer {
    margin-top: var(--space-20);
    display: flex;
    gap: var(--space-12);
}

@keyframes customer-sheet-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

/* ------------------------------------------------------------------ Modal */
.customer-modal {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-16);
}
.customer-modal[hidden] { display: none; }
.customer-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 12, 30, 0.55);
    backdrop-filter: blur(2px);
}
.customer-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    overflow: auto;
    background: var(--surface);
    border-radius: var(--radius-20);
    box-shadow: var(--shadow-3);
    animation: customer-modal-in 0.18s ease;
}
.customer-modal__dialog--sm { max-width: 380px; }
.customer-modal__dialog--lg { max-width: 720px; }
.customer-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-12);
    padding: var(--space-20) var(--space-20) var(--space-12);
}
.customer-modal__title { margin: 0; font-size: 1.25rem; }
.customer-modal__close {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.15rem;
    cursor: pointer;
}
.customer-modal__body { padding: 0 var(--space-20) var(--space-20); }
.customer-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-12);
    padding: var(--space-16) var(--space-20);
    border-top: 1px solid var(--border);
}

@keyframes customer-modal-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

body.customer-modal-open { overflow: hidden; }

/* ------------------------------------------------------------------ Toast */
.customer-toast-container {
    position: fixed;
    left: 50%;
    bottom: calc(var(--space-24) + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
    width: min(92vw, 420px);
    pointer-events: none;
}
.customer-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: var(--space-12);
    padding: var(--space-12) var(--space-16);
    border-radius: var(--radius-14);
    background: var(--surface-inverse);
    color: var(--text-inverse);
    box-shadow: var(--shadow-2);
    font-size: 0.9375rem;
    animation: customer-toast-in 0.2s ease;
}
.customer-toast--success { background: var(--success-500); color: #fff; }
.customer-toast--error   { background: var(--error-500); color: #fff; }
.customer-toast--warning { background: var(--warning-500); color: var(--primary-900); }
.customer-toast--info    { background: var(--info-500); color: #fff; }
.customer-toast.is-leaving { opacity: 0; transition: opacity 0.2s ease; }

@keyframes customer-toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------------- Skeletons */
.customer-skeleton {
    display: block;
    border-radius: var(--radius-8);
    background: linear-gradient(90deg, var(--surface-3) 25%, color-mix(in srgb, var(--surface-3) 60%, #ffffff) 37%, var(--surface-3) 63%);
    background-size: 400% 100%;
    animation: customer-skeleton-shimmer 1.4s ease infinite;
}
.customer-skeleton-rows { display: grid; gap: var(--space-8); }

@keyframes customer-skeleton-shimmer {
    from { background-position: 100% 0; }
    to   { background-position: 0 0; }
}

/* ----------------------------------------------------------- State blocks */
.customer-state {
    display: grid;
    justify-items: center;
    gap: var(--space-12);
    padding: var(--space-40) var(--space-20);
    text-align: center;
}
.customer-state__icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    color: var(--text-muted);
    font-size: 1.5rem;
}
.customer-state__title { margin: 0; font-size: 1.125rem; }
.customer-state__message { margin: 0; max-width: 42ch; color: var(--text-muted); }
.customer-state__actions { display: flex; gap: var(--space-12); flex-wrap: wrap; justify-content: center; }
.customer-state--error .customer-state__icon { background: var(--error-100); color: var(--error-500); }
.customer-state--no-internet .customer-state__icon { background: var(--warning-100); color: var(--warning-500); }
.customer-state--slow .customer-state__icon { background: var(--info-100); color: var(--info-500); }
.customer-state--session-expired .customer-state__icon { background: var(--warning-100); color: var(--warning-500); }

/* ----------------------------------------------------------------- Navbar */
.customer-navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.customer-navbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-16);
    max-width: 1120px;
    margin: 0 auto;
    padding: var(--space-12) var(--space-20);
}
.customer-navbar__brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-12);
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text);
}
.customer-navbar__brand:hover { text-decoration: none; }
.customer-navbar__logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-8);
    object-fit: contain;
    background: #fff;
}
.customer-navbar__logo--fallback {
    display: grid;
    place-items: center;
    background: var(--brand);
    color: var(--brand-contrast);
}
.customer-navbar__name { font-size: 1.0625rem; }
.customer-navbar__links { display: none; gap: var(--space-20); }
.customer-navbar__links a { color: var(--text-muted); font-weight: 500; }
.customer-navbar__actions { display: flex; align-items: center; gap: var(--space-8); }
.customer-navbar__lang {
    display: inline-flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-8) var(--space-12);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
}
.customer-navbar__avatar {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    color: var(--text);
}
.customer-navbar__theme-slot { display: none; }

@media (min-width: 768px) {
    .customer-navbar__links { display: flex; }
}

/* ------------------------------------------------------------- Bottom nav */
.customer-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding: 0 4px env(safe-area-inset-bottom, 0px);
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(6, 12, 30, 0.08);
}
.customer-bottom-nav__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 64px;
    min-width: 0;
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}
.customer-bottom-nav__item:hover { text-decoration: none; }
.customer-bottom-nav__icon { display: grid; place-items: center; width: 24px; height: 24px; }
.customer-bottom-nav__icon i { font-size: 1.2rem; }
.customer-bottom-nav__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-bottom-nav__item.is-active { color: var(--brand); }
.customer-bottom-nav__item:not(.customer-bottom-nav__item--fab).is-active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 28px;
    height: 3px;
    transform: translateX(-50%);
    border-radius: 0 0 3px 3px;
    background: currentColor;
}

/* Centre FAB */
.customer-bottom-nav__item--fab { color: var(--text-muted); }
.customer-bottom-nav__item--fab .customer-bottom-nav__icon {
    width: 56px;
    height: 56px;
    margin-top: -28px;
    border-radius: 50%;
    background: var(--accent-500);
    color: var(--primary-900);
    border: 4px solid var(--surface);
    box-shadow: 0 6px 16px rgba(6, 12, 30, 0.25);
    transition: transform 0.15s ease;
}
.customer-bottom-nav__item--fab .customer-bottom-nav__icon i { font-size: 1.3rem; }
.customer-bottom-nav__item--fab:active .customer-bottom-nav__icon { transform: scale(0.94); }
.customer-bottom-nav__item--fab.is-active { color: var(--brand); }
.customer-bottom-nav__theme-slot { display: none; }

body.customer-has-bottom-nav { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }

@media (min-width: 768px) {
    .customer-bottom-nav { display: none; }
    body.customer-has-bottom-nav { padding-bottom: 0; }
}

/* ----------------------------------------------------------------- Footer */
.customer-footer {
    margin-top: var(--space-48);
    background: var(--surface-inverse);
    color: var(--text-inverse);
}
.customer-footer__inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: var(--space-40) var(--space-20);
    display: grid;
    gap: var(--space-20);
}
.customer-footer__name {
    margin: 0 0 var(--space-8);
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
}
.customer-footer__line { margin: 0 0 var(--space-4); opacity: 0.85; }
.customer-footer__line a { color: inherit; }
.customer-footer__links { display: flex; gap: var(--space-20); }
.customer-footer__links a { color: inherit; opacity: 0.85; }
.customer-footer__copy { margin: 0; font-size: 0.8125rem; opacity: 0.6; }

@media (min-width: 768px) {
    .customer-footer__inner { grid-template-columns: 2fr 1fr; align-items: start; }
    .customer-footer__copy { grid-column: 1 / -1; }
}


/* =====================================================================
   v2 refinements — public booking UI
   ===================================================================== */

/* Alias: pages written against .ant-btn share the .customer-btn look */
.ant-btn {
    --btn-bg: var(--brand);
    --btn-fg: var(--brand-contrast);
    --btn-border: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    padding: 12px 24px;
    border: 1px solid var(--btn-border);
    border-radius: var(--radius-pill);
    background: var(--btn-bg);
    color: var(--btn-fg);
    font: inherit;
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}
.ant-btn:hover { filter: brightness(1.07); text-decoration: none; }
.ant-btn:active { transform: translateY(1px); }
.ant-btn:disabled,
.ant-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; filter: none; }
.ant-btn--primary  { --btn-bg: var(--brand); --btn-fg: var(--brand-contrast); }
.ant-btn--gradient {
    --btn-fg: var(--brand-contrast);
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 78%, #fff), var(--brand));
    box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 32%, transparent);
}
.ant-btn--accent {
    --btn-bg: var(--accent-500);
    --btn-fg: var(--primary-900);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--accent-500) 35%, transparent);
}
.ant-btn--ghost   { --btn-bg: transparent; --btn-fg: var(--text); --btn-border: var(--border); }
.ant-btn--block   { width: 100%; }
.ant-btn--lg      { min-height: 56px; padding: 16px 32px; font-size: 1.0625rem; }

.ant-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ant-spin 0.7s linear infinite;
}
@keyframes ant-spin { to { transform: rotate(360deg); } }

/* Buttons: nicer press/hover, primary gets a soft lift */
.customer-btn--primary,
.customer-btn--accent { box-shadow: 0 6px 16px color-mix(in srgb, var(--btn-bg) 28%, transparent); }
.customer-btn--ghost,
.customer-btn--outline,
.customer-btn--link { box-shadow: none; }
.customer-btn--outline:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); text-decoration: none; }

/* Cards & fields: roomier by default */
.customer-card { padding: 24px; }
.customer-input,
.customer-select,
.customer-textarea { min-height: 48px; background: var(--surface-2); transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease; }
.customer-input:focus,
.customer-select:focus,
.customer-textarea:focus { background: var(--surface); }

/* Navbar: tidy on phones, roomier on desktop */
.customer-navbar__inner { padding: 12px 16px; min-height: 64px; }
.customer-navbar__brand { min-width: 0; }
.customer-navbar__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 42vw; }
.customer-navbar__logo { width: 40px; height: 40px; border-radius: 12px; }
.customer-navbar__actions { gap: 8px; }
.customer-navbar__actions .customer-btn { min-height: 40px; padding: 8px 16px; font-size: 0.9375rem; box-shadow: none; }
.customer-navbar__lang { min-height: 40px; padding: 8px 14px; font-weight: 600; }
.customer-navbar__lang:hover { background: var(--surface-3); }
.customer-navbar__avatar { width: 40px; height: 40px; transition: background 0.15s ease; }
.customer-navbar__avatar:hover { background: var(--surface-3); text-decoration: none; }
.customer-navbar__links a { padding: 8px 4px; border-bottom: 2px solid transparent; transition: color 0.15s ease, border-color 0.15s ease; }
.customer-navbar__links a:hover { color: var(--text); border-color: var(--brand); text-decoration: none; }

/* Public bar on phones: keep only language + Register */
@media (max-width: 767px) {
    .customer-navbar--public .customer-navbar__actions .customer-btn--ghost { display: none; }
    .customer-navbar--app .customer-navbar__actions .customer-btn--accent span { display: none; }
    .customer-navbar--app .customer-navbar__actions .customer-btn--accent { width: 40px; padding: 0; }
}
@media (min-width: 768px) {
    .customer-navbar__inner { padding: 14px 24px; }
    .customer-navbar__name { max-width: none; }
}

/* Bottom nav: clearer active state, safe areas */
body.customer-has-bottom-nav,
body[data-page="home"],
body[data-page="trips"],
body[data-page="profile"] { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 768px) {
    body[data-page="home"],
    body[data-page="trips"],
    body[data-page="profile"] { padding-bottom: 0; }
}

/* Footer: clearer columns and spacing */
.customer-footer { margin-top: 0; }
.customer-footer__inner { padding: 48px 20px 28px; gap: 28px; }
.customer-footer__name { font-size: 1.25rem; margin-bottom: 12px; }
.customer-footer__line { margin-bottom: 8px; display: flex; gap: 8px; align-items: baseline; }
.customer-footer__line a { display: inline-flex; gap: 10px; align-items: center; }
.customer-footer__line a:hover { text-decoration: underline; }
.customer-footer__links { flex-wrap: wrap; gap: 12px 24px; align-content: start; }
.customer-footer__links a:hover { opacity: 1; }
.customer-footer__copy { padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
body.customer-has-bottom-nav .customer-footer { margin-bottom: 0; }
@media (min-width: 768px) {
    .customer-footer__inner { padding: 56px 24px 32px; }
    .customer-footer__links { justify-content: flex-end; }
}

/* Toast: stay clear of the bottom nav on phones */
@media (max-width: 767px) {
    .customer-toast-container { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
}

/* ---- contrast pass: dark theme pills + toasts ---- */
[data-theme="dark"] .customer-pill--success { background: #0F3B33; color: #7FE3BF; }
[data-theme="dark"] .customer-pill--warning { background: #4A3A12; color: #FFD98A; }
[data-theme="dark"] .customer-pill--error   { background: #4A1D24; color: #FFB4B4; }
[data-theme="dark"] .customer-pill--info    { background: #12246B; color: #BFD4FF; }
[data-theme="dark"] .field-error { color: #FF9B9B; }
.customer-toast--success { background: #0B6B4B; }
.customer-toast--error { background: #B42323; }
.customer-toast--info { background: #1D4ED8; }

/* Footer brand logo (same Business Profile logo as the topbar) */
.customer-footer__name { display: flex; align-items: center; gap: 10px; }
.customer-footer__logo { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 8px; object-fit: contain; background: #fff; }
