/**
 * Unified UI Components — Phase 2
 * Canonical: .btn + BEM modifiers (.btn--primary, .btn--outline, .btn--ghost)
 * Legacy aliases: .btn-primary, .tw-btn, .tw-btn-primary, .tw-btn-outline
 * Requires tokens.css loaded first (via design-system.css).
 */

/* ── Buttons ── */
.btn,
.tw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--btn-height-sm);
    padding: var(--space-2) var(--space-5);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    border: none;
    border-radius: var(--btn-radius);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition-base, 200ms ease),
                color var(--transition-base, 200ms ease),
                border-color var(--transition-base, 200ms ease),
                box-shadow var(--transition-base, 200ms ease),
                transform var(--transition-base, 200ms ease);
}

.btn:disabled,
.tw-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn--primary,
.btn-primary,
.tw-btn-primary {
    background: var(--brand-gradient);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

.btn--primary:hover:not(:disabled),
.btn-primary:hover:not(:disabled),
.tw-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn--secondary,
.btn-secondary {
    background: var(--color-slate-500);
    color: var(--text-inverse);
}

.btn--secondary:hover:not(:disabled),
.btn-secondary:hover:not(:disabled) {
    background: var(--color-slate-600);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn--outline,
.btn-outline,
.tw-btn-outline {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn--outline:hover:not(:disabled),
.btn-outline:hover:not(:disabled),
.tw-btn-outline:hover:not(:disabled) {
    border-color: var(--brand);
    color: var(--brand);
    transform: translateY(-1px);
}

.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.btn--ghost:hover:not(:disabled) {
    background: var(--brand-muted);
    color: var(--brand);
}

.btn--success,
.btn-success {
    background: var(--success);
    color: var(--text-inverse);
}

.btn--success:hover:not(:disabled),
.btn-success:hover:not(:disabled) {
    filter: brightness(0.95);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn--danger,
.btn-danger {
    background: var(--danger);
    color: var(--text-inverse);
}

.btn--danger:hover:not(:disabled),
.btn-danger:hover:not(:disabled) {
    filter: brightness(0.95);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn--sm,
.btn-sm,
.tw-btn-small {
    min-height: 32px;
    padding: var(--space-1) var(--space-3);
    font-size: 0.8125rem;
}

.btn--lg,
.btn-lg {
    min-height: var(--btn-height);
    padding: var(--space-3) var(--space-8);
    font-size: 1rem;
}

.btn--block,
.btn-block {
    width: 100%;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: var(--radius-pill);
}

.btn-icon-sm {
    width: 32px;
    height: 32px;
    min-height: 32px;
    font-size: 0.875rem;
}

/* ── Cards ── */
.card,
.tw-card {
    background: var(--surface);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition-base, 200ms ease);
}

.card:hover,
.tw-card:hover {
    box-shadow: var(--shadow-md);
}

.card--elevated {
    box-shadow: var(--shadow-md);
}

.card-header,
.tw-card-header {
    padding: var(--space-5) var(--space-6);
    background: var(--surface-muted);
    border-bottom: 1px solid var(--border);
}

.card-body,
.tw-card-body {
    padding: var(--space-6);
}

.card-footer,
.tw-card-footer {
    padding: var(--space-5) var(--space-6);
    background: var(--surface-muted);
    border-top: 1px solid var(--border);
}

.card-hover {
    transition: all var(--transition-base, 200ms ease);
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* ── Inputs ── */
.input,
.form-control,
.tw-input {
    width: 100%;
    min-height: var(--btn-height-sm);
    padding: var(--space-3);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--input-radius);
    transition: border-color var(--transition-base, 200ms ease),
                box-shadow var(--transition-base, 200ms ease);
}

.input:focus,
.form-control:focus,
.tw-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-muted);
}

.input:disabled,
.form-control:disabled,
.tw-input:disabled {
    background-color: var(--surface-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 600;
    color: var(--text);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: left 0.5rem center;
    background-size: 1.5em 1.5em;
    background-repeat: no-repeat;
    padding-left: var(--space-10);
}

/* ── Modals ── */
.modal-overlay,
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base, 200ms ease),
                visibility var(--transition-base, 200ms ease);
}

.modal-overlay.show,
.modal-backdrop.show,
.modal-overlay.is-open,
.modal-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

.modal,
.tw-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9001;
    padding: var(--space-4);
}

.modal.show,
.modal.is-open,
.tw-modal.show,
.tw-modal.is-open {
    display: flex;
}

