/**
 * Mamma Rosa foldout menu - frontend styles.
 *
 * Themed via the --po-* variables output by Pizza_Design_Frontend (set on :root).
 * Local fallbacks are provided on .po-menu so the layout still looks intentional
 * if a variable is missing. Structure follows the approved mockup-menukort.html.
 *
 * @since 2.13.0
 */

.po-menu {
    /* Fallbacks mirror the rustic defaults; real values come from :root --po-*. */
    --c-primary: var(--po-primary, #c5341f);
    --c-secondary: var(--po-secondary, #2f5d3a);
    --c-accent: var(--po-accent, #e0a528);
    --c-bg: var(--po-bg, #fbf3e4);
    --c-card: var(--po-card-bg, #fffdf8);
    --c-text: var(--po-text, #2b1d16);
    --c-muted: var(--po-text-muted, #6b5746);
    --c-line: var(--po-border, #e6d6ba);
    --c-button: var(--po-button, #c5341f);
    --c-button-text: var(--po-button-text, #ffffff);
    --c-price: var(--po-price, #a52817);
    --f-head: var(--po-font-heading, "Playfair Display", Georgia, serif);
    --f-body: var(--po-font-body, "Outfit", system-ui, sans-serif);
    --s-head: var(--po-size-heading, 28px);
    --s-name: var(--po-size-item-name, 17px);
    --s-desc: var(--po-size-description, 14px);
    --s-price: var(--po-size-price, 16px);
    --s-btn: var(--po-size-button, 15px);
    --radius: var(--po-card-radius, 18px);
    --pad: var(--po-card-padding, 16px);
    --speed: var(--po-anim-speed, 250ms);
    --menu-max: var(--po-menu-max, 1180px);
    --shadow: 0 18px 40px -18px rgba(43, 29, 22, .45);

    font-family: var(--f-body);
    color: var(--c-text);
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(255, 246, 230, .7) 0%, transparent 60%),
        radial-gradient(900px 500px at -10% 20%, rgba(252, 239, 224, .7) 0%, transparent 55%),
        var(--c-bg);
    -webkit-font-smoothing: antialiased;
    width: 100%;
    max-width: var(--menu-max);
    margin: 0 auto;
    padding-bottom: 60px;
}

/* ---------- HEADER ---------- */
.po-header {
    text-align: center;
    padding: 46px 22px 26px;
}

.po-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--c-secondary);
    font-weight: 600;
    border: 1px solid var(--c-line);
    background: var(--c-card);
    padding: 7px 16px;
    border-radius: 999px;
    margin-bottom: 18px;
}

.po-badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--c-primary);
}

.po-title {
    font-family: var(--f-head);
    font-weight: 800;
    font-size: clamp(40px, 7vw, 78px);
    line-height: .94;
    letter-spacing: -.02em;
    color: var(--c-primary);
    margin: 0;
}

.po-tag {
    margin: 14px auto 0;
    color: var(--c-muted);
    font-size: 17px;
    max-width: 540px;
}

/* ---------- CATEGORY NAV ---------- */
.po-cats {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--c-bg) 86%, transparent);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--c-line);
    border-bottom: 1px solid var(--c-line);
    margin-top: 14px;
}

.po-cats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 22px;
}

.po-cat-btn {
    white-space: nowrap;
    border: 1px solid var(--c-line);
    background: var(--c-card);
    color: var(--c-muted);
    font-family: var(--f-body);
    font-weight: 600;
    font-size: 14px;
    padding: 9px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--speed);
}

.po-cat-btn:hover {
    border-color: var(--c-primary);
    color: var(--c-primary);
}

.po-cat-btn.is-active {
    background: var(--c-secondary);
    border-color: var(--c-secondary);
    color: #fff;
}

/* ---------- SECTIONS ---------- */
.po-sections {
    padding: 24px 22px 0;
}

.po-sec-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 34px 0 18px;
}

.po-sec-icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
}

.po-sec-icon svg {
    width: 100%;
    height: 100%;
}

.po-sec-head h2 {
    font-family: var(--f-head);
    font-weight: 700;
    font-size: var(--s-head);
    color: var(--c-secondary);
    letter-spacing: -.01em;
    margin: 0;
}

.po-sec-line {
    flex: 1;
    height: 1px;
    background: repeating-linear-gradient(90deg, var(--c-line) 0 8px, transparent 8px 14px);
}

.po-sec-count {
    font-size: 13px;
    color: var(--c-muted);
    font-weight: 500;
    white-space: nowrap;
}

.po-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

@media (max-width: 760px) {
    .po-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- ITEM CARD (FOLDOUT) ---------- */
.po-item {
    background: var(--c-card);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--speed);
    box-shadow: 0 2px 0 rgba(43, 29, 22, .03);
}

.po-item.is-open {
    box-shadow: var(--shadow);
    border-color: color-mix(in srgb, var(--c-accent) 60%, var(--c-line));
}

.po-item-head {
    display: flex;
    gap: 16px;
    padding: var(--pad);
    align-items: center;
}

.po-item.has-opts .po-item-head {
    cursor: pointer;
}

