/* Shopping Cart Component - Modern, Isolated, API-Driven */

.ee-shopping-cart {
    position: relative;
}

/* Cart Button - Desktop (Fixed) */
.ee-shopping-cart__button {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

@media (max-width: 768px) {
    .ee-shopping-cart__button {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
    }
}

.ee-shopping-cart__button-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.5rem;
    color: #333;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-family: inherit;
}

.ee-shopping-cart__button-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.ee-shopping-cart__button-btn i {
    font-size: 1.1rem;
}

.ee-shopping-cart__button-label {
    font-size: 0.9rem;
}

.ee-shopping-cart__button-badge {
    background: var(--primary-color, #007bff);
    color: white;
    border-radius: 50%;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 1.5rem;
    text-align: center;
    display: none;
}

.ee-shopping-cart__button-badge.show {
    display: inline-block;
}

/* Mobile Sticky Cart Bar */
.ee-shopping-cart__sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    background: white;
    border-top: 2px solid #e9ecef;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    z-index: 1000;
    display: none;
    padding: 0.75rem 1rem;
    overflow-x: hidden;
}

/* Always hide on desktop */
@media (min-width: 769px) {
    .ee-shopping-cart__sticky-bar {
        display: none !important;
    }
}

.ee-shopping-cart__sticky-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    gap: 0.75rem;
    min-width: 0;
}

.ee-shopping-cart__sticky-bar-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.ee-shopping-cart__sticky-bar-label {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.ee-shopping-cart__sticky-bar-total {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color, #007bff);
}

.ee-shopping-cart__sticky-bar-button {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    background: var(--primary-color, #007bff);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.ee-shopping-cart__sticky-bar-button:hover {
    background: #0056b3;
}

/* Cart Offcanvas - Override Bootstrap defaults for light appearance */
#offcanvasRight {
    background-color: #ffffff !important;
    color: #333 !important;
}

/* Offcanvas full-width on mobile. 100% / 100vw can resolve to 466px (layout viewport
   including scrollbar); 100dvw = dynamic viewport = actual visible width (430px). */
@media (max-width: 768px) {
    #offcanvasRight.offcanvas.offcanvas-end,
    #offcanvasRight {
        --bs-offcanvas-width: 100vw;
        width: 100vw;
        max-width: 100vw;
        left: 0;
        right: 0;
        box-sizing: border-box;
    }
}
@supports (width: 100dvw) {
    @media (max-width: 768px) {
        #offcanvasRight.offcanvas.offcanvas-end,
        #offcanvasRight {
            --bs-offcanvas-width: 100dvw;
            width: 100dvw !important;
            max-width: 100dvw !important;
        }
    }
}
@media (max-width: 768px) {
    #offcanvasRight .offcanvas-header {
        padding: 1rem 1rem 1rem 1.5rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0.75rem !important;
        flex-shrink: 0 !important;
    }
    #offcanvasRight .offcanvas-header h5 {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    #offcanvasRight .offcanvas-header .btn-close {
        flex-shrink: 0 !important;
        margin: 0 !important;
    }
    #offcanvasRight .offcanvas-body {
        overflow-x: hidden;
    }
}

#offcanvasRight .offcanvas-header {
    background-color: #ffffff !important;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
}

#offcanvasRight .offcanvas-header h5 {
    color: #333 !important;
    font-weight: 600;
    margin: 0;
}

#offcanvasRight .offcanvas-header .btn-close {
    filter: none !important;
    opacity: 0.5;
}

#offcanvasRight .offcanvas-header .btn-close:hover {
    opacity: 1;
}

#offcanvasRight .offcanvas-body {
    background-color: #ffffff !important;
    color: #333 !important;
    padding: 1rem 1.5rem;
}

/* Cart Offcanvas */
.ee-shopping-cart__loading {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.ee-shopping-cart__empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.ee-shopping-cart__empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.ee-shopping-cart__items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ee-shopping-cart__item {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.ee-shopping-cart__item:last-child {
    border-bottom: none;
}

.ee-shopping-cart__item-info {
    flex: 1;
}

.ee-shopping-cart__item-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.ee-shopping-cart__item-details {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.ee-shopping-cart__item-description {
    font-size: 0.875rem;
    color: #495057;
    margin-bottom: 0.5rem;
}

.ee-shopping-cart__item-remove {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.ee-shopping-cart__item-remove:hover {
    background: #c82333;
}

.ee-shopping-cart__item-total {
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
}

.ee-shopping-cart__summary {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #e9ecef;
}

.ee-shopping-cart__summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.ee-shopping-cart__summary-total-label {
    color: #333;
}

.ee-shopping-cart__summary-total-amount {
    color: var(--primary-color, #007bff);
}

.ee-shopping-cart__checkout-button {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary-color, #007bff);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.ee-shopping-cart__checkout-button:hover:not(:disabled) {
    background: #0056b3;
}

.ee-shopping-cart__checkout-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Post-add message and suggested add-ons (when cart opened after add-to-cart) */
.ee-shopping-cart__post-add {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}
.ee-shopping-cart__post-add-message {
    font-size: 0.9rem;
    color: #495057;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}
.ee-shopping-cart__post-add-message p { margin: 0 0 0.5rem 0; }
.ee-shopping-cart__post-add-message p:last-child { margin-bottom: 0; }
.ee-shopping-cart__post-add-keep-shopping {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: #495057;
    line-height: 1.5;
}
.ee-shopping-cart__post-add-keep-shopping:last-child { margin-bottom: 0; }
.ee-shopping-cart__suggested-addons-title {
    margin: 0 0 0.5rem 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.ee-shopping-cart__suggested-addons-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.ee-shopping-cart__suggested-addon {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}
.ee-shopping-cart__suggested-addon-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.ee-shopping-cart__suggested-addon-info { min-width: 0; }
.ee-shopping-cart__suggested-addon-name { font-size: 0.875rem; font-weight: 500; color: #333; display: block; }
.ee-shopping-cart__suggested-addon-price { font-size: 0.8rem; color: #6c757d; }
.ee-shopping-cart__suggested-addon-message-row {
    padding-top: 0.15rem;
    border-top: 1px solid #e9ecef;
    margin-top: 0.15rem;
}
.ee-shopping-cart__suggested-addon-prompt { display: block; font-size: 0.8rem; color: #6c757d; font-style: italic; }
.ee-shopping-cart__suggested-addon-btn {
    flex-shrink: 0;
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #007bff;
    background: transparent;
    border: 1px solid #007bff;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.ee-shopping-cart__suggested-addon-btn:hover {
    background: #007bff;
    color: #fff;
}
/* Quantity-only suggested add-on: select + Add button */
.ee-shopping-cart__suggested-addon-qty-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.ee-shopping-cart__suggested-addon-qty {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    min-width: 3rem;
}
.ee-shopping-cart__continue-button {
    width: 100%;
    padding: 0.6rem;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: #495057;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.ee-shopping-cart__continue-button:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

.ee-shopping-cart__error {
    padding: 1rem;
    background: #f8d7da;
    color: #721c24;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .ee-shopping-cart__button-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* SweetAlert2 "Remove item?" confirmation – center correctly on mobile (avoid 100vw to prevent horizontal scroll) */
@media (max-width: 768px) {
    .swal2-container {
        position: fixed !important;
        inset: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px !important;
        box-sizing: border-box !important;
    }
    .swal2-popup {
        margin: 0 !important;
        flex-shrink: 0 !important;
        max-width: calc(100% - 20px) !important;
        position: relative !important;
    }
}