.modal-content,
.tw-modal-content {
    background: var(--surface);
    border-radius: var(--modal-radius);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    pointer-events: auto;
}

.modal-content--lg { max-width: 800px; }
.modal-content--xl { max-width: 1140px; }

.modal-header,
.tw-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
}

.modal-title,
.tw-modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
}

.modal-close,
.tw-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition-base, 200ms ease);
}

.modal-close:hover,
.tw-modal-close:hover {
    background: var(--surface-muted);
    color: var(--text);
}

/* Touch targets */
@media (hover: none) and (pointer: coarse) {
    .btn, .tw-btn, .form-control, .input {
        min-height: var(--btn-height);
    }
}

/* Dark mode — token-driven surfaces (no !important) */
@media (prefers-color-scheme: dark) {
    .card, .tw-card,
    .modal-content, .tw-modal-content {
        background-color: var(--surface);
        color: var(--text);
        border-color: var(--border);
    }

    .card-header, .tw-card-header,
    .card-footer, .tw-card-footer {
        background-color: var(--surface-muted);
        border-color: var(--border);
    }

    .input, .form-control, .tw-input, .form-select {
        background-color: var(--input-surface, #1b2638);
        color: var(--text);
        border-color: var(--border);
    }

    .modal-header, .tw-modal-header,
    .modal-footer {
        border-color: var(--border);
    }

    .btn--outline, .btn-outline, .tw-btn-outline {
        background-color: var(--surface);
        color: var(--text-secondary);
        border-color: var(--border);
    }

    .btn--primary, .btn-primary, .tw-btn-primary,
    .tw-book-btn, .tw-cta, .tw-hero-cta {
        color: var(--text-inverse);
    }

    .badge-success, .status-success, .badge.success {
        background: var(--success-bg);
        color: #6ee7b7;
    }

    .badge-warning, .status-warning, .badge.warning {
        background: var(--warning-bg);
        color: #fcd34d;
    }

    .badge-danger, .badge-error, .status-danger, .badge.danger {
        background: var(--error-bg);
        color: #fca5a5;
    }

    .badge-info, .status-info, .badge.info {
        background: var(--info-bg);
        color: #93c5fd;
    }
}

/* ============================================================
   Unified Top Bar (.site-topbar) + Bottom Tab Bar (.site-tabbar)
   Modern glass, mobile-first. Used by components/navbar.html.
   Loaded via js/layout-loader.js into [data-include="navbar"].
   ============================================================ */
:root {
    --topbar-h: 56px;
    --tabbar-h: 68px;
}

/* Reserve space only when the unified bars are actually mounted */
body:has(.site-topbar) { padding-top: var(--topbar-h); }
body:has(.site-tabbar) { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }

/* ---- Top bar ---- */
.site-topbar {
    position: fixed;
    inset-block-start: 0;
    inset-inline: 0;
    height: var(--topbar-h);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 0 var(--space-4);
    padding-inline-start: max(var(--space-4), env(safe-area-inset-left));
    padding-inline-end: max(var(--space-4), env(safe-area-inset-right));
    background: color-mix(in oklab, var(--surface) 78%, transparent);
    backdrop-filter: saturate(160%) blur(18px);
    -webkit-backdrop-filter: saturate(160%) blur(18px);
    border-bottom: 1px solid transparent;
    transition: border-color 200ms ease, box-shadow 200ms ease, background 200ms ease;
    font-family: var(--font-sans);
    color: var(--text);
}
.site-topbar.is-scrolled {
    border-bottom-color: var(--border);
    box-shadow: 0 4px 20px -8px rgba(0, 0, 0, 0.12);
}
.site-topbar__brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: inherit;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.site-topbar__mark {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: var(--brand-gradient);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px -4px color-mix(in oklab, var(--brand) 60%, transparent);
}
.site-topbar__text {
    font-size: 1.02rem;
    line-height: 1;
}
.site-topbar__side {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

/* Language pill */
.site-topbar__lang { position: relative; }
.site-topbar__lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}
.site-topbar__lang-btn:hover { background: var(--brand-muted); border-color: color-mix(in oklab, var(--brand) 25%, var(--border)); }
.site-topbar__lang-btn:active { transform: scale(0.97); }

.site-topbar__lang-menu {
    position: absolute;
    inset-block-start: calc(100% + 8px);
    inset-inline-end: 0;
    min-width: 200px;
    padding: 6px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 1001;
    animation: siteFadeIn 160ms ease;
}
.site-topbar__lang-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: none;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-align: start;
    font-size: 0.88rem;
    cursor: pointer;
}
.site-topbar__lang-menu button:hover { background: var(--brand-muted); color: var(--brand); }
@keyframes siteFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* CTA + User */
.site-topbar__cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--brand);
    color: var(--text-inverse);
    border-radius: var(--radius-pill);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 6px 16px -8px color-mix(in oklab, var(--brand) 70%, transparent);
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.site-topbar__cta:hover { background: var(--brand-hover); transform: translateY(-1px); box-shadow: 0 10px 22px -10px color-mix(in oklab, var(--brand) 80%, transparent); }
.site-topbar__cta:active { transform: translateY(0); }

