/* ============================================
   CART PAGE - LOCKED DESIGN SPECIFICATION
   Mobile-first, single column, speed-focused
   ============================================ */

/* Layout Container */
.cart-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 16px;
    padding-bottom: 100px;
    /* Space for sticky CTA on mobile + safe area */
}

/* Tablet: sticky CTA hidden, reduce padding */
@media (min-width: 768px) {
    .cart-container {
        padding-bottom: 24px;
        /* No sticky on desktop/tablet */
    }
}

/* Small phones: ensure proper padding */
@media (max-width: 360px) {
    .cart-container {
        padding: 0 12px;
        padding-bottom: 100px;
    }
}

/* Restaurant Header */
.cart-restaurant-header {
    padding: 16px 0;
    border-bottom: 1px solid #E5E5E5;
    margin-bottom: 12px;
}

.cart-restaurant-header a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #1A1A1A;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
}

.cart-restaurant-header a:hover {
    color: #F28500;
}

.cart-restaurant-header .back-icon {
    width: 20px;
    height: 20px;
    color: #666;
}

/* Cart Item Row */
.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #F0F0F0;
    position: relative;
    background: #fff;
    transition: transform 0.2s ease;
}

.cart-item.swiping {
    transition: none;
}

.cart-item.removing {
    transform: translateX(-100%);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Item Image */
.cart-item-image {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

/* Item Details */
.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: 16px;
    font-weight: 500;
    color: #1A1A1A;
    margin: 0 0 8px 0;
    word-break: break-word;
}

.cart-item-price {
    font-size: 16px;
    font-weight: 600;
    color: #1A1A1A;
}

/* Quantity Stepper */
.qty-stepper {
    display: flex;
    align-items: center;
    gap: 0;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: 1.5px solid #E5E5E5;
    background: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.1s ease;
    font-size: 18px;
    color: #1A1A1A;
    -webkit-tap-highlight-color: transparent;
}

.qty-btn:active {
    background: #F28500;
    border-color: #F28500;
    color: #fff;
}

.qty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.qty-display {
    width: 36px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #1A1A1A;
}

/* Desktop: larger controls */
@media (min-width: 768px) {
    .qty-btn {
        width: 44px;
        height: 44px;
    }

    .qty-display {
        width: 44px;
    }
}

/* Mobile: ensure proper touch target */
@media (max-width: 480px) {
    .qty-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    .qty-display {
        width: 32px;
        font-size: 15px;
    }
}

/* Delete Button */
.cart-item-delete {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    cursor: pointer;
    border: none;
    background: transparent;
    border-radius: 8px;
    transition: color 0.15s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
    margin-left: 8px;
}

.cart-item-delete:hover,
.cart-item-delete:active {
    color: #FF4444;
    background: #FFF0F0;
}

/* Mobile: Make delete more visible */
@media (max-width: 480px) {
    .cart-item-delete {
        color: #CC0000;
        background: #FFF5F5;
    }
}

/* Swipe Delete Background (Mobile) */
.swipe-delete-bg {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 80px;
    background: #FF4444;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

/* Remove Confirmation */
.remove-confirm {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background: #FFF5F5;
    border: 1px solid #FFD0D0;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
}

.remove-confirm.show {
    display: flex;
}

.remove-confirm span {
    font-size: 14px;
    color: #666;
}

.remove-confirm-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
}

.remove-confirm-btn.cancel {
    background: #E5E5E5;
    color: #333;
}

.remove-confirm-btn.confirm {
    background: #FF4444;
    color: #fff;
}

/* Item Status Badges */
.cart-item-badge {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
}

.cart-item-badge.closed {
    background: #FFE5E5;
    color: #CC0000;
}

.cart-item-badge.unavailable {
    background: #F5F5F5;
    color: #666;
}

.cart-item.disabled {
    opacity: 0.5;
}

/* Desktop CTA (inline) - Hidden on mobile, visible on tablet/desktop */
.cart-cta-inline {
    display: none;
    margin-top: 20px;
    padding-bottom: 24px;
}

@media (min-width: 768px) {
    .cart-cta-inline {
        display: block !important;
        visibility: visible !important;
    }
}

.cart-cta-btn {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 52px;
    min-height: 52px;
    padding: 16px;
    background: #F28500 !important;
    color: #fff !important;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none !important;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.cart-cta-btn:hover {
    background: #E07800 !important;
    color: #fff !important;
    text-decoration: none !important;
}

.cart-cta-btn:disabled,
.cart-cta-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Sticky CTA Bar (Mobile) - ALWAYS VISIBLE ON MOBILE */
.cart-sticky-cta {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: #fff !important;
    padding: 12px 16px !important;
    padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15) !important;
    z-index: 99999 !important;
    transform: none !important;
}

/* Tablet and Desktop: hide sticky, use inline CTA */
@media (min-width: 768px) {
    .cart-sticky-cta {
        display: none !important;
    }
}

/* Landscape phones: reduce height */
@media (max-height: 500px) and (orientation: landscape) {
    .cart-sticky-cta {
        padding: 8px 16px !important;
    }

    .cart-sticky-cta .cart-cta-btn {
        height: 44px !important;
    }
}

.cart-sticky-cta .cart-cta-btn {
    height: 52px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Empty Cart State */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    text-align: center;
    min-height: 50vh;
}

@media (max-width: 480px) {
    .cart-empty {
        padding: 32px 16px;
        min-height: 40vh;
    }
}

.cart-empty-icon {
    width: 48px;
    height: 48px;
    color: #CCC;
    margin-bottom: 16px;
}

.cart-empty-text {
    font-size: 16px;
    color: #666;
    margin-bottom: 12px;
}

.cart-empty-link {
    font-size: 14px;
    color: #F28500;
    text-decoration: none;
}

.cart-empty-link:hover {
    text-decoration: underline;
    color: #E07800;
}

/* Hide on empty cart */
.cart-has-items .cart-empty {
    display: none;
}

.cart-is-empty .cart-items-list,
.cart-is-empty .cart-cta-inline,
.cart-is-empty .cart-restaurant-header {
    display: none;
}

.cart-is-empty .cart-sticky-cta {
    display: none;
}

/* Guest Info Banner */
.guest-info-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    color: #166534;
}

.guest-info-banner svg {
    flex-shrink: 0;
    color: #22C55E;
}

/* Cart Savings Banner */
.cart-savings {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
    border: 1px solid #BBF7D0;
    border-radius: 10px;
    margin: 16px 0;
}

.cart-savings-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #22C55E;
    border-radius: 50%;
    color: #fff;
}

.cart-savings-text {
    flex: 1;
}

.cart-savings-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #166534;
}

.cart-savings-amount {
    display: block;
    font-size: 12px;
    color: #15803D;
    margin-top: 2px;
}

/* Cart Summary */
.cart-summary {
    margin-top: 16px;
    padding: 12px 0;
    border-top: 1px solid #E5E5E5;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
    color: #4B5563;
}

.cart-summary-row.discount {
    color: #16A34A;
}

.cart-summary-row.total {
    font-size: 16px;
    font-weight: 600;
    color: #1A1A1A;
    padding-top: 10px;
    margin-top: 6px;
    border-top: 1px solid #E5E5E5;
}
