/* SelfOrdering kiosk visual language — premium, minimal, McDonald's/Toast/Square-kiosk grade.
   Scoped entirely under .app-selfordering so it never leaks into the other 3 PWAs.
   Written with logical/direction-safe rules ([dir] overrides, not RTL-only assumptions like app.css) */

.app-selfordering {
    /* ---------- Design tokens ---------- */
    --so-primary: #3559E0;
    --so-primary-hover: #2746C7;
    --so-primary-dark: #2746C7;
    --so-accent: #FF9F43;
    --so-bg: #F7F8FC;
    --so-card: #ffffff;
    --so-text: #222222;
    --so-muted: #777777;
    --so-border: #ECECEC;
    --so-success: #34C759;
    --so-danger: #FF4D4F;

    /* Radius scale */
    --so-radius-btn: 14px;
    --so-radius-card: 20px;
    --so-radius-search: 18px;
    --so-radius-cat: 18px;
    --so-radius-banner: 22px;
    --so-radius-pill: 999px;
    /* legacy aliases kept for any un-migrated rule below */
    --so-radius: var(--so-radius-cat);
    --so-radius-lg: var(--so-radius-card);

    /* Elevation */
    --so-shadow-1: 0 4px 12px rgba(0, 0, 0, .08);
    --so-shadow-2: 0 8px 24px rgba(0, 0, 0, .12);
    --so-shadow: var(--so-shadow-1);
    --so-shadow-lg: var(--so-shadow-2);

    /* Spacing grid (8px base) */
    --so-sp-1: 8px;
    --so-sp-2: 16px;
    --so-sp-3: 24px;
    --so-sp-4: 32px;
    --so-sp-5: 40px;

    /* Motion */
    --so-ease: cubic-bezier(.25, .8, .25, 1);
    --so-dur: 250ms;

    background: var(--so-bg);
    color: var(--so-text);
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Tahoma, sans-serif;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    /* body (app.css) is already a fixed-height flex column, so this makes .app-selfordering
       exactly one viewport tall - the shared shell across all SelfOrdering pages. Pages that
       don't need internal scroll regions (.so-screen) are unaffected: they simply overflow
       this box's visible area as before via their own scroll on .so-screen if needed. Pages
       that DO opt in (MenuBrowse's .so-browse-page) size to flex:1/min-height:0 and manage
       their own overflow-y regions instead of letting the whole shell scroll. */
    flex: 1;
    min-height: 0;
    height: 100vh;
    overflow: hidden;
}

@media (prefers-color-scheme: dark) {
    .app-selfordering {
        --so-bg: #0d1016;
        --so-card: #171b24;
        --so-text: #f1f2f6;
        --so-muted: #9299a8;
        --so-border: #2a2f3b;
        --so-shadow-1: 0 4px 12px rgba(0, 0, 0, .35);
        --so-shadow-2: 0 8px 24px rgba(0, 0, 0, .45);
    }
}

.app-selfordering * {
    box-sizing: border-box;
}

.app-selfordering button:focus-visible,
.app-selfordering input:focus-visible,
.app-selfordering textarea:focus-visible {
    outline: 3px solid var(--so-accent);
    outline-offset: 2px;
}

.app-selfordering button,
.app-selfordering input,
.app-selfordering textarea {
    font-family: inherit;
}

/* SelfOrderingLayout renders its own #blazor-error-ui div (same markup as MainLayout)
   but has no .razor.css of its own, so it never got the base "hidden until Blazor's JS
   shows it on a real unhandled error" rule that MainLayout.razor.css defines - the div
   rendered visible by default on every self-ordering page regardless of any actual error. */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ---------- Header ---------- */
.selfordering-header {
    position: sticky;
    top: 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--so-sp-3);
    padding: var(--so-sp-2) var(--so-sp-4);
    background: color-mix(in srgb, var(--so-card) 82%, transparent);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    box-shadow: var(--so-shadow-1);
    border-bottom: 1px solid var(--so-border);
    flex-shrink: 0;
    z-index: 40;
}

.selfordering-header-start {
    display: flex;
    align-items: center;
    justify-self: start;
}

.selfordering-header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-self: center;
    gap: 2px;
    text-align: center;
}

.selfordering-header-end {
    display: flex;
    align-items: center;
    justify-self: end;
}

.selfordering-brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.selfordering-brand {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -.3px;
    line-height: 1.1;
}

.selfordering-welcome {
    color: var(--so-muted);
    font-size: 15px;
    font-weight: 500;
}

.selfordering-logo {
    max-height: 44px;
    width: auto;
    display: block;
    border-radius: 10px;
}

.lang-toggle {
    display: flex;
    gap: 6px;
    background: var(--so-bg);
    padding: 4px;
    border-radius: var(--so-radius-pill);
    border: 1px solid var(--so-border);
}

