:root {
    --basket-primary: #0066CC;
    --basket-primary-light: #409CFF;
    --basket-primary-dark: #004C99;
    --basket-text-dark: #0A1E3C;
    --basket-text-light: #4A5C72;
    --basket-border-light: rgba(0, 102, 204, 0.1);
    --basket-shadow-lg: 0 20px 40px rgba(0, 102, 204, 0.12);
    --basket-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --basket-success: #10B981;
}

/* Cart Overlay - Fixed */
.cart-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    z-index: 1999;
    display: none;
}

.cart-backdrop.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.cart-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 450px;
    height: 100vh;                                /* fallback */
    height: calc(100vh / var(--doc-zoom, 1));     /* zoom-scale aware */
    height: calc(100dvh / var(--doc-zoom, 1));    /* zoom-scale aware + iOS address bar */
    background: white;
    box-shadow: var(--basket-shadow-lg);
    z-index: 2000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    font-family: 'Plus Jakarta Sans', sans-serif;
    overflow: hidden;
}

.cart-overlay.active {
    right: 0;
}

.cart-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--basket-border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.cart-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--basket-text-dark);
}

.cart-header h2 i {
    color: var(--basket-primary);
}

.close-cart {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--basket-transition);
}

.close-cart:hover {
    background: #F1F5F9;
}

.cart-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 16px;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #F8FAFC;
    border-radius: 14px;
    transition: var(--basket-transition);
    cursor: pointer;
}

.cart-item:hover {
    background: #F1F5F9;
}

/* ── Expanded item: tap/click to reveal full description ── */
.cart-item.expanded {
    background: #EEF2FF;
    align-items: flex-start;
}

.cart-item.expanded .cart-item-image {
    margin-top: 2px;
}

.cart-item.expanded .cart-item-title {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
}

.cart-item.expanded .cart-item-info > .cart-item-row:last-child {
    align-items: flex-start;
}

.cart-item.expanded .cart-item-desc {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.4;
}

.cart-item.expanded .remove-item {
    margin-top: 2px;
}

.cart-item-image {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #E8F0FE;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-image--split {
    width: 80px;
    background: #E8F0FE;
}

.cart-item-image--split img {
    object-fit: contain;
}

.cart-item-image i {
    font-size: 1.8rem;
    color: var(--basket-primary);
}

.cart-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Two-row layout: [title · price] / [desc · qty] */
.cart-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.cart-item-title {
    font-weight: 700;
    font-size: 0.83rem;
    color: var(--basket-text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.cart-item-price {
    color: var(--basket-primary);
    font-weight: 600;
    font-size: 0.83rem;
    white-space: nowrap;
    flex-shrink: 0;
    margin-bottom: 0;
}

.cart-item-details {
    font-size: 0.78rem;
    color: var(--basket-text-light);
    margin-bottom: 0;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
}

.remove-item {
    background: none;
    border: none;
    color: #DC2626;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
    transition: var(--basket-transition);
    font-size: 0.95rem;
    flex-shrink: 0;
    align-self: center;
}

.remove-item:hover {
    background: rgba(220, 38, 38, 0.1);
}

.cart-footer {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--basket-border-light);
    background: white;
    flex-shrink: 0;
}

.cart-totals {
    margin-bottom: 10px;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.88rem;
    color: var(--basket-text-dark);
}

.cart-total-row.total {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--basket-primary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 2px solid var(--basket-border-light);
}

.cart-actions {
    display: flex;
    gap: 12px;
}

.cart-actions .btn {
    flex: 1;
    padding: 10px 18px;
    border: none;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: var(--basket-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--basket-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--basket-primary-dark);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--basket-primary) !important;
    color: var(--basket-primary);
}

.btn-outline:hover {
    background: var(--basket-primary);
    color: white;
}

.cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--basket-text-light);
}

.cart-empty i {
    font-size: 3rem;
    color: #E2E8F0;
    margin-bottom: 20px;
}

.cart-empty h3 {
    margin-bottom: 12px;
    color: var(--basket-text-dark);
}

.cart-item-barcode {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--basket-text-light);
    letter-spacing: 0.02em;
}