.site-topbar__user { position: relative; }
.site-topbar__user-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: border-color 180ms ease, background 180ms ease;
}
.site-topbar__user-btn:hover { border-color: var(--brand); background: var(--brand-muted); }
.site-topbar__avatar {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-pill);
    background: var(--brand-gradient);
    color: var(--text-inverse);
    font-weight: 700;
    font-size: 0.85rem;
}
.site-topbar__dropdown {
    position: absolute;
    inset-block-start: calc(100% + 8px);
    inset-inline-end: 0;
    min-width: 220px;
    padding: 6px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
    z-index: 1001;
}
.site-topbar__dropdown.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.site-topbar__dropdown-head {
    padding: 10px 12px 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 4px;
}
.site-topbar__dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-align: start;
    text-decoration: none;
    font-size: 0.88rem;
    cursor: pointer;
}
.site-topbar__dropdown-item:hover { background: var(--brand-muted); color: var(--brand); }

/* ---- Bottom tab bar ---- */
.site-tabbar {
    position: fixed;
    inset-block-end: 0;
    inset-inline: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    height: var(--tabbar-h);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: color-mix(in oklab, var(--surface) 82%, transparent);
    backdrop-filter: saturate(160%) blur(18px);
    -webkit-backdrop-filter: saturate(160%) blur(18px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px -8px rgba(0, 0, 0, 0.10);
    font-family: var(--font-sans);
}
.site-tabbar__tab {
    position: relative;
    flex: 1;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 180ms ease;
    -webkit-tap-highlight-color: transparent;
}
.site-tabbar__tab::before {
    content: "";
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: 50%;
    transform: translateX(-50%) scaleX(0);
    transform-origin: center;
    width: 32px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--brand);
    transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.site-tabbar__ico {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 28px;
    border-radius: var(--radius-pill);
    transition: background 200ms ease, transform 220ms ease;
}
.site-tabbar__label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
}
.site-tabbar__tab:hover { color: var(--brand); }
.site-tabbar__tab.active { color: var(--brand); }
.site-tabbar__tab.active::before { transform: translateX(-50%) scaleX(1); }
.site-tabbar__tab.active .site-tabbar__ico {
    background: var(--brand-muted);
    transform: translateY(-1px);
}

/* Badge for counts (used by e.g. account notifications) */
.site-tabbar__badge {
    position: absolute;
    inset-block-start: 6px;
    inset-inline-end: calc(50% - 18px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-grid;
    place-items: center;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: var(--radius-pill);
    box-shadow: 0 0 0 2px var(--surface);
}

/* Body lock when a menu is open */
body.site-nav-lock { overflow: hidden; }

/* Desktop refinements — a bit roomier, but keep bottom-tab everywhere for consistency */
@media (min-width: 900px) {
    :root { --topbar-h: 64px; --tabbar-h: 72px; }
    .site-topbar { padding-inline: var(--space-8); }
    .site-topbar__text { font-size: 1.1rem; }
    .site-tabbar__label { font-size: 0.75rem; }
    .site-tabbar { max-width: 720px; inset-inline: 0; margin: 0 auto var(--space-4); border-radius: var(--radius-xl); border: 1px solid var(--border); box-shadow: var(--shadow-xl); padding-bottom: 0; }
    .site-tabbar__tab::before { border-radius: 3px; inset-block-start: -1px; }
    body:has(.site-tabbar) { padding-bottom: calc(var(--tabbar-h) + var(--space-6)); }
}

/* Hide/reveal by role — filled in by auth-guard */
.site-topbar__user[hidden], .site-topbar__guest[hidden],
.site-tabbar__admin-only[hidden],
.site-topbar__lang-menu[hidden],
#languageSelect[hidden] { display: none !important; }

/* Compact icon-only button (notifications etc.) */
.site-topbar__icon-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-pill);
    background: var(--surface-muted);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}