.lang-btn {
    border: none;
    background: transparent;
    color: var(--so-muted);
    border-radius: var(--so-radius-pill);
    padding: 8px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    min-height: 40px;
    transition: background var(--so-dur) var(--so-ease), color var(--so-dur) var(--so-ease), transform 120ms var(--so-ease);
}

.lang-btn.active {
    background: var(--so-primary);
    color: #fff;
    box-shadow: var(--so-shadow-1);
}

.lang-btn:active {
    transform: scale(0.95);
}

/* Header cart chip: glanceable summary, navigates to the menu/cart flow */
.selfordering-cart-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--so-bg);
    border: 1px solid var(--so-border);
    border-radius: var(--so-radius-pill);
    padding: 8px 18px 8px 8px;
    cursor: pointer;
    min-height: 48px;
    transition: transform 120ms var(--so-ease), box-shadow var(--so-dur) var(--so-ease);
}

.selfordering-cart-chip:hover {
    box-shadow: var(--so-shadow-1);
    transform: translateY(-1px);
}

.selfordering-cart-chip:active {
    transform: scale(0.96);
}

.selfordering-cart-chip-icon {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--so-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.selfordering-cart-chip-count {
    position: absolute;
    top: -4px;
    inset-inline-end: -4px;
    background: var(--so-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 0 0 2px var(--so-card);
}

.selfordering-cart-chip-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    text-align: start;
}

.selfordering-cart-chip-label {
    font-size: 12px;
    color: var(--so-muted);
    font-weight: 600;
}

.selfordering-cart-chip-total {
    font-size: 16px;
    font-weight: 700;
    color: var(--so-text);
}

/* ---------- Generic screen shell ---------- */
.so-screen {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--so-sp-4) var(--so-sp-3) 120px;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    animation: so-fade-in var(--so-dur) ease-out;
}

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

.so-title {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 800;
    margin: var(--so-sp-2) 0 var(--so-sp-1);
    text-align: center;
}

.so-subtitle {
    color: var(--so-muted);
    font-size: 1.1rem;
    margin-bottom: var(--so-sp-3);
    text-align: center;
}

/* ---------- Big choice cards (order type / details screen) ---------- */
.so-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--so-sp-3);
    width: 100%;
}

.so-choice-card {
    background: var(--so-card);
    border: 1px solid var(--so-border);
    border-radius: var(--so-radius-card);
    box-shadow: var(--so-shadow-1);
    padding: var(--so-sp-5) var(--so-sp-3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--so-text);
    transition: transform var(--so-dur) var(--so-ease), box-shadow var(--so-dur) var(--so-ease);
    min-height: 200px;
}

.so-choice-card .so-choice-icon {
    font-size: 3.2rem;
}

.so-choice-card:hover,
.so-choice-card:focus-visible {
    transform: translateY(-4px);
    box-shadow: var(--so-shadow-2);
}

.so-choice-card:active {
    transform: scale(0.97);
}

.so-choice-card.secondary {
    background: transparent;
    border: 2px dashed var(--so-border);
    box-shadow: none;
    font-size: 1.1rem;
    min-height: 120px;
}

/* ---------- Numeric / table entry ---------- */
.so-input-row {
    display: flex;
    flex-direction: column;
    gap: var(--so-sp-2);
    width: 100%;
    max-width: 420px;
}

.so-big-input {
    font-size: 2rem;
    text-align: center;
    padding: var(--so-sp-2);
    border-radius: var(--so-radius-search);
    border: 1px solid var(--so-border);
    background: var(--so-card);
    color: var(--so-text);
}

/* ---------- Browse page: persistent left sidebar + content (always visually left,
   regardless of AR/EN - the "direction: ltr" here is structural only, anchoring which
   pane is left vs right; text inside each pane still flows per its own dir via the
   page-level dir attribute on .app-selfordering). ---------- */
.so-browse-page {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--so-sp-3) var(--so-sp-3) 0;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    animation: so-fade-in var(--so-dur) ease-out;
}

.so-browse-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    /* Forced ltr here only pins DOM order to physical left/right (sidebar always visually
       left, per design request) - it does NOT control text direction inside either pane,
       which is reset back to the real page language immediately below. */
    direction: ltr;
    gap: var(--so-sp-3);
    width: 100%;
    align-items: stretch;
    padding-bottom: 120px;
}

.so-category-sidebar,
.so-browse-content {
    direction: rtl;
}

.app-selfordering[dir="ltr"] .so-category-sidebar,
.app-selfordering[dir="ltr"] .so-browse-content {
    direction: ltr;
}

.so-category-sidebar {
    flex: 0 0 216px;
    display: flex;
    flex-direction: column;
    gap: var(--so-sp-2);
    height: 100%;
    overflow-y: auto;
    padding: 2px 6px 2px 2px;
    scrollbar-width: none;
}

