/* =========================================
   6. E-COMMERCE ENHANCEMENTS
   ========================================= */

/* 6a. Sticky Add to Cart Bar */
.sticky-add-to-cart-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 2px solid var(--brand-red);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    padding: 15px 20px;
    z-index: 9997;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.sticky-add-to-cart-bar.visible {
    transform: translateY(0);
}

.sticky-cart-content {
    max-width: 1290px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.sticky-cart-product {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sticky-cart-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

.sticky-cart-info {
    display: flex;
    flex-direction: column;
}

.sticky-cart-name {
    font-weight: 600;
    color: var(--brand-dark);
    font-size: 0.95rem;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sticky-cart-price {
    color: var(--brand-red);
    font-weight: 700;
    font-size: 1.1rem;
}

.sticky-cart-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sticky-cart-actions .quantity {
    display: flex;
    align-items: center;
}

.sticky-cart-actions input.qty {
    width: 60px;
    text-align: center;
    padding: 8px;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
}

.sticky-cart-actions button.single_add_to_cart_button {
    background: var(--brand-red);
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.sticky-cart-actions button.single_add_to_cart_button:hover {
    background: #c53030;
}

@media (max-width: 768px) {
    .sticky-add-to-cart-bar {
        padding: 10px 15px;
    }

    .sticky-cart-content {
        flex-direction: column;
        gap: 10px;
    }

    .sticky-cart-product {
        width: 100%;
    }

    .sticky-cart-actions {
        width: 100%;
        justify-content: space-between;
    }

    .sticky-cart-name {
        max-width: 150px;
    }
}

/* 6b. Free Shipping Progress Bar */
.free-shipping-progress {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border: 2px dashed var(--brand-red);
    border-radius: 12px;
    padding: 20px 25px;
    margin: 20px 0;
    text-align: center;
}

.free-shipping-progress.cart-page {
    margin-bottom: 30px;
}

.free-shipping-progress.single-product {
    margin: 20px auto;
    max-width: 600px;
}

.free-shipping-message {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-dark);
    margin: 0 0 15px;
}

.free-shipping-message.free-shipping-unlocked {
    color: #38a169;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.free-shipping-bar {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin: 15px 0;
}

.free-shipping-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-red) 0%, #c53030 100%);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.free-shipping-bar.completed .free-shipping-progress-fill {
    background: linear-gradient(90deg, #48bb78 0%, #38a169 100%);
}

.free-shipping-subtitle {
    font-size: 0.9rem;
    color: #718096;
    margin: 0;
}

/* 6c. Modernized Cart Drawer */
.cart-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.cart-drawer-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    max-width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 100000;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 36px rgba(15, 23, 42, 0.18);
    font-family: 'Roboto Fallback', Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #0f172a;
}

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

/* Header */
.cart-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
    flex-shrink: 0;
    padding-top: calc(18px + env(safe-area-inset-top, 0px));
}

.cart-drawer-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-drawer-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-drawer-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.015em;
    line-height: 1.2;
}

.cart-drawer-count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 24px;
    height: 24px;
    border-radius: 9999px;
    padding: 0 7px;
    border: 1px solid #e2e8f0;
}

/* Close Button - Resetting any theme button styles */
button.cart-drawer-close,
.cart-drawer button.cart-drawer-close {
    all: unset;
    box-sizing: border-box;
    width: 36px;
    height: 36px;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    color: #475569 !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    box-shadow: none !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    flex-shrink: 0;
}

button.cart-drawer-close:hover,
button.cart-drawer-close:focus-visible,
.cart-drawer button.cart-drawer-close:hover,
.cart-drawer button.cart-drawer-close:focus-visible {
    background: #e2e8f0 !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
    transform: rotate(90deg);
}

button.cart-drawer-close svg,
.cart-drawer button.cart-drawer-close svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    display: block;
}

/* Perk Banner */
.cart-drawer-perk-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 22px;
    background: #fef2f2;
    border-bottom: 1px solid #fee2e2;
    color: #991b1b;
    font-size: 0.82rem;
    font-weight: 600;
    flex-shrink: 0;
}

.cart-drawer-perk-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-red, #dc2626);
    flex-shrink: 0;
}

.cart-drawer-perk-text {
    font-size: 0.82rem;
    line-height: 1.35;
}

.cart-drawer-content {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 22px;
}

.cart-drawer-items {
    display: flex;
    flex-direction: column;
}

/* Empty State */
.cart-drawer-empty-state {
    display: flex;
    flex-direction: column;
    padding: 4px 0 16px;
    gap: 16px;
}

/* Hero Section */
.cart-drawer-empty-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 18px;
    background: linear-gradient(180deg, #fafafa 0%, #f8fafc 100%);
    border: 1px solid #edf2f7;
    border-radius: 16px;
}

.cart-drawer-empty-icon-ring {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px dashed #fca5a5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-red, #dc2626);
    margin-bottom: 14px;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.08);
}

.cart-drawer-empty-title {
    font-size: 1.18rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px;
    letter-spacing: -0.015em;
}

.cart-drawer-empty-text {
    font-size: 0.84rem;
    color: #64748b;
    margin: 0 0 16px;
    max-width: 320px;
    line-height: 1.45;
}

/* Shortcut Pills */
.cart-drawer-empty-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 18px;
}

.cart-drawer-shortcut-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 13px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155 !important;
    text-decoration: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

.cart-drawer-shortcut-pill:hover {
    border-color: #dc2626;
    color: #dc2626 !important;
    background: #fef2f2;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.12);
}

/* Action Buttons */
.cart-drawer-empty-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 320px;
}

.cart-drawer-empty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    font-size: 0.88rem;
    padding: 11px 18px;
    border-radius: 10px;
    text-decoration: none !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    text-align: center;
}