.site-topbar__icon-btn:hover {
    background: var(--brand-muted);
    color: var(--brand);
    border-color: color-mix(in oklab, var(--brand) 25%, var(--border));
}


/* ============================================================
   Unified Site Footer (.site-footer) — matches topbar/tabbar aesthetic
   ============================================================ */
.site-footer {
    background: var(--surface);
    color: var(--text);
    border-top: 1px solid var(--border);
    padding: var(--space-10) var(--space-5) var(--space-6);
    margin-top: var(--space-12);
    font-family: var(--font-sans);
    position: relative;
}
.site-footer::before {
    content: "";
    position: absolute;
    inset-block-start: -1px;
    inset-inline: 0;
    height: 3px;
    background: var(--brand-gradient);
    opacity: 0.7;
}
.site-footer__container { max-width: 1200px; margin: 0 auto; }
.site-footer__grid {
    display: grid;
    grid-template-columns: 1.4fr repeat(3, 1fr);
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}
@media (max-width: 900px) {
    .site-footer__grid { grid-template-columns: 1fr 1fr; gap: var(--space-6); }
}
@media (max-width: 560px) {
    .site-footer__grid { grid-template-columns: 1fr; }
}

.site-footer__col { min-width: 0; }
.site-footer__col--brand .site-footer__text {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: var(--space-3) 0 var(--space-4);
}
.site-footer__brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    font-weight: 700;
    letter-spacing: -0.01em;
    font-size: 1.05rem;
}
.site-footer__mark {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: var(--brand-gradient);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px -4px color-mix(in oklab, var(--brand) 60%, transparent);
}
.site-footer__logo img {
    max-height: 40px;
    margin-top: var(--space-3);
    opacity: 0.85;
}

.site-footer__heading {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 var(--space-4);
    padding: 0 0 var(--space-2);
    border-bottom: 1px solid var(--border-light);
    width: 100%;
}
.site-footer__heading svg { color: var(--brand); }

.site-footer__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.site-footer__list li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-secondary);
    font-size: 0.88rem;
}
.site-footer__list li svg { color: var(--text-muted); flex-shrink: 0; }
.site-footer__list a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 180ms ease;
}
.site-footer__list a:hover { color: var(--brand); }
.site-footer__list--links li { gap: 0; }
.site-footer__list--links a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 4px 0;
}
.site-footer__list--links a::before {
    content: "→";
    color: var(--brand);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 180ms ease, transform 180ms ease;
}
[dir="rtl"] .site-footer__list--links a::before { content: "←"; transform: translateX(4px); }
.site-footer__list--links a:hover::before { opacity: 1; transform: translateX(0); }

.site-footer__address {
    font-style: normal;
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.88rem;
}
.site-footer__address p { margin: 0 0 var(--space-1); }
.site-footer__map-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 14px;
    background: var(--brand-muted);
    color: var(--brand);
    border-radius: var(--radius-pill);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: var(--space-3);
    transition: background 180ms ease, transform 180ms ease;
}
.site-footer__map-btn:hover { background: var(--brand); color: var(--text-inverse); transform: translateY(-1px); }