.po-thumb {
    width: 84px;
    height: 84px;
    border-radius: 14px;
    flex: none;
    background: linear-gradient(135deg, #f7e7c8, #f1d9b0);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--c-line);
    overflow: hidden;
    padding: 10px;
}

.po-thumb svg {
    width: 100%;
    height: 100%;
}

.po-thumb-fallback {
    font-size: 34px;
}

.po-item-info {
    flex: 1;
    min-width: 0;
}

.po-num {
    font-size: 12px;
    color: var(--c-accent);
    font-weight: 700;
    letter-spacing: .08em;
}

.po-item-info h3 {
    font-family: var(--f-head);
    font-weight: 600;
    font-size: var(--s-name);
    line-height: 1.15;
    margin: 2px 0 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.po-badge-new {
    background: var(--c-accent);
    color: #2b1d16;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    padding: 2px 7px;
    border-radius: 999px;
    text-transform: uppercase;
    font-family: var(--f-body);
}

.po-item-info p {
    font-size: var(--s-desc);
    color: var(--c-muted);
    line-height: 1.45;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.po-item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex: none;
}

.po-price {
    font-family: var(--f-head);
    font-weight: 700;
    font-size: var(--s-price);
    color: var(--c-price);
    white-space: nowrap;
    text-align: right;
}

.po-from {
    font-size: 11px;
    color: var(--c-muted);
    font-weight: 500;
    font-family: var(--f-body);
    display: block;
    text-align: right;
}

.po-toggle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--c-line);
    background: var(--c-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--speed);
    color: var(--c-secondary);
}

.po-item.is-open .po-toggle {
    transform: rotate(45deg);
    background: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary);
}

.po-toggle svg {
    width: 16px;
    height: 16px;
}

.po-add-simple {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--c-line);
    background: var(--c-bg);
    color: var(--c-secondary);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--speed);
    flex: none;
}

.po-add-simple:hover {
    background: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary);
}

/* FOLDOUT BODY */
.po-fold {
    max-height: 0;
    overflow: hidden;
    transition: max-height .4s cubic-bezier(.4, 0, .2, 1);
}

.po-item.is-open .po-fold {
    max-height: 1600px;
}

.po-fold-inner {
    padding: 4px var(--pad) 18px;
    border-top: 1px dashed var(--c-line);
}

.po-opt-group {
    margin-top: 16px;
}

.po-opt-label {
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--c-secondary);
    font-weight: 700;
    margin-bottom: 10px;
}

/* SIZE PILLS */
.po-sizes {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.po-size {
    border: 1.5px solid var(--c-line);
    background: var(--c-bg);
    border-radius: 12px;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 96px;
    transition: var(--speed);
}

.po-size:hover {
    border-color: color-mix(in srgb, var(--c-accent) 60%, var(--c-line));
}

.po-size.is-sel {
    border-color: var(--c-primary);
    background: var(--c-card);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-primary) 12%, transparent);
}

.po-size-name {
    font-weight: 600;
    font-size: 14px;
}

.po-size-price {
    font-size: 13px;
    color: var(--c-price);
    font-weight: 700;
    font-family: var(--f-head);
}

/* TOPPINGS GRID */
.po-tops {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.po-top {
    border: 1.5px solid var(--c-line);
    background: var(--c-bg);
    border-radius: 14px;
    padding: 10px;
    cursor: pointer;
    text-align: center;
    transition: var(--speed);
    position: relative;
}

.po-top:hover {
    border-color: color-mix(in srgb, var(--c-accent) 60%, var(--c-line));
    transform: translateY(-2px);
}

.po-top.is-sel {
    border-color: var(--c-secondary);
    background: var(--c-card);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-secondary) 14%, transparent);
}

.po-top-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin: 0 auto 7px;
    background: linear-gradient(135deg, #f3e3c4, #ecd9b6);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--c-line);
    padding: 8px;
}

.po-top-img svg {
    width: 100%;
    height: 100%;
}

.po-top.is-sel .po-top-img {
    box-shadow: 0 0 0 2px var(--c-secondary) inset;
}

.po-top-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.1;
    display: block;
}

.po-top-price {
    font-size: 11.5px;
    color: var(--c-muted);
    margin-top: 2px;
    font-weight: 500;
    display: block;
}

.po-top-price.is-free {
    color: var(--c-secondary);
}

.po-top-check {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--c-secondary);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.po-top.is-sel .po-top-check {
    display: flex;
}

/* FOLDOUT FOOTER */
.po-fold-foot {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.po-qty {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--c-line);
    border-radius: 12px;
    overflow: hidden;
    background: var(--c-bg);
}

.po-qty button {
    width: 42px;
    height: 44px;
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--c-secondary);
    font-weight: 600;
}

.po-qty button:hover {
    background: var(--c-card);
}

.po-q-val {
    width: 42px;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
}

.po-add {
    flex: 1;
    min-width: 180px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: var(--c-button);
    color: var(--c-button-text);
    font-family: var(--f-body);
    font-weight: 700;
    font-size: var(--s-btn);
    padding: 14px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: var(--speed);
}

.po-add:hover {
    filter: brightness(.92);
}

.po-add.is-loading,
.po-add-simple.is-loading {
    opacity: .6;
    pointer-events: none;
}

.po-add.is-added {
    background: var(--c-secondary);
}

.po-live-total {
    font-family: var(--f-head);
    font-size: 18px;
}

/* ---------- BASKET ---------- */
.po-basket {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 50;
    background: var(--c-secondary);
    color: #fff;
    border: none;
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: var(--speed);
    font-family: var(--f-body);
    font-size: 15px;
}

.po-basket:hover {
    filter: brightness(1.08);
}

.po-basket-count {
    background: var(--c-accent);
    color: #2b1d16;
    font-weight: 700;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 13px;
}

.po-basket-total {
    font-family: var(--f-head);
    font-weight: 700;
    font-size: 18px;
}
