/* ===== ORDER PAGE — MINIMAL DESIGN SYSTEM ===== */

/* ── Color tokens ── */
:root {
    --order-bg: #F8F4F0;
    --order-surface: #FFFFFF;
    --order-border: #E9DED5;
    --order-text: #1C1917;
    --order-muted: #78716C;
    --order-faint: #A8A29E;
    --order-primary: #C94A3A;
    --order-primary-h: #B03D2D;
    --order-chip-bg: #F0EDE9;
    --order-chip-text: #57534E;
}

/* ── Scrollbar hide ── */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ── Body lock ── */
.body-lock {
    overflow: hidden;
}

/* ═══════════════════════════════════════════
   CATEGORY CHIPS
═══════════════════════════════════════════ */
.chip {
    white-space: nowrap;
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1.5px solid var(--order-border);
    background: var(--order-surface);
    color: var(--order-chip-text);
    cursor: pointer;
    transition: all 0.18s ease;
    flex-shrink: 0;
}

.chip:hover {
    border-color: var(--order-primary);
    color: var(--order-primary);
    background: #FEF2F2;
}

.chip.active {
    background: var(--order-primary);
    color: white;
    border-color: var(--order-primary);
    box-shadow: 0 2px 8px rgba(201, 74, 58, 0.25);
}

/* ═══════════════════════════════════════════
   SKELETON
═══════════════════════════════════════════ */
.skeleton-card {
    border-radius: 1rem;
    overflow: hidden;
    background: linear-gradient(90deg, #EDE9E4 0%, #F5F3F0 50%, #EDE9E4 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.6s ease-in-out infinite;
    aspect-ratio: 3/4;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ═══════════════════════════════════════════
   PRODUCT CARD
═══════════════════════════════════════════ */
.product-card {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    background: var(--order-surface);
    border: 1px solid var(--order-border);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    cursor: pointer;
    min-width: 0;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.product-card img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    transition: transform 0.4s ease;
    display: block;
}

.product-card:hover img {
    transform: scale(1.04);
}

.product-card .card-body {
    padding: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.product-card .card-body h3 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 0.875rem;
    margin-bottom: 0.2rem;
    line-height: 1.3;
    color: var(--order-text);
}

.product-card .card-desc {
    font-size: 0.725rem;
    color: var(--order-muted);
    min-height: 2.4rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .card-price {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    color: var(--order-primary);
}

.product-card .card-original-price {
    font-size: 0.72rem;
    color: var(--order-faint);
    text-decoration: line-through;
}

.product-card .add-btn {
    background: var(--order-primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s, transform 0.12s;
}

.product-card .add-btn:hover {
    background: var(--order-primary-h);
    transform: scale(1.03);
}

.product-card .out-of-stock {
    background: #D6D3D1;
    color: #78716C;
    cursor: not-allowed;
}

.product-card .out-of-stock:hover {
    transform: none;
    background: #D6D3D1;
}

.product-card .badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    z-index: 2;
}

.badge-promo {
    background: var(--order-primary);
    color: white;
}

.badge-veg {
    background: #15803D;
    color: white;
}

.badge-popular {
    background: var(--order-text);
    color: white;
}

/* Unified Stock Badges */
.stock-badge {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stock-badge.out {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.stock-badge.low {
    background: #FFF7ED;
    color: #C2410C;
    border: 1px solid #FED7AA;
}

.stock-badge.in {
    background: #F0FDF4;
    color: #15803D;
    border: 1px solid #BBF7D0;
}

/* ═══════════════════════════════════════════
   CART DRAWER
═══════════════════════════════════════════ */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    height: 100dvh;
    background: var(--order-surface);
    z-index: 70;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -6px 0 40px rgba(0, 0, 0, 0.09);
    border-left: 1px solid var(--order-border);
}

.cart-drawer.open {
    transform: translateX(0);
}

.cart-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--order-border);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-img {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.625rem;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--order-chip-bg);
}

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

.cart-item-info h4 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--order-text);
}