.site-footer__bottom {
    border-top: 1px solid var(--border-light);
    padding-top: var(--space-5);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.site-footer__bottom p { margin: 0; }

/* Extra bottom spacing when the tabbar overlaps the footer */
.site-footer { margin-bottom: 0; }

/* When the unified topbar/footer are present, hide legacy per-page headers/footers */
body:has([data-include="navbar"]) .tw-header,
body:has([data-include="admin-navbar"]) .tw-header,
body:has([data-include="staff-navbar"]) .tw-header,
body:has(.site-topbar) .tw-header,
body:has(.site-topbar) .rd-header,
body:has(.site-topbar) .shop-header,
body:has([data-include="footer"]) .tw-footer,
body:has(.site-footer) .tw-footer,
body:has(.site-footer) .rd-footer { display: none !important; }

/* On admin pages: the page-specific SPA bottom-nav sits ABOVE the unified
   admin tabbar with a gap. Distinct tint (surface-muted + accent border)
   so users see it as a secondary layer, not another primary nav. */
body:has(.site-tabbar--admin) nav.bottom-nav,
body:has(.site-tabbar--admin) .bottom-action-bar {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    /* Sit DIRECTLY above the unified tabbar with a small gap */
    bottom: calc(var(--tabbar-h, 68px) + env(safe-area-inset-bottom, 0px) + 8px) !important;
    top: auto !important;
    /* Distinct branded tint (different from unified surface glass) */
    width: min(640px, calc(100% - var(--space-6))) !important;
    max-width: 640px !important;
    margin: 0 auto !important;
    height: 54px !important;
    padding: 4px 6px !important;
    background: color-mix(in oklab, var(--brand) 8%, var(--surface)) !important;
    border: 1px solid color-mix(in oklab, var(--brand) 28%, var(--border)) !important;
    border-radius: var(--radius-pill) !important;
    box-shadow: 0 10px 30px -10px color-mix(in oklab, var(--brand) 45%, rgba(0,0,0,0.15)) !important;
    z-index: 1001 !important;
    justify-content: space-around !important;
    align-items: center !important;
    gap: 2px !important;
    backdrop-filter: saturate(160%) blur(14px) !important;
    -webkit-backdrop-filter: saturate(160%) blur(14px) !important;
}
/* Force override any visibility toggle from admin JS */
body:has(.site-tabbar--admin) nav.bottom-nav.visible,
body:has(.site-tabbar--admin) nav#mainBottomNav,
body:has(.site-tabbar--admin) .bottom-action-bar {
    display: flex !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Force unified admin tabbar to sit at the very bottom, above page-specific */
body:has(.site-tabbar--admin) .site-tabbar--admin {
    z-index: 1000 !important;
    inset-block-end: 0 !important;
}
body:has(.site-tabbar--admin) nav.bottom-nav .bottom-nav-btn,
body:has(.site-tabbar--admin) .bottom-action-bar .bottom-action-btn {
    padding: 4px 8px !important;
    min-width: 0 !important;
    border-radius: var(--radius-pill) !important;
    color: var(--text-secondary) !important;
}
body:has(.site-tabbar--admin) nav.bottom-nav .bottom-nav-btn .nav-label,
body:has(.site-tabbar--admin) .bottom-action-bar .bottom-action-btn .nav-label {
    font-size: 0.72rem !important;
    font-weight: 600 !important;
}
body:has(.site-tabbar--admin) nav.bottom-nav .bottom-nav-btn .nav-icon-svg,
body:has(.site-tabbar--admin) nav.bottom-nav .bottom-nav-btn svg,
body:has(.site-tabbar--admin) .bottom-action-bar .bottom-action-btn svg {
    width: 18px !important; height: 18px !important;
    padding: 0 !important;
    background: none !important;
    border-radius: 0 !important;
}
body:has(.site-tabbar--admin) nav.bottom-nav .bottom-nav-btn.active,
body:has(.site-tabbar--admin) .bottom-action-bar .bottom-action-btn.active {
    background: var(--brand) !important;
    color: var(--text-inverse) !important;
}
body:has(.site-tabbar--admin) nav.bottom-nav .bottom-nav-btn.active::before {
    display: none !important;
}

/* Reserve enough bottom padding for BOTH bars + gap */
body:has(.site-tabbar--admin):has(nav.bottom-nav),
body:has(.site-tabbar--admin):has(.bottom-action-bar) {
    padding-bottom: calc(var(--tabbar-h, 68px) + 8px + 54px + env(safe-area-inset-bottom, 0px) + var(--space-3)) !important;
}

@media (max-width: 640px) {
    body:has(.site-tabbar--admin) nav.bottom-nav,
    body:has(.site-tabbar--admin) .bottom-action-bar {
        max-width: calc(100% - var(--space-4)) !important;
        width: calc(100% - var(--space-4)) !important;
        height: 48px !important;
        bottom: calc(var(--tabbar-h, 68px) + env(safe-area-inset-bottom, 0px) + 6px) !important;
    }
    body:has(.site-tabbar--admin) nav.bottom-nav .bottom-nav-btn .nav-label,
    body:has(.site-tabbar--admin) .bottom-action-bar .bottom-action-btn .nav-label {
        font-size: 0.65rem !important;
    }
    body:has(.site-tabbar--admin):has(nav.bottom-nav),
    body:has(.site-tabbar--admin):has(.bottom-action-bar) {
        padding-bottom: calc(var(--tabbar-h, 68px) + 6px + 48px + env(safe-area-inset-bottom, 0px) + var(--space-2)) !important;
    }
}

/* Desktop: unified tabbar floats with margin-bottom: var(--space-4),
   so page-specific must lift by that same amount + tabbar height + gap. */
@media (min-width: 900px) {
    body:has(.site-tabbar--admin) nav.bottom-nav,
    body:has(.site-tabbar--admin) .bottom-action-bar {
        bottom: calc(var(--tabbar-h, 72px) + var(--space-4) + 10px) !important;
    }
    body:has(.site-tabbar--admin):has(nav.bottom-nav),
    body:has(.site-tabbar--admin):has(.bottom-action-bar) {
        padding-bottom: calc(var(--tabbar-h, 72px) + var(--space-4) + 10px + 54px + var(--space-4)) !important;
    }
}

/* ============================================================
   Cosmetic-only skin for legacy .bottom-nav (admin/staff) —
   applies the new .site-tabbar look. Preserves admin JS behavior
   and existing layout (no !important on flex/position/height).
   Loaded LAST so it wins over admin-rd-nav.css !important defaults.
   ============================================================ */
body:has(nav.bottom-nav) nav.bottom-nav,
body:has(nav.bottom-tabs) nav.bottom-tabs {
    background: color-mix(in oklab, var(--surface) 82%, transparent) !important;
    backdrop-filter: saturate(160%) blur(18px);
    -webkit-backdrop-filter: saturate(160%) blur(18px);
    border-top: 1px solid var(--border) !important;
    box-shadow: 0 -4px 20px -8px rgba(0, 0, 0, 0.10) !important;
}

body:has(nav.bottom-nav) .bottom-nav-btn.active,
body:has(nav.bottom-tabs) .bottom-tab.active {
    color: var(--brand) !important;
    background: transparent !important;
}
body:has(nav.bottom-nav) .bottom-nav-btn .nav-icon-svg,
body:has(nav.bottom-tabs) .bottom-tab .tab-icon {
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    box-sizing: content-box;
    transition: background 220ms ease, transform 220ms ease, stroke-width 220ms ease;
}
body:has(nav.bottom-nav) .bottom-nav-btn.active .nav-icon-svg,
body:has(nav.bottom-tabs) .bottom-tab.active .tab-icon {
    background: var(--brand-muted);
    transform: translateY(-1px);
}

body:has(nav.bottom-nav) .bottom-nav-btn::before,
body:has(nav.bottom-tabs) .bottom-tab::before {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    inset-block-start: 0 !important;
    inset-inline-start: 50% !important;
    transform: translateX(-50%) scaleX(0);
    transform-origin: center !important;
    width: 32px !important;
    height: 3px !important;
    border-radius: 0 0 3px 3px !important;
    background: var(--brand) !important;
    transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}
body:has(nav.bottom-nav) .bottom-nav-btn.active::before,
body:has(nav.bottom-tabs) .bottom-tab.active::before {
    transform: translateX(-50%) scaleX(1) !important;
}

@media (min-width: 992px) {
    /* Exclude admin pages with stacked nav — they use site-tabbar--admin rules above */
    body:has(nav.bottom-nav):not(:has(.site-tabbar--admin)) nav.bottom-nav,
    body:has(nav.bottom-tabs) nav.bottom-tabs {
        border-radius: var(--radius-xl) !important;
        border: 1px solid var(--border) !important;
        box-shadow: var(--shadow-xl) !important;
        max-width: 720px !important;
        margin: 0 auto var(--space-4) !important;
        bottom: env(safe-area-inset-bottom, 0px) !important;
    }
    body:has(nav.bottom-nav):not(:has(.site-tabbar--admin)) .bottom-nav-btn.active::before {
        border-radius: 3px !important;
        inset-block-start: -1px !important;
    }
}

/* Re-assert admin stacked nav after cosmetic skin (admin-dashboard uses nav.bottom-nav) */
@media (min-width: 900px) {
    body:has(.site-tabbar--admin) nav.bottom-nav,
    body:has(.site-tabbar--admin) .bottom-action-bar {
        bottom: calc(var(--tabbar-h, 72px) + var(--space-4) + 10px) !important;
        margin: 0 auto !important;
    }
    body:has(.site-tabbar--admin):has(nav.bottom-nav),
    body:has(.site-tabbar--admin):has(.bottom-action-bar) {
        padding-bottom: calc(var(--tabbar-h, 72px) + var(--space-4) + 10px + 54px + var(--space-4)) !important;
    }
}

/* ============================================================
   Hide legacy floating language pill (.ls-trigger) — the unified
   topbar has its own language selector, so the floating one is
   redundant clutter on migrated pages.
   ============================================================ */
body:has(.site-topbar) .ls-trigger,
body:has(.site-topbar) .ls-menu,
body:has([data-include="topbar"]) .ls-trigger,
body:has([data-include="topbar"]) .ls-menu,
body:has([data-include="navbar"]) .ls-trigger,
body:has([data-include="navbar"]) .ls-menu,
body:has([data-include="admin-navbar"]) .ls-trigger,
body:has([data-include="admin-navbar"]) .ls-menu,
body:has([data-include="staff-navbar"]) .ls-trigger,
body:has([data-include="staff-navbar"]) .ls-menu { display: none !important; }

/* Compact CTA on mobile so the login button doesn't dominate the topbar */
@media (max-width: 640px) {
    .site-topbar__cta {
        padding: 6px 10px !important;
        font-size: 0.78rem !important;
        gap: 4px !important;
    }
    .site-topbar__cta svg { width: 14px !important; height: 14px !important; }
    .site-topbar__lang-btn { padding: 6px 8px !important; font-size: 0.72rem !important; }
    .site-topbar__user-btn { width: 34px !important; height: 34px !important; }
    .site-topbar__avatar { width: 28px !important; height: 28px !important; font-size: 0.78rem !important; }
    .site-topbar__brand { gap: 8px !important; }
    .site-topbar__mark { width: 30px !important; height: 30px !important; }
    .site-topbar__text { font-size: 0.95rem !important; }
    .site-topbar__side { gap: 6px !important; }
    .site-topbar__icon-btn { width: 34px !important; height: 34px !important; }
}

/* ============================================================
   Push admin floating bar above the fixed bottom tabbar so
   it doesn't overlap the tabs.
   ============================================================ */
body:has(.site-tabbar) #adminFloatingBar,
body:has(nav.bottom-nav) #adminFloatingBar,
body:has(nav.bottom-tabs) #adminFloatingBar {
    bottom: calc(var(--tabbar-h, 68px) + env(safe-area-inset-bottom, 0px) + 12px) !important;
}
@media (min-width: 992px) {
    body:has(.site-tabbar) #adminFloatingBar,
    body:has(nav.bottom-nav) #adminFloatingBar,
    body:has(nav.bottom-tabs) #adminFloatingBar {
        bottom: calc(var(--tabbar-h, 72px) + var(--space-6) + 12px) !important;
    }
}