.cart-drawer-empty-btn--primary {
    background: var(--brand-red, #dc2626);
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
    border: 1px solid transparent;
}

.cart-drawer-empty-btn--primary:hover {
    background: #b91c1c;
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.35);
    transform: translateY(-1px);
}

.cart-drawer-empty-btn--secondary {
    background: #ffffff;
    color: #334155 !important;
    font-weight: 600;
    border: 1px solid #cbd5e1;
}

.cart-drawer-empty-btn--secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a !important;
}

/* Support and Trust Info */
.cart-drawer-empty-support {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-drawer-empty-perks {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
}

.cart-drawer-empty-perk {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.cart-drawer-empty-perk-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.cart-drawer-empty-perk-content {
    display: flex;
    flex-direction: column;
    font-size: 0.78rem;
    line-height: 1.35;
}

.cart-drawer-empty-perk-content strong {
    color: #0f172a;
    font-weight: 700;
}

.cart-drawer-empty-perk-content span {
    color: #64748b;
}

/* Live Messenger Chat Card */
.cart-drawer-empty-chat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px solid #dbeafe;
    border-radius: 12px;
}

.cart-drawer-empty-chat-text {
    display: flex;
    flex-direction: column;
    font-size: 0.78rem;
    line-height: 1.35;
}

.cart-drawer-empty-chat-text strong {
    color: #1e3a8a;
    font-weight: 700;
}

.cart-drawer-empty-chat-text span {
    color: #64748b;
}

.cart-drawer-empty-chat-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #0084ff;
    color: #ffffff !important;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 8px 13px;
    border-radius: 8px;
    text-decoration: none !important;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 132, 255, 0.25);
    transition: all 0.2s ease;
}

.cart-drawer-empty-chat-btn:hover {
    background: #0073e6;
    box-shadow: 0 4px 12px rgba(0, 132, 255, 0.35);
    transform: translateY(-1px);
}

/* Item Card */
.cart-drawer-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    position: relative;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.cart-drawer-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.cart-drawer-item.is-updating {
    opacity: 0.4;
    pointer-events: none;
}

.cart-drawer-item-image-wrap {
    width: 76px;
    height: 76px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-drawer-item-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cart-drawer-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cart-drawer-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 3px;
}

.cart-drawer-item-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.35;
    margin: 0;
    text-decoration: none;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.15s ease;
}

a.cart-drawer-item-name:hover {
    color: var(--brand-red, #dc2626);
}

.cart-drawer-item-remove {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    margin: -4px -4px 0 0;
    transition: all 0.15s ease;
    touch-action: manipulation;
}

.cart-drawer-item-remove:hover,
.cart-drawer-item-remove:focus-visible {
    color: #ef4444;
    background: #fef2f2;
}

.cart-drawer-item-meta {
    font-size: 0.78rem;
    color: #64748b;
    margin: 2px 0 8px;
    line-height: 1.35;
}

.cart-drawer-item-meta p,
.cart-drawer-item-meta dl {
    margin: 0;
}

.cart-drawer-item-meta dt,
.cart-drawer-item-meta dd {
    display: inline;
    margin: 0;
}

.cart-drawer-item-meta dd + dt::before {
    content: " • ";
    color: #cbd5e1;
}

.cart-drawer-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
}

/* Quantity Controls */
.cart-drawer-item-qty-control {
    display: inline-flex;
    align-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    height: 34px;
    overflow: hidden;
}

.cart-drawer-item-qty-control .qty-btn {
    width: 32px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #334155;
    padding: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
    touch-action: manipulation;
}

.cart-drawer-item-qty-control .qty-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.cart-drawer-item-qty-control .qty-value {
    min-width: 30px;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
    user-select: none;
    padding: 0 4px;
}

.cart-drawer-item-price-wrap {
    text-align: right;
}

.cart-drawer-item-price {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--brand-red, #dc2626);
    margin: 0;
    white-space: nowrap;
}

/* Sticky Footer */
.cart-drawer-footer {
    padding: 20px 24px calc(20px + env(safe-area-inset-bottom, 0px)) 24px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
    flex-shrink: 0;
}

.cart-drawer-subtotal-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.cart-drawer-subtotal-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #475569;
}

.cart-drawer-subtotal-amount {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.cart-drawer-shipping-note {
    font-size: 0.78rem;
    color: #94a3b8;
    margin: 0 0 16px;
    line-height: 1.35;
}

.cart-drawer-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-drawer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    border-radius: 10px;
    text-decoration: none !important;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 700;
}

.cart-drawer-btn--checkout {
    background: var(--brand-red, #dc2626);
    color: #ffffff !important;
    font-size: 1rem;
    padding: 14px 20px;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.28);
    border: none;
}

.cart-drawer-btn--checkout:hover {
    background: #b91c1c;
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.38);
    transform: translateY(-1px);
}

.cart-drawer-btn--view-cart {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #334155 !important;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 10px 20px;
}

.cart-drawer-btn--view-cart:hover {
    background: #f1f5f9;
    color: #0f172a !important;
    border-color: #cbd5e1;
}

/* Trust Strip */
.cart-drawer-trust-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 14px;
    font-size: 0.74rem;
    color: #64748b;
}

.cart-drawer-trust-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Mobile Breakpoints */
@media (max-width: 480px) {
    .cart-drawer {
        width: 100%;
    }

    .cart-drawer-header {
        padding: 16px 20px;
        padding-top: calc(16px + env(safe-area-inset-top, 0px));
    }

    .cart-drawer-content {
        padding: 16px 20px;
    }

    .cart-drawer-footer {
        padding: 16px 20px calc(18px + env(safe-area-inset-bottom, 0px)) 20px;
    }

    .cart-drawer-perk-banner {
        padding: 8px 20px;
    }
}