.so-category-sidebar::-webkit-scrollbar {
    display: none;
}

/* Flat category cards: square corners, uniform height regardless of label length,
   subtle tint feedback on hover/active instead of a 3D lift (kept intentionally flat).
   One consistent card style (white + border) for every entry - color is only ever used
   as a small accent (icon chip / active fill), never as a full-card fill, so the sidebar
   reads as one coherent set instead of a mix of different-colored buttons. */
.so-sidebar-btn {
    border: 1px solid var(--so-border);
    background: var(--so-card);
    color: var(--so-text);
    box-shadow: none;
    border-radius: 0;
    padding: var(--so-sp-2) 6px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background var(--so-dur) var(--so-ease), color var(--so-dur) var(--so-ease),
                border-color var(--so-dur) var(--so-ease);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 132px;
}

.so-sidebar-btn:hover {
    background: color-mix(in srgb, var(--so-primary) 6%, var(--so-card));
    border-color: color-mix(in srgb, var(--so-primary) 35%, var(--so-border));
}

.so-sidebar-thumb {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 0;
    overflow: hidden;
    background: var(--so-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    transition: background var(--so-dur) var(--so-ease);
}

.so-sidebar-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.so-sidebar-label {
    min-width: 0;
    width: 100%;
    line-height: 1.45;
    letter-spacing: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.so-sidebar-btn.active {
    background: var(--so-primary);
    color: #fff;
    border-color: var(--so-primary);
}

.so-sidebar-btn.active .so-sidebar-thumb {
    background: rgba(255, 255, 255, 0.18);
}

.so-sidebar-btn:active {
    background: color-mix(in srgb, var(--so-primary) 12%, var(--so-card));
}

.so-sidebar-btn.home {
    border: 1px solid var(--so-primary);
    background: var(--so-card);
    color: var(--so-primary);
    margin-bottom: 2px;
    height: 64px;
}

.so-sidebar-btn.home.active,
.so-sidebar-btn.home:hover {
    background: var(--so-primary);
    color: #fff;
}

.so-sidebar-btn.home .so-sidebar-thumb {
    background: transparent;
    width: auto;
    height: auto;
}

/* ---------- Featured (hot / best seller / offers) sidebar entry - same flat white
   card as every other entry; the only accent is the icon chip tint, so it stands out
   without breaking the sidebar's color consistency. ---------- */
.so-sidebar-btn.featured {
    border-color: var(--so-border);
}

.so-sidebar-btn.featured.active {
    background: var(--so-primary);
    border-color: var(--so-primary);
    color: #fff;
}

.so-sidebar-thumb.featured-thumb {
    background: color-mix(in srgb, var(--so-accent) 16%, var(--so-bg));
}

.so-sidebar-btn.featured.active .so-sidebar-thumb.featured-thumb {
    background: rgba(255, 255, 255, 0.18);
}

.so-browse-content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Title/search/pills stay pinned above the scrolling product area - only
   .so-content-scroll (promo banner + grid + empty state) scrolls. */
.so-browse-content-fixed {
    flex-shrink: 0;
    border-bottom: 1px solid var(--so-border);
    padding-bottom: var(--so-sp-1);
}

.so-content-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: var(--so-sp-3);
    scrollbar-width: thin;
    scrollbar-color: var(--so-border) transparent;
}

.so-content-scroll::-webkit-scrollbar {
    width: 6px;
}

.so-content-scroll::-webkit-scrollbar-thumb {
    background: var(--so-border);
    border-radius: 999px;
}

@media (max-width: 720px) {
    .so-browse-layout {
        flex-direction: column;
    }

    .so-category-sidebar {
        flex-direction: row;
        height: auto;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        flex: 0 0 auto;
        gap: var(--so-sp-1);
        padding-bottom: 6px;
    }

    .so-sidebar-btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* ---------- Page title & category pill filters ---------- */
.so-page-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.2px;
    margin: 4px 0 var(--so-sp-2);
    animation: so-fade-in var(--so-dur) ease-out;
}

.so-pill-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: var(--so-sp-1);
    margin-bottom: 2px;
}

.so-pill-row::-webkit-scrollbar {
    display: none;
}

.so-pill {
    flex: 0 0 auto;
    border: 1px solid var(--so-border);
    background: var(--so-card);
    color: var(--so-text);
    border-radius: var(--so-radius-pill);
    padding: 10px 20px;
    min-height: 44px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--so-dur) var(--so-ease), color var(--so-dur) var(--so-ease), transform 120ms var(--so-ease), border-color var(--so-dur) var(--so-ease);
}

.so-pill:hover {
    border-color: var(--so-primary);
}

.so-pill.active {
    background: var(--so-primary);
    color: #fff;
    border-color: var(--so-primary);
    box-shadow: var(--so-shadow-1);
}

