/* ============================================================
   LAYOUT — Topbar, sidebar, app shell, responsive
   ============================================================ */

/* ── Topbar ── */
.site-topbar {
    position:sticky;
    top:0;
    z-index:60;
    border-bottom:1px solid var(--line-soft);
    background:color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter:blur(18px);
}
html[data-theme="dark"] .site-topbar { background:rgba(28,34,41,.88); }

.site-topbar-inner {
    max-width:var(--page-max);
    min-height:var(--topbar-height);
    margin:0 auto;
    padding:10px 18px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
}

.site-topbar-nav { display:flex; align-items:center; gap:4px; margin:0 auto 0 24px; }
.topbar-nav-link { display:flex; align-items:center; gap:7px; padding:7px 14px; border-radius:8px; font-size:14px; font-weight:600; color:var(--text); text-decoration:none; transition:background .15s; }
.topbar-nav-link:hover { background:var(--line-soft); }
.live-indicator { width:8px; height:8px; border-radius:50%; background:#ef4444; flex-shrink:0; animation:livepulse 2s ease-in-out infinite; }
@keyframes livepulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.4;transform:scale(.75)} }
@media(max-width:640px){ .site-topbar-nav { display:none; } }

.site-brand { display:flex; align-items:center; gap:14px; min-width:0; }
.site-brand-mark { width:42px; height:42px; flex:0 0 42px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:20px; font-weight:900; letter-spacing:0; color:#111827; background:var(--accent-warm); box-shadow:0 8px 18px rgba(245,212,66,.22); }
.site-brand-copy strong { display:block; font-size:24px; line-height:1.05; }
.site-brand-copy span { display:block; margin-top:4px; color:var(--muted); font-size:14px; }

.site-topbar-actions { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }

/* ── App Shell ── */
.page-shell { max-width:var(--page-max); margin:0 auto; padding:18px; }
.page-shell.page-shell--full { max-width:none; width:100%; }

.app-shell { display:grid; grid-template-columns:var(--sidebar-width) minmax(0, 1fr); align-items:start; gap:18px; }
.app-shell.app-shell--full { grid-template-columns:minmax(0, 1fr); }

/* ── Sidebar ── */
.sidebar { position:sticky; top:calc(var(--topbar-height) + 18px); display:flex; flex-direction:column; gap:12px; align-self:start; }
.sidebar-drawer { display:flex; flex-direction:column; gap:12px; }
.sidebar-drawer-head,
.mobile-menu-toggle,
.mobile-menu-backdrop { display:none; }
.mobile-menu-close {
    width:40px;
    height:40px;
    border-radius:8px;
    border:1px solid var(--line);
    background:var(--surface-2);
    color:var(--text);
    font-size:24px;
    line-height:1;
    cursor:pointer;
}

.sidebar-panel, .content-panel, .card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-xl); box-shadow:var(--shadow); }
.sidebar-panel { padding:16px; }

.sidebar-brand { display:flex; align-items:center; gap:12px; margin-bottom:12px; padding:10px; border-radius:8px; background:var(--surface-2); border:1px solid var(--line); }
.sidebar-brand-mark { width:58px; height:58px; border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:24px; font-weight:900; color:#111827; background:var(--accent-warm); flex:0 0 58px; }
.sidebar-brand-copy strong { display:block; font-size:18px; line-height:1.1; margin-bottom:4px; }
.sidebar-brand-copy span { display:block; color:var(--muted); font-size:13px; line-height:1.35; }

.menu-sections { display:flex; flex-direction:column; gap:6px; }
.menu-section { padding-top:6px; }
.menu-section-title {
    margin:0 0 8px;
    padding:0 8px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    color:var(--muted);
    font-size:11px;
    font-weight:800;
    letter-spacing:.18em;
    text-transform:uppercase;
    list-style:none;
    cursor:default;
}
.menu-section-title::-webkit-details-marker { display:none; }
.menu-section-chevron { display:none; letter-spacing:0; }
.menu-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px; }

