/* ============================================
   SIPO API component styles — Baobab Café
   ============================================
   Everything here styles markup that the `api/`
   modules inject or render at runtime. Colours
   come from the tokens in css/style.css, so this
   file carries no palette of its own.
   ============================================ */

/* ---------- Status strip (statusManager.js) ---------- */
/* The strip is in the HTML from first paint with a FIXED height, and the nav is
   offset by the same CSS constant. Nothing is measured in JS and nothing moves
   when the live status text arrives. */
.status-strip {
    position: sticky;
    top: 0;
    z-index: 70;
    height: var(--strip-h);
    display: flex;
    align-items: center;
    background: var(--espresso);
    color: var(--cream);
    font-family: var(--body);
    font-weight: 700;
    font-size: .9rem;
    letter-spacing: .02em;
    padding: 0 16px;
    overflow: hidden;
    transition: background-color .4s;
}
.status-strip.open { background: var(--sage); color: #fff; }
.status-strip.closed { background: var(--choc); color: var(--cream); }
.status-strip.error { background: var(--espresso); }
.status-strip-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    min-width: 0;
}
.status-strip-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.status-strip-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    flex: none;
    background: currentColor;
}
.status-strip.open .status-strip-dot { animation: sipo-pulse 2s ease-in-out infinite; }
@keyframes sipo-pulse { 50% { box-shadow: 0 0 0 5px rgba(255, 255, 255, .25); } }
.countdown-timer { font-variant-numeric: tabular-nums; }

.nav { top: var(--strip-h); }
.menu-nav { top: calc(var(--strip-h) + var(--nav-h)); }
html { scroll-padding-top: calc(var(--strip-h) + var(--nav-h) + 20px); }
@media (max-width: 760px) { .status-strip { font-size: .82rem; } }

/* ---------- Status chip + today's hours ---------- */
[data-field="status"] {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    font-size: .95rem;
    padding: .45em 1.05em;
    border-radius: 999px;
    background: var(--paper);
    border: 1px solid var(--cream-2);
    color: var(--espresso);
    white-space: nowrap;
}
[data-field="status"] .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--muted);
    flex: none;
}
[data-field="status"].is-open .dot { background: #3E9B4F; box-shadow: 0 0 0 4px rgba(62, 155, 79, .2); }
[data-field="status"].is-closed .dot { background: var(--rust); }

/* ---------- Service pills ---------- */
[data-field="services"] {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}
.service-pill {
    font-weight: 700;
    font-size: .85rem;
    padding: .3em .95em;
    border-radius: 999px;
    background: var(--sage);
    color: #fff;
}

/* ---------- Address + alert ---------- */
.address-link { text-decoration: none; color: inherit; }
.address-link:hover { color: var(--rust); }

[data-field="alert"] {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    background: var(--paper);
    border: 2px dashed var(--rust);
    border-radius: 18px;
    padding: .9rem 1.2rem;
    font-weight: 600;
    color: var(--espresso);
}
.alert-mark { color: var(--rust); font-size: 1.1rem; line-height: 1.4; }

/* ---------- Opening hours ---------- */
[data-field="hours-list"] {
    list-style: none;
    margin: 0;
    padding: 0;
}
[data-field="hours-list"] li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .2rem 0;
    font-size: .95rem;
}
.hours-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1.2rem;
    border-bottom: 1px solid var(--cream-2);
    font-weight: 500;
}
.hours-row:last-child { border-bottom: 0; }
.hours-row .day, [data-field="hours-list"] li .day { white-space: nowrap; }
.hours-row .time, [data-field="hours-list"] li .time { text-align: right; color: var(--muted); }
.hours-row.today { background: var(--rust); color: #fff; font-weight: 700; border-radius: 12px; border-bottom-color: transparent; }
.hours-row.today .time { color: #fff; }
[data-field="hours-list"] li.today { color: var(--tan); font-weight: 700; }
[data-field="hours-list"] li.today .time { color: var(--tan); }
.hours-row.today .day::after, [data-field="hours-list"] li.today .day::after {
    content: " · today";
    font-weight: 600;
    font-size: .85em;
}
.closed-day { font-weight: 700; }
.next-day {
    display: inline-block;
    margin-left: .35rem;
    font-size: .75em;
    font-weight: 700;
    opacity: .8;
}

/* ---------- Loading / empty ---------- */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .7rem;
    padding: 2.5rem 0;
    font-weight: 600;
    color: var(--muted);
    grid-column: 1 / -1;
}
.spinner {
    width: 22px; height: 22px;
    border: 3px solid rgba(91, 28, 10, .18);
    border-top-color: var(--rust);
    border-radius: 50%;
    animation: sipo-spin .7s linear infinite;
}
@keyframes sipo-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.menu-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2.5rem 1rem;
    font-weight: 600;
}
.menu-empty a { color: var(--rust); }