.so-pill:active {
    transform: scale(0.96);
}

/* ---------- Promo banner: rounded hero with gradient scrim + CTA ---------- */
.so-promo-banner {
    width: 100%;
    border-radius: var(--so-radius-banner);
    overflow: hidden;
    box-shadow: var(--so-shadow-2);
    margin-bottom: var(--so-sp-3);
    min-height: 90px;
    position: relative;
    animation: so-fade-in var(--so-dur) ease-out;
}

.so-promo-banner img {
    width: 100%;
    max-height: 280px;
    aspect-ratio: 21 / 8;
    object-fit: cover;
    display: block;
}

.so-promo-caption {
    padding: var(--so-sp-2) var(--so-sp-3);
    background: linear-gradient(120deg, var(--so-primary) 0%, var(--so-primary-hover) 100%);
    color: #fff;
    font-weight: 800;
    font-size: 20px;
}

/* When an image is present, the caption becomes an overlay scrim at the bottom of
   the photo instead of a separate bar - :has() is safe here, kiosks run Chromium/Edge/Safari. */
.so-promo-banner:has(img) .so-promo-caption {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    padding: 40px var(--so-sp-3) var(--so-sp-2);
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.68) 0%, rgba(0, 0, 0, 0.28) 60%, transparent 100%);
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ---------- Search ---------- */
.so-search {
    width: 100%;
    margin: var(--so-sp-1) 0 var(--so-sp-2);
    position: relative;
}

.so-search input {
    width: 100%;
    padding: 14px 52px;
    font-size: 16px;
    font-weight: 500;
    border-radius: var(--so-radius-search);
    border: 1px solid var(--so-border);
    background: var(--so-card);
    color: var(--so-text);
    box-shadow: var(--so-shadow-1);
    transition: border-color var(--so-dur) var(--so-ease), box-shadow var(--so-dur) var(--so-ease), transform 120ms var(--so-ease);
}

.so-search input::placeholder {
    color: var(--so-muted);
}

.so-search input:focus-visible {
    border-color: var(--so-primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--so-primary) 16%, transparent), var(--so-shadow-2);
    outline: none;
}

.so-search-icon {
    position: absolute;
    inset-inline-start: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.05rem;
    color: var(--so-muted);
    pointer-events: none;
}

.so-search-clear {
    position: absolute;
    inset-inline-end: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--so-bg);
    color: var(--so-muted);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--so-dur) var(--so-ease), color var(--so-dur) var(--so-ease);
}

.so-search-clear:hover {
    background: var(--so-primary);
    color: #fff;
}

/* ---------- Product grid & card ---------- */
.so-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--so-sp-3);
    width: 100%;
}

.so-product-card {
    background: var(--so-card);
    border-radius: var(--so-radius-card);
    border: 1px solid var(--so-border);
    box-shadow: var(--so-shadow-1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform var(--so-dur) var(--so-ease), box-shadow var(--so-dur) var(--so-ease), border-color var(--so-dur) var(--so-ease);
    position: relative;
}

.so-product-card:hover,
.so-product-card:focus-visible {
    transform: translateY(-5px);
    border-color: color-mix(in srgb, var(--so-primary) 25%, var(--so-border));
    box-shadow: var(--so-shadow-2);
}

.so-product-card:active {
    transform: scale(0.98);
}

.so-product-img-wrap {
    aspect-ratio: 4 / 3;
    flex: 0 0 auto;
    overflow: hidden;
    background: var(--so-bg);
    border-radius: var(--so-radius-card) var(--so-radius-card) 0 0;
    position: relative;
}

.so-product-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 400ms var(--so-ease), opacity var(--so-dur) ease;
}

.so-product-card:hover .so-product-img-wrap img {
    transform: scale(1.06);
}