.cart-item-desc {
    font-size: 0.75rem;
    color: var(--basket-text-light);
    margin-bottom: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.cart-qty-controls {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 4px;
}

.qty-btn {
    background: #F8FAFC;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--basket-text-dark);
    transition: var(--basket-transition);
}

.qty-btn:hover {
    background: var(--basket-primary);
    color: white;
}

.qty-value {
    min-width: 36px;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--basket-text-dark);
    border-left: 1px solid #E2E8F0;
    border-right: 1px solid #E2E8F0;
    line-height: 32px;
}

.qty-display {
    font-size: 0.78rem;
    color: var(--basket-text-light);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ===== Loading skeleton ===== */
@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.45; }
}

.cart-loading {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0;
}

.cart-skeleton-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #F8FAFC;
    border-radius: 14px;
    animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.cart-skeleton-item:nth-child(2) { animation-delay: 0.15s; }
.cart-skeleton-item:nth-child(3) { animation-delay: 0.30s; }

.cart-skeleton-img {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: #E2E8F0;
    flex-shrink: 0;
}

.cart-skeleton-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cart-skeleton-line {
    height: 10px;
    border-radius: 6px;
    background: #E2E8F0;
}

.cart-skeleton-line--short { width: 55%; }

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ===== Digital offer companion item (separate basket row) ===== */
.cart-item-digital-offer {
    background: #EFF6FF;
    border: 1px dashed rgba(0, 102, 204, 0.3);
}

.digital-free-badge {
    display: inline-block;
    background: #16a34a;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 20px;
    text-transform: uppercase;
}

.cart-item-image-dig {
    background: #DBEAFE;
}

.cart-item-image-dig i {
    font-size: 1.8rem;
    color: var(--basket-primary);
}

/* ===== Extras strip in flyout ===== */
.cart-extras-section {
    border-top: 1px solid var(--basket-border-light);
    border-bottom: 1px solid var(--basket-border-light);
    padding: 8px 14px;
    background: #F8FAFC;
    flex-shrink: 0;
}

.cart-extras-header {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--basket-text-dark);
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    user-select: none;
    padding: 2px 0;
}

.cart-extras-header i {
    color: #8B5CF6;
}

.cart-extras-toggle {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--basket-text-light);
    transition: transform 0.2s ease;
    display: inline-block;
}

.cart-extras-section.collapsed .cart-extras-toggle {
    transform: rotate(-90deg);
}

.cart-extras-section .cart-extras-scroll {
    margin-top: 8px;
    max-height: 210px;
    transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.2s ease;
    overflow-x: auto;
    overflow-y: visible;
    opacity: 1;
}

.cart-extras-section.collapsed .cart-extras-scroll {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-top: 0;
}

.cart-extras-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #C4B5FD transparent;
}

.cart-extras-scroll::-webkit-scrollbar {
    height: 3px;
}

.cart-extras-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.cart-extras-scroll::-webkit-scrollbar-thumb {
    background: #C4B5FD;
    border-radius: 3px;
}

.extras-flyout-card {
    flex: 0 0 120px;
    background: white;
    border-radius: 14px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease;
}

.extras-flyout-card:hover {
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.18);
}

.extras-flyout-img {
    width: 76px;
    height: 66px;
    object-fit: cover;
    border-radius: 10px;
    background: #EDE9FE;
}

.extras-flyout-info {
    width: 100%;
    text-align: center;
}

.extras-flyout-name {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--basket-text-dark);
    line-height: 1.3;
    margin-bottom: 2px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.extras-flyout-price {
    font-size: 0.75rem;
    font-weight: 700;
    color: #8B5CF6;
}

.extras-flyout-btn {
    width: 100%;
    padding: 5px 0;
    font-size: 0.7rem;
    font-weight: 700;
    background: #8B5CF6;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-top: auto;
}

.extras-flyout-btn:hover {
    background: #6D28D9;
}

/* ===== Remove item confirmation panel ===== */
.cart-remove-confirm {
    position: absolute;
    inset: 0;
    background: rgba(10, 30, 60, 0.45);
    backdrop-filter: blur(4px);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    border-radius: inherit;
}

.cart-remove-confirm.active {
    opacity: 1;
    pointer-events: all;
}

.cart-remove-confirm-inner {
    background: white;
    border-radius: 20px;
    padding: 32px 28px 24px;
    max-width: 280px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
    transform: translateY(12px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-remove-confirm.active .cart-remove-confirm-inner {
    transform: translateY(0);
}

.cart-remove-icon {
    font-size: 2.4rem;
    margin-bottom: 12px;
    line-height: 1;
}

.cart-remove-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--basket-text-dark);
    margin: 0 0 6px;
}