.menu-link { display:grid; grid-template-columns:38px 1fr; align-items:center; gap:11px; padding:9px 10px; border-radius:8px; border:1px solid transparent; color:var(--text); transition:.16s ease; }
.menu-link:hover { background:var(--accent-soft); border-color:var(--line); }
.menu-link.is-active { background:var(--accent-soft); border-color:color-mix(in srgb, var(--accent) 28%, var(--line)); color:var(--accent); }

.menu-icon { width:38px; height:38px; border-radius:9px; display:flex; align-items:center; justify-content:center; background:var(--surface-2); border:1px solid var(--line); color:var(--muted); transition:color .14s, background .14s, border-color .14s; }
.menu-icon .sc-ico { width:19px; height:19px; }
.menu-link:hover .menu-icon { color:var(--text); }
.menu-link.is-active .menu-icon { color:var(--accent); background:var(--accent-soft); border-color:color-mix(in srgb, var(--accent) 30%, var(--line)); }
html[data-theme="dark"] .menu-icon { background:#151a20; }
.menu-copy { min-width:0; display:flex; flex-direction:column; gap:2px; }
.menu-copy strong { font-size:16px; line-height:1.2; }
.menu-copy span { color:var(--muted); font-size:12px; line-height:1.3; }

.sidebar-bottom { display:flex; flex-direction:column; gap:10px; margin-top:6px; }
.sidebar-meta { padding:0 6px; color:var(--muted); font-size:12px; line-height:1.45; }

/* ── Content panel ── */
.content-panel { padding:18px; min-width:0; }
.content-panel.content-panel--bare { padding:0; background:transparent; border:0; box-shadow:none; }

/* ── Hero bar ── */
.hero-bar { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:18px; padding:18px 20px; border-radius:8px; border:1px solid var(--line); background:var(--surface); }
.hero-bar h1 { margin:0 0 8px; font-size:34px; line-height:1.08; }
.hero-bar p { margin:0; color:var(--muted); }

/* ── Footer ── */
.app-footer { max-width:var(--page-max); margin:0 auto; padding:0 18px 14px; color:var(--muted); font-size:12px; }
.app-footer-top {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:14px 22px;
    margin-bottom:8px;
    padding-bottom:8px;
    border-bottom:1px solid var(--line-soft);
}
.app-footer-links {
    display:flex;
    flex-wrap:wrap;
    gap:4px 16px;
    min-width:0;
}
.app-footer-links a {
    color:var(--muted);
    text-decoration:none;
    font-size:12px;
    font-weight:600;
    transition:color .15s;
}
.app-footer-links a:hover { color:var(--accent); }
.payment-methods {
    display:flex;
    flex:0 1 420px;
    flex-wrap:wrap;
    justify-content:flex-end;
    gap:5px;
}
.payment-method {
    min-height:20px;
    padding:3px 7px 2px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:1px solid color-mix(in srgb, var(--line) 88%, #cbd5e1);
    border-radius:4px;
    background:#fff;
    color:#111827;
    font-size:10px;
    font-weight:900;
    line-height:1;
    letter-spacing:0;
    white-space:nowrap;
    box-shadow:0 1px 2px rgba(15,23,42,.04);
}
.payment-method--ideal { color:#0f172a; }
.payment-method--wero { color:#3b2cc9; }
.payment-method--klarna { background:#ffb3c7; border-color:#ff9ab5; color:#111827; }
.payment-method--visa { color:#173b89; }
.payment-method--mastercard { color:#d97706; }
.payment-method--creditcard { color:#475569; }
.payment-method--apple-pay { background:#111827; border-color:#111827; color:#fff; }
.payment-method--google-pay { color:#1a73e8; }
.payment-method--bancontact { color:#0056a4; }
.payment-method--kbc-cbc { color:#0057b8; }
.payment-method--belfius { color:#dc2626; }
html[data-theme="dark"] .payment-method {
    border-color:rgba(255,255,255,.18);
    box-shadow:none;
}

/* Seller order notification toast is rendered from the global layout. */
.seller-order-toast {
    position:fixed;
    top:calc(var(--topbar-height) + 16px);
    right:20px;
    z-index:400;
    max-width:320px;
    padding:14px 18px;
    display:flex;
    align-items:flex-start;
    gap:12px;
    background:var(--surface);
    border:1px solid var(--line);
    border-left:4px solid var(--accent);
    border-radius:8px;
    box-shadow:0 12px 36px rgba(17,24,39,.18);
    transform:translateX(calc(100% + 32px));
    transition:transform .3s cubic-bezier(.16,1,.3,1);
    pointer-events:none;
}
.seller-order-toast.is-visible { transform:translateX(0); pointer-events:auto; }
.seller-order-toast-icon { font-size:24px; flex:0 0 auto; line-height:1.1; }
.seller-order-toast-body { flex:1 1 auto; min-width:0; }
.seller-order-toast-title { margin-bottom:4px; font-size:14px; font-weight:800; }
.seller-order-toast-sub { color:var(--muted); font-size:12px; line-height:1.4; }
.seller-order-toast-link { display:inline-block; margin-top:8px; color:var(--accent); font-size:12px; font-weight:700; text-decoration:none; }
.seller-order-toast-close {
    padding:0;
    border:0;
    background:transparent;
    color:var(--muted);
    font-size:18px;
    line-height:1;
    cursor:pointer;
    flex:0 0 auto;
}
.seller-order-toast-close:hover { color:var(--text); }

/* ── Responsive ── */
@media (max-width: 1120px) {
    .app-shell { grid-template-columns:1fr; }
    .sidebar { position:static; display:block; }
    .mobile-menu-toggle {
        width:100%;
        min-height:54px;
        padding:10px 12px;
        display:flex;
        align-items:center;
        gap:12px;
        border:1px solid var(--line);
        border-radius:8px;
        background:var(--surface);
        color:var(--text);
        box-shadow:var(--shadow);
        cursor:pointer;
        text-align:left;
        -webkit-tap-highlight-color:transparent;
    }
    .mobile-menu-toggle-icon {
        width:38px;
        height:38px;
        border-radius:8px;
        display:flex;
        align-items:center;
        justify-content:center;
        background:var(--accent-soft);
        color:var(--accent);
        font-size:23px;
        font-weight:900;
        line-height:1;
        flex:0 0 38px;
    }
    .mobile-menu-toggle-copy {
        min-width:0;
        display:flex;
        flex-direction:column;
        gap:2px;
    }
    .mobile-menu-toggle-copy strong { font-size:16px; line-height:1.2; }
    .mobile-menu-toggle-copy span { color:var(--muted); font-size:12px; line-height:1.25; }
    .mobile-menu-backdrop {
        position:fixed;
        inset:0;
        z-index:110;
        display:block;
        background:rgba(15,23,42,.42);
        opacity:0;
        pointer-events:none;
        transition:opacity .18s ease;
    }
    .sidebar.is-open .mobile-menu-backdrop {
        opacity:1;
        pointer-events:auto;
    }
    .sidebar-drawer {
        position:fixed;
        top:0;
        bottom:0;
        left:0;
        z-index:120;
        width:min(390px, calc(100vw - 32px));
        max-width:100%;
        height:100vh;
        height:100dvh;
        padding:12px;
        background:var(--surface);
        border-right:1px solid var(--line);
        box-shadow:24px 0 60px rgba(15,23,42,.24);
        transform:translateX(-105%);
        transition:transform .2s ease;
        overflow:hidden;
    }
    .sidebar.is-open .sidebar-drawer { transform:translateX(0); }
    body.mobile-menu-open { overflow:hidden; }
    .sidebar-drawer-head {
        display:flex;
        align-items:center;
        justify-content:space-between;
        gap:12px;
        padding:4px 4px 2px;
        flex:0 0 auto;
    }
    .sidebar-drawer-head strong { display:block; font-size:18px; line-height:1.15; }
    .sidebar-drawer-head span { display:block; margin-top:3px; color:var(--muted); font-size:12px; }
    .sidebar-menu-panel {
        flex:1 1 auto;
        min-height:0;
        overflow:auto;
        padding:12px;
    }
    .sidebar-bottom {
        flex:0 0 auto;
        margin-top:0;
    }
    .menu-sections { gap:0; }
    .menu-section {
        padding:0;
        border-bottom:1px solid var(--line-soft);
    }
    .menu-section:last-child { border-bottom:0; }
    .menu-section-title {
        margin:0;
        padding:12px 8px;
        cursor:pointer;
    }
    .menu-section-title:hover { color:var(--accent); }
    .menu-section-chevron {
        display:inline-flex;
        align-items:center;
        justify-content:center;
        color:var(--muted);
        font-size:20px;
        transform:rotate(0deg);
        transition:transform .16s ease;
    }
    .menu-section[open] > .menu-section-title .menu-section-chevron { transform:rotate(90deg); }
    .menu-section:not([open]) > .menu-list { display:none; }
    .menu-list { padding:0 0 10px; }
}
@media (max-width: 768px) {
    .site-topbar-inner, .page-shell, .app-footer { padding-left:14px; padding-right:14px; }
    .site-topbar-inner { min-height:auto; flex-direction:column; align-items:stretch; }
    .site-topbar-actions { justify-content:space-between; gap:10px; }
    .hero-bar { flex-direction:column; }
    .hero-bar h1 { font-size:28px; }
    .card, .content-panel, .sidebar-panel { padding:16px; border-radius:8px; }
    .sidebar-brand { padding:10px; }
    .sidebar-brand-mark { width:56px; height:56px; border-radius:8px; }
    .menu-copy strong { font-size:15px; }
    .profile-copy { display:none; }
    .app-footer-top {
        flex-direction:column;
        align-items:stretch;
    }
    .payment-methods {
        flex-basis:auto;
        justify-content:flex-start;
    }
}

/* 0.17.0 phase 5 - mobile usability polish */
@media (max-width: 640px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    .page-shell {
        padding-top: 12px;
        padding-bottom: 18px;
    }

    .app-shell {
        gap: 12px;
    }

    .hero-bar {
        gap: 12px;
        padding: 16px;
    }

    .hero-bar .nav-links,
    .page-actions,
    .site-topbar-actions {
        width: 100%;
    }

    .hero-bar .nav-links .btn,
    .page-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
        min-height: 44px;
    }

    .content-panel,
    .sidebar-panel,
    .card {
        padding: 14px;
    }

    .app-footer {
        padding-bottom: 10px;
    }

    .seller-order-toast {
        top:12px;
        right:12px;
        left:12px;
        max-width:none;
    }
}

@media (max-width: 420px) {
    .menu-link {
        grid-template-columns: 34px minmax(0, 1fr);
        padding: 8px;
    }

    .menu-icon {
        width: 34px;
        height: 34px;
    }
}

/* ── Skip-to-content (accessibility) ─────────────────────────────────────── */
.skip-to-content {
    position: fixed;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: var(--accent);
    color: #fff;
    padding: 10px 24px;
    border-radius: 0 0 10px 10px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    transition: top .2s;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(16,185,129,.35);
}
.skip-to-content:focus { top: 0; }

/* ── Mobile bottom navigation ────────────────────────────────────────────── */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 860px) {
    /* Show the nav */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 55;
        background: var(--surface);
        border-top: 1px solid var(--line-soft);
        box-shadow: 0 -4px 20px rgba(17, 24, 39, .10);
        /* iOS safe-area: respect home indicator */
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    /* Push page content up so bottom nav doesn't obscure it */
    body {
        padding-bottom: 64px;
    }
    .app-footer {
        padding-bottom: calc(64px + 10px);
    }

    /* Each tab item */
    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 8px 4px;
        min-height: 52px;
        color: var(--muted);
        text-decoration: none;
        font-size: 11px;
        font-weight: 600;
        line-height: 1.2;
        transition: color .14s;
        -webkit-tap-highlight-color: transparent;
    }
    .mobile-nav-item:hover,
    .mobile-nav-item.is-active {
        color: var(--accent);
    }
    .mobile-nav-icon {
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .mobile-nav-icon .sc-ico {
        width: 22px;
        height: 22px;
    }
    .mobile-nav-item--cta {
        color: var(--accent);
    }

    /* Active indicator dot */
    .mobile-nav-item.is-active .mobile-nav-icon {
        position: relative;
    }
    .mobile-nav-item.is-active .mobile-nav-icon::after {
        content: '';
        position: absolute;
        bottom: -3px;
        left: 50%;
        transform: translateX(-50%);
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background: var(--accent);
    }
}