/* ---------- Popular dish cards (home, uiManager.renderPopularItems) ---------- */
.dish-card {
    background: var(--paper);
    border: 1px solid var(--cream-2);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.dish-card:hover { transform: translateY(-4px); box-shadow: 0 24px 40px -28px rgba(42, 18, 10, .55); }
.dish-media {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--cream-2);
}
.dish-media img { width: 100%; height: 100%; object-fit: cover; }
/* No product photo in SIPO yet: a branded panel, never a stock photo of another dish */
.dish-media.is-empty {
    aspect-ratio: auto;
    height: 64px;
    background:
        radial-gradient(rgba(91, 28, 10, .14) 1.3px, transparent 1.5px) 0 0 / 16px 16px,
        var(--cream-2);
}
.dish-media.is-empty .dish-mark { display: none; }
.dish-mark { display: grid; place-items: center; height: 100%; color: var(--muted); }
.dish-mark svg { width: 34px; height: 34px; }
.dish-mark-text { font-size: .8rem; }
.dish-badge {
    position: absolute;
    left: 16px; bottom: -13px;
    background: var(--rust);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: .35em 1em;
    border-radius: 999px;
}
.dish-body {
    padding: 26px 20px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.dish-body h3 { font-family: var(--display); font-weight: 400; color: var(--choc); font-size: 1.45rem; line-height: 1.1; margin-bottom: .45rem; }
.dish-body p { font-size: .95rem; color: var(--muted); line-height: 1.5; margin-bottom: 1rem; }
.dish-foot {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
}
.dish-order {
    font-weight: 700;
    font-size: .88rem;
    text-decoration: none;
    color: var(--rust);
    border: 2px solid var(--rust);
    padding: .4em 1.1em;
    border-radius: 999px;
    transition: background .25s, color .25s;
}
.dish-order:hover { background: var(--rust); color: #fff; }

/* ---------- Prices (PriceTagManager output) ---------- */
.dish-prices { display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.size-price {
    display: inline-flex;
    align-items: baseline;
    gap: .35rem;
    font-family: var(--display);
    color: var(--rust);
    font-size: 1.1rem;
    white-space: nowrap;
}
.size-price em {
    font-family: var(--body);
    font-style: normal;
    font-weight: 600;
    font-size: .78rem;
    color: var(--muted);
}
.size-price.single { font-size: 1.35rem; }

/* ---------- Menu page: category chips + sections (app.js MenuPage) ---------- */
#api-menu-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}
#api-menu-tabs::-webkit-scrollbar { display: none; }
.cat-chip {
    flex: none;
    text-decoration: none;
    border: 2px solid var(--choc);
    color: var(--choc);
    font-weight: 700;
    font-size: .92rem;
    padding: .55em 1.25em;
    border-radius: 999px;
    transition: background .25s, color .25s;
}
.cat-chip:hover { background: rgba(91, 28, 10, .08); }
.cat-chip.active { background: var(--choc); color: var(--cream); }

.menu-section { padding: clamp(40px, 5vw, 70px) var(--pad); }
.menu-section:nth-of-type(even) { background: var(--paper); }
.menu-section > * { max-width: 1100px; margin-inline: auto; }
.menu-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 2px solid var(--choc);
    padding-bottom: .8rem;
    margin-bottom: .4rem;
}
.menu-section-head h2 { font-family: var(--display); font-weight: 400; color: var(--choc); font-size: clamp(2rem, 4vw, 3rem); }
.menu-section-count {
    font-weight: 700;
    font-size: .78rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--rust);
    white-space: nowrap;
}
.dish-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 clamp(36px, 5vw, 80px);
}
.dish-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 20px 0;
    border-bottom: 1px dashed rgba(91, 28, 10, .22);
}
.dish-thumb {
    width: 84px; height: 84px;
    flex: none;
    border-radius: 14px;
    overflow: hidden;
}
.dish-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dish-info { flex: 1; min-width: 0; }
.dish-info h3 {
    font-family: var(--body);
    font-weight: 700;
    font-size: 1.12rem;
    color: var(--espresso);
    line-height: 1.3;
}
.dish-info p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: .95rem;
    line-height: 1.5;
}
.dish-options { font-size: .85rem; }
.dish-row .dish-prices {
    flex-direction: column;
    align-items: flex-end;
    gap: .15rem;
    text-align: right;
}
.dish-row .size-price { justify-content: flex-end; }

@media (max-width: 760px) {
    .dish-list { grid-template-columns: 1fr; }
    .menu-section { padding-left: 20px; padding-right: 20px; }
    .dish-row { padding: 16px 0; }
    .dish-thumb { width: 64px; height: 64px; }
    .size-price.single { font-size: 1.2rem; }
}