/* Tighten default topbar CTA everywhere (was too bulky) */
.site-topbar__cta {
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
    gap: 6px !important;
    min-height: 34px !important;
}
.site-topbar__cta svg { width: 14px !important; height: 14px !important; }
@media (max-width: 900px) {
    .site-topbar__cta {
        padding: 5px 10px !important;
        font-size: 0.75rem !important;
        min-height: 30px !important;
    }
    .site-topbar__cta svg { width: 12px !important; height: 12px !important; }
}
/* Keep CTA as a compact pill on tight screens (never icon-only circle) */
@media (max-width: 480px) {
    .site-topbar__cta {
        padding: 5px 10px !important;
        font-size: 0.7rem !important;
        min-height: 28px !important;
        border-radius: var(--radius-pill) !important;
    }
    .site-topbar__cta svg { display: none !important; }
}

/* ============================================================
   Booking page unification: hide legacy 3-tab bottom-tabs
   (booking / my-bookings / my-account SPA switcher) when the
   unified 5-nav site-tabbar is present, so we don't have two
   overlapping bottom bars.
   ============================================================ */
body:has(.site-tabbar) nav.bottom-tabs { display: none !important; }

/* Compact segmented pill above the booking form for accessing
   my-bookings / my-account without a dedicated bottom bar. */