.cart-remove-sub {
    font-size: 0.85rem;
    color: var(--basket-text-light);
    margin: 0 0 24px;
    line-height: 1.5;
}

.cart-remove-actions {
    display: flex;
    gap: 10px;
}

.cart-remove-btn-cancel,
.cart-remove-btn-confirm {
    flex: 1;
    padding: 11px 0;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--basket-transition);
}

.cart-remove-btn-cancel {
    background: #F1F5F9;
    color: var(--basket-text-dark);
}

.cart-remove-btn-cancel:hover {
    background: #E2E8F0;
}

.cart-remove-btn-confirm {
    background: #DC2626;
    color: white;
}

.cart-remove-btn-confirm:hover {
    background: #B91C1C;
}

/* ===== Upsell group divider (between extras and canvas in one row) ===== */
.upsell-group-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0 6px;
}

.upsell-group-divider span {
    writing-mode: vertical-rl;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #D97706;
    background: #FEF3C7;
    border: 1px solid rgba(217,119,6,0.25);
    border-radius: 20px;
    padding: 6px 4px;
}

/* ===== Canvas cards in the upsell strip ===== */
.canvas-flyout-card:hover {
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.2);
}

.canvas-flyout-price {
    font-size: 0.75rem;
    font-weight: 700;
    color: #D97706;
}

.canvas-flyout-btn {
    background: #D97706 !important;
}

.canvas-flyout-btn:hover {
    background: #B45309 !important;
}

/* ===== Panel product group ===== */
/* Purple/violet palette — visually distinct from the blue used everywhere else */
:root {
    --panel-group:        #6D28D9;
    --panel-group-mid:    #7C3AED;
    --panel-group-light:  rgba(109, 40, 217, 0.08);
    --panel-group-border: rgba(109, 40, 217, 0.22);
}

/* Primary row — violet tinted card, strong left accent */
.cart-item-panel {
    background: #F5F3FF;
    border-left: 4px solid var(--panel-group);
    border-radius: 16px;
}

/* Child rows — increased indent, subordinate feel, matching violet */
.cart-item-panel-child {
    margin-left: 28px;
    margin-top: -4px;
    padding: 6px 10px;
    background: white;
    border: 1px solid var(--panel-group-border);
    border-left: 3px solid var(--panel-group-mid);
    border-radius: 0 12px 12px 0;
    gap: 8px;
}

/* Smaller thumbnail for child rows */
.cart-item-panel-child .cart-item-image {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
}

.cart-item-panel-child .cart-item-title {
    font-size: 0.78rem;
}

.cart-item-panel-child .cart-item-desc {
    font-size: 0.72rem;
    margin-bottom: 0;
}

/* Price line on the primary row */
.panel-price-display {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 0;
}

.panel-price-total {
    color: var(--panel-group);
    font-weight: 800;
    font-size: 0.85rem;
}

.panel-price-note {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--panel-group);
    background: var(--panel-group-light);
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

/* "Included" badge on child rows */
.panel-price-included {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--panel-group);
    background: var(--panel-group-light);
    padding: 2px 8px;
    border-radius: 20px;
    margin-bottom: 6px;
}

/* ===== Digital discount pricing ===== */
.digital-price-original {
    text-decoration: line-through;
    color: var(--basket-text-light);
    font-size: 0.85rem;
    margin-right: 6px;
}

.digital-price-discounted {
    color: var(--basket-success);
    font-weight: 700;
    font-size: 1rem;
}

.cart-digital-discount-row {
    color: var(--basket-success);
    font-weight: 600;
}

.digital-discount-amount {
    color: var(--basket-success);
    font-weight: 700;
}

/* Compact qty controls inside the extras flyout mini cards */
.extras-flyout-qty .qty-btn {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
}

.extras-flyout-qty .qty-value {
    min-width: 26px;
    font-size: 0.8rem;
    line-height: 24px;
}

/* Compact layout for short viewports (high desktop zoom or small phones) */
@media (max-height: 600px) {
    .cart-extras-section .cart-extras-scroll {
        max-height: 110px;
    }

    .cart-footer {
        padding: 8px 16px 10px;
    }

    .cart-totals {
        margin-bottom: 6px;
    }

    .cart-total-row {
        margin-bottom: 3px;
    }

    .cart-actions .btn {
        padding: 8px 12px;
        font-size: 0.82rem;
    }
}