.cart-item-mods {
    font-size: 0.6875rem;
    color: var(--order-muted);
    margin-top: 0.125rem;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.375rem;
}

.cart-item-qty button {
    width: 1.625rem;
    height: 1.625rem;
    border-radius: 0.375rem;
    background: var(--order-chip-bg);
    border: 1px solid var(--order-border);
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    color: var(--order-text);
}

.cart-item-qty button:hover {
    background: #E7E3DD;
}

.cart-item-qty span {
    font-weight: 700;
    font-size: 0.8125rem;
    min-width: 1.25rem;
    text-align: center;
    color: var(--order-text);
}

.cart-item-price {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--order-primary);
    white-space: nowrap;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--order-faint);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.75rem;
    transition: color 0.15s;
}

.cart-item-remove:hover {
    color: var(--order-primary);
}

/* ═══════════════════════════════════════════
   MODIFIER MODAL
═══════════════════════════════════════════ */
.modifier-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    background: var(--order-surface);
    z-index: 85;
    border-radius: 1.25rem 1.25rem 0 0;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.modifier-modal.open {
    transform: translateY(0);
}

@media (min-width:640px) {
    .modifier-modal {
        top: 50%;
        left: 50%;
        bottom: auto;
        right: auto;
        transform: translate(-50%, -50%) scale(0.96);
        opacity: 0;
        max-height: 80vh;
        width: 90%;
        max-width: 480px;
        border-radius: 1.25rem;
        transition: transform 0.28s ease, opacity 0.28s ease;
    }

    .modifier-modal.open {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.mod-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    border: 1.5px solid var(--order-border);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: var(--order-surface);
}

.mod-option:hover {
    border-color: #C4B5B0;
    background: #FAFAF9;
}

.mod-option.selected {
    border-color: var(--order-primary);
    background: #FEF7F6;
}

.mod-option-check {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.375rem;
    border: 2px solid var(--order-border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.mod-option.selected .mod-option-check {
    background: var(--order-primary);
    border-color: var(--order-primary);
    color: white;
}

/* ═══════════════════════════════════════════
   CHECKOUT MODAL
═══════════════════════════════════════════ */
.checkout-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 90vh;
    background: var(--order-surface);
    z-index: 85;
    border-radius: 1.25rem 1.25rem 0 0;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.checkout-modal.open {
    transform: translateY(0);
}

@media (min-width:640px) {
    .checkout-modal {
        top: 50%;
        left: 50%;
        bottom: auto;
        right: auto;
        transform: translate(-50%, -50%) scale(0.96);
        opacity: 0;
        max-height: 85vh;
        width: 90%;
        max-width: 520px;
        border-radius: 1.25rem;
        transition: transform 0.28s ease, opacity 0.28s ease;
    }

    .checkout-modal.open {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════
   SUCCESS MODAL
═══════════════════════════════════════════ */
.success-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    background: var(--order-surface);
    z-index: 95;
    border-radius: 1.5rem;
    width: 90%;
    max-width: 400px;
    transition: transform 0.35s ease, opacity 0.35s ease;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.18);
    border: 1px solid var(--order-border);
}

.success-modal.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* ═══════════════════════════════════════════
   SUBSCRIPTION INFO MODAL — MOBILE FIX
═══════════════════════════════════════════ */
#sub-info-content {
    max-height: 90dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 390px) {
    #sub-info-content .p-6 {
        padding: 1rem;
    }

    #sub-info-content .p-7 {
        padding: 1.25rem;
    }
}

/* ===== subtle polish ===== */
.product-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--order-border);
    border-radius: 1rem;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.product-card:hover {
    border-color: #DDCABE;
}

.product-card.is-disabled {
    pointer-events: none;
}

.product-card .image-wrap {
    position: relative;
    overflow: hidden;
    background: #f3ede7;
}

.product-card .stock-overlay {
    display: none;
}

.product-card.is-disabled img {
    opacity: 0.48;
    filter: grayscale(0.2);
}