.booking-quick-tabs {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: var(--space-4) auto var(--space-2);
    padding: 4px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    max-width: 480px;
    font-family: var(--font-sans);
}
.booking-quick-tabs button {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: 0;
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 180ms ease, color 180ms ease;
}
.booking-quick-tabs button:hover { color: var(--brand); }
.booking-quick-tabs button.active {
    background: var(--surface);
    color: var(--brand);
    box-shadow: var(--shadow-xs);
}

/* Hide legacy mini-footer placeholder (js/footer.js) when the new footer is present */
body:has(.site-footer) #footer-placeholder,
body:has(.site-footer) #footer-placeholder * { display: none !important; }

/* Hide the shop-lang-selector floating widget — redundant when unified topbar is present */
body:has(.site-topbar) #shopLangWidget { display: none !important; }

/* Hide legacy .shop-header on shop pages — cart button gets promoted into topbar */
body:has(.site-topbar) .shop-header { display: none !important; }

/* Cart button inside topbar (promoted from .shop-header) */
.site-topbar__cart {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-pill);
    background: var(--surface-muted);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}
.site-topbar__cart:hover {
    background: var(--brand-muted);
    color: var(--brand);
    border-color: color-mix(in oklab, var(--brand) 25%, var(--border));
}
.site-topbar__cart-badge {
    position: absolute;
    top: -4px;
    inset-inline-end: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-grid;
    place-items: center;
    background: var(--danger);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    border-radius: var(--radius-pill);
    box-shadow: 0 0 0 2px var(--surface);
}
.site-topbar__cart-badge:empty,
.site-topbar__cart-badge[data-count="0"] { display: none; }
@media (max-width: 640px) {
    .site-topbar__cart { width: 34px; height: 34px; }
}

