/* =========================================================
   Product lightbox + modal
   ========================================================= */

/* ---------- lightbox ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .92);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    cursor: zoom-out;
}

.lightbox[hidden] {
    display: none;
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

/* ---------- product modal ---------- */
.product-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 250;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.product-modal-overlay[hidden] {
    display: none;
}

.product-modal {
    background: #fff;
    width: 100%;
    max-width: 520px;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.product-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    background: rgba(255, 255, 255, .85);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    color: #333;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    user-select: none;
    backdrop-filter: blur(4px);
}

@media (hover: hover) {
    .product-modal-close:hover {
        background: #fff;
    }
}

.product-modal-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #f4f4f4;
    overflow: hidden;
    flex-shrink: 0;
}

.product-modal-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.product-modal-body {
    padding: 14px 16px 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
}

.product-modal-body h3 {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    line-height: 1.25;
}

.product-modal-desc {
    font-size: 14px;
    color: #555;
    margin: 0;
    line-height: 1.45;
}

.product-modal-desc:empty {
    display: none;
}

.product-modal-attrs {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.product-modal-attrs li {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    background: #f2f4f8;
    color: #334;
}

.product-modal-attrs li.is-veg {
    background: #e6f7e6;
    color: #2a6a2a;
}

.product-modal-attrs li.is-spicy {
    background: #ffefef;
    color: #a22;
}

.product-modal-price {
    margin-top: 6px;
}

.pm-price-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: 2px;
}

.pm-price-value {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.1;
    word-break: keep-all;
}

.product-modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.product-modal-actions .btn {
    flex: 1;
}

.product-modal-note {
    font-size: 12px;
    color: #888;
    text-align: center;
    margin-top: 4px;
}