.so-product-labels {
    position: absolute;
    top: 10px;
    inset-inline-start: 10px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.so-label-badge {
    background: rgba(255, 255, 255, 0.95);
    color: var(--so-text);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: .2px;
    box-shadow: var(--so-shadow-1);
}

.so-label-badge.hot {
    background: var(--so-danger);
    color: #fff;
}

.so-label-badge.popular {
    background: var(--so-accent);
    color: #fff;
}

.so-product-body {
    padding: var(--so-sp-2);
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.so-product-name {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
}

.so-product-desc {
    font-size: 15px;
    color: var(--so-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.so-product-meta {
    display: flex;
    gap: 10px;
    color: var(--so-muted);
    font-size: 13px;
    font-weight: 600;
}

.so-product-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--so-sp-1);
}

.so-product-price {
    font-weight: 700;
    font-size: 18px;
    color: var(--so-text);
}

/* Flat add button - square corners, no shadow, matches the sidebar's flat language */
.so-add-btn {
    position: relative;
    overflow: hidden;
    background: var(--so-primary);
    color: #fff;
    border: none;
    border-radius: 0;
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    transition: background var(--so-dur) var(--so-ease), transform 120ms var(--so-ease);
    flex-shrink: 0;
}

.so-add-btn:hover {
    background: var(--so-primary-hover);
}

.so-add-btn:active {
    transform: scale(0.92);
}

/* Quantity badge shown on a product card once it's in the cart */
.so-product-qty-badge {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    background: var(--so-primary);
    color: #fff;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    box-shadow: var(--so-shadow-1);
    animation: so-pop-in 250ms var(--so-ease);
}

@keyframes so-pop-in {
    from { transform: scale(0.4); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.so-empty-msg {
    color: var(--so-muted);
    text-align: center;
    padding: var(--so-sp-5) 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--so-sp-1);
    font-size: 1.05rem;
}

.so-empty-msg-icon {
    font-size: 2.4rem;
}

/* ---------- Loading skeleton (fills the grid area while data is fetched, so the
   fixed-height scroll shell doesn't flash empty) ---------- */
.so-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--so-sp-3);
    width: 100%;
}

.so-skeleton-card {
    border-radius: var(--so-radius-card);
    overflow: hidden;
    background: var(--so-card);
    box-shadow: var(--so-shadow-1);
    display: flex;
    flex-direction: column;
}

.so-skeleton-img {
    aspect-ratio: 4 / 3;
    background: linear-gradient(90deg, var(--so-border) 25%, #dfe3ec 37%, var(--so-border) 63%);
    background-size: 400% 100%;
    animation: so-skeleton-pulse 1.4s ease infinite;
}

.so-skeleton-line {
    height: 14px;
    margin: var(--so-sp-2) var(--so-sp-2) 0;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--so-border) 25%, #dfe3ec 37%, var(--so-border) 63%);
    background-size: 400% 100%;
    animation: so-skeleton-pulse 1.4s ease infinite;
}

.so-skeleton-line.short {
    width: 55%;
    margin-bottom: var(--so-sp-2);
}

@media (prefers-color-scheme: dark) {
    .so-skeleton-img,
    .so-skeleton-line {
        background: linear-gradient(90deg, #232838 25%, #2b3145 37%, #232838 63%);
        background-size: 400% 100%;
    }
}

@keyframes so-skeleton-pulse {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ---------- Floating bottom cart bar ---------- */
.so-cart-bar {
    position: fixed;
    left: var(--so-sp-3);
    right: var(--so-sp-3);
    bottom: var(--so-sp-3);
    background: var(--so-card);
    border: 1px solid var(--so-border);
    border-radius: var(--so-radius-card);
    box-shadow: var(--so-shadow-2);
    padding: 14px var(--so-sp-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--so-sp-3);
    z-index: 50;
    animation: so-slide-up var(--so-dur) var(--so-ease);
}

@keyframes so-slide-up {
    from { transform: translateY(120%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.so-cart-bar-summary {
    display: flex;
    align-items: center;
    gap: var(--so-sp-2);
    min-width: 0;
}

.so-cart-bar-icon-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--so-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.so-cart-bar-icon-wrap.pulse {
    animation: so-cart-pulse var(--so-dur) var(--so-ease);
}

@keyframes so-cart-pulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.18); }
    100% { transform: scale(1); }
}

.so-cart-bar-icon {
    font-size: 1.3rem;
}

.so-cart-bar-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.so-cart-bar-count {
    font-size: 13px;
    color: var(--so-muted);
    font-weight: 600;
}

.so-cart-bar-total {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--so-text);
}

.so-cart-bar-actions {
    display: flex;
    align-items: center;
    gap: var(--so-sp-2);
    flex: 0 0 auto;
}

.so-btn-cancel {
    background: transparent;
    color: var(--so-danger);
    border: 1px solid var(--so-danger);
    border-radius: var(--so-radius-btn);
    padding: 14px 20px;
    min-height: 48px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--so-dur) var(--so-ease), color var(--so-dur) var(--so-ease), transform 120ms var(--so-ease);
}

.so-btn-cancel:hover {
    background: var(--so-danger);
    color: #fff;
}

.so-btn-cancel:active {
    transform: scale(0.96);
}

.so-cart-bar-cta {
    width: auto;
    min-height: 48px;
    padding-inline: 30px;
}

@media (max-width: 640px) {
    .so-cart-bar {
        left: var(--so-sp-2);
        right: var(--so-sp-2);
        bottom: var(--so-sp-2);
        padding: 12px 14px;
        gap: var(--so-sp-1);
    }

    .so-cart-bar-cta {
        padding-inline: 18px;
        font-size: 1rem;
    }

    .so-btn-cancel {
        padding-inline: 14px;
    }
}

/* ---------- Confirmation / inactivity dialogs ---------- */
.so-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 18, 25, 0.5);
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--so-sp-2);
    animation: so-fade-in 200ms ease-out;
}