.product-card.is-disabled .card-body {
    opacity: 0.92;
}

@media (max-width: 640px) {
    .stock-badge {
        top: 0.4rem;
        right: 0.4rem;
        font-size: 0.6rem;
        padding: 0.2rem 0.5rem;
    }
}

/* ═══════════════════════════════════════════
   FULL-SCREEN PRODUCT FLOW POLISH
═══════════════════════════════════════════ */
#modifier-modal {
    padding: 0;
}

#modifier-content {
    border-radius: 0;
}

@media (min-width: 768px) {
    #modifier-modal {
        padding: 1.25rem;
    }

    #modifier-content {
        min-height: min(88vh, 900px);
    }
}

#mod-step-container {
    scroll-behavior: smooth;
}

#mod-next-btn,
#mod-prev-btn {
    min-height: 3rem;
}

#success-order-status {
    letter-spacing: 0.01em;
}

/* ===== AK POLISH V10 ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 320px));
    justify-content: center;
    align-items: stretch;
    gap: 1.25rem;
}
.product-grid.hidden { display: none !important; }
@media (max-width: 640px) {
    .product-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}
.product-card .frozen-chip {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    width: fit-content;
    border-radius: 999px;
    background: #F0F7FF;
    color: #2563EB;
    font-size: .62rem;
    font-weight: 800;
    padding: .2rem .45rem;
    text-transform: uppercase;
    letter-spacing: .02em;
}

/* Product detail/modifier modal: use more screen width on large displays and reduce unnecessary scroll. */
@media (min-width: 1024px) {
    #modifier-content {
        width: min(94vw, 1360px) !important;
        min-height: min(90vh, 920px);
    }
}
@media (max-width: 640px) {
    header .max-w-7xl { gap: .75rem; }
    #cart-btn { padding-inline: .75rem; }
}

/* ===== FIRST MOBILE POLISH BATCH ===== */
.chip,
.product-card .add-btn,
.cart-item-remove,
#checkout-btn,
#pay-btn,
#mod-next-btn,
#mod-prev-btn {
    min-height: 44px;
}

.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.product-card .card-body {
    min-width: 0;
}

.product-card .card-body h3,
.product-card .card-desc,
.cart-item-info h4,
.cart-item-mods {
    overflow-wrap: anywhere;
}

.product-card .add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.15;
}

.cart-drawer,
#product-cart-drawer {
    max-width: min(100vw, 420px);
}

#cart-summary,
.checkout-modal > div:last-child,
#modifier-modal .flex-none.bg-white {
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
}

@media (max-width: 640px) {
    .product-grid {
        padding-inline: 0.125rem;
    }

    .product-card {
        border-radius: 1.1rem;
    }

    .product-card img {
        aspect-ratio: 5 / 3.6;
    }

    .product-card .card-body {
        padding: 1rem;
        gap: 0.5rem;
    }

    .product-card .card-body h3 {
        font-size: 0.98rem;
        line-height: 1.25;
    }

    .product-card .card-desc {
        font-size: 0.78rem;
        min-height: auto;
        line-height: 1.4;
    }

    .product-card .card-price {
        font-size: 1.1rem;
    }

    .product-card .add-btn {
        width: 100%;
        margin-top: 0.15rem;
        padding: 0.7rem 0.85rem;
        border-radius: 0.75rem;
    }

    .product-card .badge,
    .stock-badge {
        max-width: calc(100% - 1rem);
        white-space: normal;
        line-height: 1.15;
    }

    .cart-item {
        gap: 0.65rem;
    }

    .cart-item-qty button {
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 0.7rem;
    }

    .cart-item-remove {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding-inline: 0.6rem;
    }

    .mod-option {
        min-height: 48px;
    }

    #category-chips {
        padding-bottom: 0.35rem;
        scroll-padding-inline: 1rem;
    }
}

@media (max-width: 360px) {
    .cart-item-img {
        width: 3rem;
        height: 3rem;
    }

    .cart-item-price {
        font-size: 0.75rem;
    }
}