/* ============================================================
   Mobile footer polish — tighter, cleaner, less "list of lists"
   ============================================================ */
@media (max-width: 640px) {
    .site-footer {
        padding: var(--space-6) var(--space-4) var(--space-4);
        margin-top: var(--space-8);
    }
    .site-footer__grid {
        grid-template-columns: 1fr;
        gap: var(--space-5);
        margin-bottom: var(--space-5);
    }
    .site-footer__col--brand { text-align: center; }
    .site-footer__brand {
        justify-content: center;
        font-size: 1rem;
    }
    .site-footer__col--brand .site-footer__text {
        margin: var(--space-2) 0 var(--space-3);
        font-size: 0.85rem;
    }
    .site-footer__col--brand .site-footer__logo { text-align: center; }
    .site-footer__col--brand .site-footer__logo img {
        max-height: 32px;
        margin: var(--space-2) auto 0;
    }
    /* Compact heading — subtler on mobile */
    .site-footer__heading {
        font-size: 0.7rem;
        margin: 0 0 var(--space-3);
        padding-bottom: var(--space-2);
        letter-spacing: 0.06em;
        justify-content: flex-start;
    }
    .site-footer__list { gap: var(--space-2); }
    .site-footer__list li {
        font-size: 0.82rem;
        gap: 6px;
    }
    .site-footer__list li svg { width: 12px; height: 12px; }
    .site-footer__address { font-size: 0.82rem; line-height: 1.55; }
    .site-footer__map-btn {
        padding: 7px 12px;
        font-size: 0.78rem;
        margin-top: var(--space-2);
    }
    .site-footer__bottom {
        padding-top: var(--space-4);
        font-size: 0.72rem;
    }
    /* Links column: 2-column inline chips (dense navigation) */
    .site-footer__list--links {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-1) var(--space-3);
    }
    .site-footer__list--links a {
        padding: 6px 0;
        font-size: 0.8rem;
    }
    .site-footer__list--links a::before { display: none; }
}

/* Extra-tight for very small screens */
@media (max-width: 380px) {
    .site-footer { padding: var(--space-5) var(--space-3) var(--space-3); }
    .site-footer__grid { gap: var(--space-4); }
    .site-footer__list li { font-size: 0.78rem; }
}

/* ============================================================
   Force-unify site-footer colors — beat theme-variants.css's
   !important rule on generic `footer` (which was making the
   footer look different per store theme).
   ============================================================ */
footer.site-footer,
body footer.site-footer {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-top: 1px solid var(--border) !important;
}
footer.site-footer a,
body footer.site-footer a {
    color: var(--text-secondary) !important;
    opacity: 1 !important;
}
footer.site-footer a:hover,
body footer.site-footer a:hover {
    color: var(--brand) !important;
}
footer.site-footer .site-footer__heading,
footer.site-footer .site-footer__brand,
footer.site-footer .site-footer__title {
    color: var(--text) !important;
}
footer.site-footer .site-footer__text,
footer.site-footer .site-footer__list li,
footer.site-footer .site-footer__address,
footer.site-footer .site-footer__bottom {
    color: var(--text-secondary) !important;
}
footer.site-footer .site-footer__list li svg { color: var(--text-muted) !important; }
footer.site-footer .site-footer__heading svg { color: var(--brand) !important; }
footer.site-footer .site-footer__map-btn {
    background: var(--brand-muted) !important;
    color: var(--brand) !important;
}
footer.site-footer .site-footer__map-btn:hover {
    background: var(--brand) !important;
    color: var(--text-inverse) !important;
}
footer.site-footer .site-footer__mark {
    background: var(--brand-gradient) !important;
    color: var(--text-inverse) !important;
}