.so-dialog {
    background: var(--so-card);
    color: var(--so-text);
    border-radius: var(--so-radius-card);
    box-shadow: var(--so-shadow-2);
    padding: var(--so-sp-4) var(--so-sp-3);
    width: 100%;
    max-width: 440px;
    text-align: center;
    animation: so-dialog-in var(--so-dur) var(--so-ease);
}

@keyframes so-dialog-in {
    from { opacity: 0; transform: scale(0.94); }
    to   { opacity: 1; transform: scale(1); }
}

.so-dialog-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: var(--so-sp-1);
}

.so-dialog-message {
    color: var(--so-muted);
    font-size: 15px;
    margin-bottom: var(--so-sp-2);
}

.so-dialog-actions {
    display: flex;
    gap: var(--so-sp-2);
}

.so-dialog-actions button {
    min-height: 52px;
}

.so-inactivity-overlay {
    z-index: 200;
}

.so-inactivity-countdown {
    font-size: 3rem;
    font-weight: 800;
    color: var(--so-primary);
    margin-bottom: var(--so-sp-2);
}

/* ---------- Cart drawer ---------- */
.so-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 18, 25, 0.4);
    z-index: 60;
    display: flex;
    justify-content: flex-end;
    animation: so-fade-in 200ms ease-out;
}

.app-selfordering[dir="rtl"] .so-drawer-backdrop {
    justify-content: flex-start;
}

.so-drawer {
    background: var(--so-bg);
    width: min(440px, 100%);
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
    animation: so-drawer-in var(--so-dur) var(--so-ease);
}

@keyframes so-drawer-in {
    from { transform: translateX(24px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.app-selfordering[dir="rtl"] .so-drawer {
    animation-name: so-drawer-in-rtl;
}

@keyframes so-drawer-in-rtl {
    from { transform: translateX(-24px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.so-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--so-sp-2) var(--so-sp-2);
    background: var(--so-card);
    box-shadow: var(--so-shadow-1);
}

.so-drawer-header h3 {
    font-size: 20px;
    font-weight: 800;
    margin: 0;
}

.so-drawer-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--so-text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--so-dur) var(--so-ease);
}

.so-drawer-close:hover {
    background: var(--so-bg);
}

.so-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--so-sp-2) var(--so-sp-2);
}

.so-cart-line {
    background: var(--so-card);
    border: 1px solid var(--so-border);
    border-radius: var(--so-radius-card);
    padding: 14px var(--so-sp-2);
    margin-bottom: var(--so-sp-2);
    box-shadow: var(--so-shadow-1);
    transition: box-shadow var(--so-dur) var(--so-ease);
}

.so-cart-line:hover {
    box-shadow: var(--so-shadow-2);
}

.so-cart-line.child {
    margin-inline-start: var(--so-sp-3);
    box-shadow: none;
    border: none;
    background: transparent;
    padding-block: 6px;
}

.so-cart-line-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--so-sp-1);
}

.so-cart-line-name {
    font-weight: 700;
    flex: 1;
}

.so-cart-line-note {
    font-size: 13px;
    color: var(--so-muted);
    margin-top: 4px;
    cursor: pointer;
}

.so-qty-stepper {
    display: flex;
    align-items: center;
    gap: var(--so-sp-1);
}

.so-qty-stepper button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--so-border);
    background: var(--so-bg);
    font-size: 1.05rem;
    cursor: pointer;
    transition: background var(--so-dur) var(--so-ease), transform 120ms var(--so-ease);
}

.so-qty-stepper button:hover {
    background: var(--so-primary);
    color: #fff;
    border-color: var(--so-primary);
}

.so-qty-stepper button:active {
    transform: scale(0.9);
}

.so-drawer-footer {
    padding: var(--so-sp-2) var(--so-sp-2) var(--so-sp-3);
    background: var(--so-card);
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.06);
}

.so-total-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 15px;
}

.so-total-row.grand {
    font-size: 20px;
    font-weight: 800;
    border-top: 1px solid var(--so-border);
    margin-top: var(--so-sp-1);
    padding-top: 10px;
}

/* ---------- Checkout / order review screen ---------- */
.so-review-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--so-sp-2);
    width: 100%;
}

.so-review-title-wrap {
    flex: 1 1 auto;
    min-width: 0;
}

.so-review-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: var(--so-sp-2) 0 4px;
    text-align: start;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.so-review-subtitle {
    color: var(--so-muted);
    font-size: 14px;
    font-weight: 600;
}

.so-review-add-more {
    width: auto;
    min-height: 44px;
    padding: 10px var(--so-sp-3);
    flex-shrink: 0;
    background: var(--so-card);
    box-shadow: var(--so-shadow-1);
}

.so-review-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    margin: var(--so-sp-2) 0;
}

.so-review-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--so-card);
    border: 1px solid var(--so-border);
    border-radius: var(--so-radius-pill);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--so-shadow-1);
}

.so-review-list {
    display: flex;
    flex-direction: column;
    gap: var(--so-sp-2);
    width: 100%;
    margin-top: var(--so-sp-1);
}

.so-review-item {
    display: flex;
    align-items: center;
    gap: var(--so-sp-2);
    background: var(--so-card);
    border: 1px solid var(--so-border);
    border-radius: var(--so-radius-card);
    box-shadow: var(--so-shadow-1);
    padding: 12px var(--so-sp-2);
    transition: box-shadow var(--so-dur) var(--so-ease);
}

.so-review-item:hover {
    box-shadow: var(--so-shadow-2);
}

.so-review-thumb {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: var(--so-radius-cat);
    overflow: hidden;
    background: var(--so-bg);
}

.so-review-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.so-review-item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.so-review-child {
    display: flex;
    justify-content: space-between;
    gap: var(--so-sp-1);
    color: var(--so-muted);
    font-size: 13px;
    padding-inline-start: var(--so-sp-2);
}

.so-review-item-end {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.so-review-qty-pill {
    flex-shrink: 0;
    background: color-mix(in srgb, var(--so-primary) 10%, var(--so-bg));
    color: var(--so-primary);
    font-size: 13px;
    font-weight: 700;
    border-radius: var(--so-radius-pill);
    padding: 3px 12px;
    white-space: nowrap;
}

.so-review-item-price {
    flex-shrink: 0;
    font-weight: 800;
    font-size: 17px;
    white-space: nowrap;
}

.so-review-summary {
    width: 100%;
    background: var(--so-card);
    border: 1px solid var(--so-border);
    border-radius: var(--so-radius-card);
    box-shadow: var(--so-shadow-1);
    padding: var(--so-sp-2) var(--so-sp-3);
    margin-top: var(--so-sp-3);
}

/* ---------- Buttons (one shared style: rounded, same height, soft shadow, press animation) ---------- */
.so-btn-primary {
    background: var(--so-primary);
    color: #fff;
    border: none;
    border-radius: var(--so-radius-btn);
    padding: 15px var(--so-sp-3);
    min-height: 52px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    box-shadow: var(--so-shadow-2);
    transition: background var(--so-dur) var(--so-ease), transform 120ms var(--so-ease), box-shadow var(--so-dur) var(--so-ease);
}

.so-btn-primary:hover:not(:disabled) {
    background: var(--so-primary-hover);
}

.so-btn-primary:disabled {
    background: var(--so-border);
    color: var(--so-muted);
    box-shadow: none;
    cursor: not-allowed;
}

.so-btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.so-btn-outline {
    background: transparent;
    color: var(--so-primary);
    border: 1px solid var(--so-primary);
    border-radius: var(--so-radius-btn);
    padding: 14px var(--so-sp-3);
    min-height: 52px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background var(--so-dur) var(--so-ease), color var(--so-dur) var(--so-ease), transform 120ms var(--so-ease);
}

.so-btn-outline:hover {
    background: color-mix(in srgb, var(--so-primary) 8%, transparent);
}

.so-btn-outline:active {
    transform: scale(0.98);
}

/* ---------- Full-screen product customization (self-ordering only - not the captain modal) ---------- */
.so-customize-overlay {
    position: fixed;
    inset: 0;
    background: var(--so-bg);
    z-index: 70;
    display: flex;
    flex-direction: column;
    animation: so-fade-in 200ms ease-out;
}

.so-customize-scroll {
    flex: 1;
    overflow-y: auto;
}

.so-customize-hero {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 34vh;
    background: linear-gradient(180deg, #eef1fb 0%, #e4e8f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--so-sp-3);
}

@media (prefers-color-scheme: dark) {
    .so-customize-hero {
        background: linear-gradient(180deg, #1a1f2e 0%, #12151f 100%);
    }
}

.so-customize-hero img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.15));
}

.so-customize-close {
    position: absolute;
    top: var(--so-sp-2);
    inset-inline-end: var(--so-sp-2);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.92);
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--so-shadow-1);
}

.so-customize-body {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--so-sp-3) var(--so-sp-2) 140px;
}

.so-customize-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
}

.so-customize-desc {
    color: var(--so-muted);
    font-size: 15px;
    margin-bottom: var(--so-sp-2);
}

.so-customize-qty-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--so-card);
    border: 1px solid var(--so-border);
    border-radius: var(--so-radius-card);
    box-shadow: var(--so-shadow-1);
    padding: var(--so-sp-2);
    margin-bottom: var(--so-sp-3);
    font-size: 17px;
    font-weight: 700;
}

.so-qty-stepper.large button {
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
}

.so-qty-stepper.large span {
    font-size: 1.3rem;
    min-width: 28px;
    text-align: center;
    display: inline-block;
}

.so-customize-group {
    margin-bottom: var(--so-sp-3);
}

.so-customize-group h3 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: var(--so-sp-2);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.so-required-tag {
    background: color-mix(in srgb, var(--so-accent) 18%, transparent);
    color: var(--so-accent);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 3px 10px;
}

.so-selection-count {
    color: var(--so-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.so-customize-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--so-sp-2);
}

.so-customize-option-card {
    background: var(--so-card);
    border: 1px solid var(--so-border);
    border-radius: var(--so-radius-cat);
    box-shadow: var(--so-shadow-1);
    padding: var(--so-sp-2);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: var(--so-sp-1);
    align-items: flex-start;
    transition: border-color var(--so-dur) var(--so-ease), transform 120ms var(--so-ease), box-shadow var(--so-dur) var(--so-ease);
}

.so-customize-option-card:hover:not(.disabled) {
    box-shadow: var(--so-shadow-2);
}

.so-customize-option-card.selected {
    border-color: var(--so-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--so-primary) 14%, transparent);
}

.so-customize-option-card.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.so-customize-option-card:active:not(.disabled) {
    transform: scale(0.97);
}

.so-option-name {
    font-weight: 700;
    font-size: 1rem;
}

.so-option-price {
    color: var(--so-primary);
    font-weight: 700;
    font-size: 0.9rem;
}

.so-customize-note {
    width: 100%;
    resize: vertical;
    font-family: inherit;
    border-radius: var(--so-radius-search);
    border: 1px solid var(--so-border);
    padding: var(--so-sp-1) var(--so-sp-2);
    background: var(--so-card);
    color: var(--so-text);
}

.so-customize-footer {
    display: flex;
    gap: var(--so-sp-2);
    padding: var(--so-sp-2) var(--so-sp-2) var(--so-sp-3);
    background: var(--so-card);
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.08);
}

.so-customize-footer .so-btn-outline {
    flex: 0 0 auto;
    width: auto;
    padding-inline: var(--so-sp-3);
}

.so-customize-footer .so-btn-primary {
    flex: 1;
}

/* ---------- "Item added" toast ---------- */
.so-toast {
    position: fixed;
    top: 90px;
    inset-inline: var(--so-sp-2);
    max-width: 420px;
    margin: 0 auto;
    background: var(--so-card);
    color: var(--so-text);
    border: 1px solid var(--so-border);
    border-inline-start: 4px solid var(--so-success);
    border-radius: var(--so-radius-card);
    box-shadow: var(--so-shadow-2);
    padding: var(--so-sp-2);
    display: flex;
    align-items: center;
    gap: var(--so-sp-1);
    font-size: 15px;
    font-weight: 600;
    z-index: 80;
    animation: so-toast-in var(--so-dur) var(--so-ease);
}

.so-toast-icon {
    font-size: 1.2rem;
}

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

/* ---------- Confirmation screen ---------- */
.so-confirm-icon {
    font-size: 4.5rem;
    margin-bottom: var(--so-sp-1);
}

.so-order-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--so-text);
    background: var(--so-card);
    border: 1px solid var(--so-border);
    border-radius: var(--so-radius-card);
    padding: var(--so-sp-2) var(--so-sp-4);
    box-shadow: var(--so-shadow-1);
    margin: var(--so-sp-2) 0 var(--so-sp-4);
}

/* ---------- Responsive tweaks ---------- */
@media (max-width: 640px) {
    .so-screen {
        padding: var(--so-sp-2) var(--so-sp-1) 130px;
    }

    .so-product-grid,
    .so-skeleton-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: var(--so-sp-2);
    }

    .so-choice-grid {
        grid-template-columns: 1fr;
    }

    .selfordering-header {
        grid-template-columns: auto 1fr auto;
        padding: 10px var(--so-sp-2);
    }

    .selfordering-brand {
        font-size: 22px;
    }

    .selfordering-welcome {
        display: none;
    }

    .selfordering-cart-chip-text {
        display: none;
    }
}

@media (min-width: 900px) {
    .so-product-grid,
    .so-skeleton-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (min-width: 1400px) {
    .so-category-sidebar {
        flex: 0 0 250px;
    }
}

/* Portrait kiosks (e.g. 1080x1920) are wide enough to skip the mobile breakpoint above but still
   need the sidebar collapsed to a horizontal strip so categories don't eat the vertical space. */
@media (orientation: portrait) and (min-width: 721px) {
    .so-browse-layout {
        flex-direction: column;
    }

    .so-category-sidebar {
        flex-direction: row;
        height: auto;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        flex: 0 0 auto;
        gap: var(--so-sp-1);
        padding-bottom: 6px;
    }

    .so-sidebar-btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-selfordering * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
