/* ═══════════════════════════════════════════
   AL-NAHL ORGANIC — Cart Side Popup CSS
   Self-contained with hardcoded fallbacks
═══════════════════════════════════════════ */

/* ── Local variable fallbacks (in case index.css not loaded) ── */
.cart-overlay,
.cart-drawer,
.cart-toast {
    --c-honey:       #C8862A;
    --c-honey-light: #E8A84A;
    --c-honey-dark:  #9A6018;
    --c-cream:       #FAF5EC;
    --c-warm-white:  #FDF9F3;
    --c-bark:        #2C1F0E;
    --c-text:        #3A2E1E;
    --c-text-light:  #7A6A52;
    --c-border:      rgba(200,134,42,0.18);
    --c-radius:      4px;
    --c-serif:       'Cormorant Garamond', Georgia, serif;
    --c-sans:        'DM Sans', sans-serif;
    --c-transition:  0.32s cubic-bezier(0.4,0,0.2,1);
}

/* ══════════════════════════════════════
   OVERLAY
══════════════════════════════════════ */
.cart-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(44, 31, 14, 0.55) !important;
    backdrop-filter: blur(3px);
    z-index: 9990 !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    margin: 0 !important;
    padding: 0 !important;
}
.cart-overlay.show {
    opacity: 1 !important;
    pointer-events: all !important;
}

/* ══════════════════════════════════════
   CART DRAWER  ← KEY FIX: right side
══════════════════════════════════════ */
.cart-drawer {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: 420px !important;
    max-width: 100vw !important;
    height: 100vh !important;
    background: #FDF9F3 !important;
    background-color: #FDF9F3 !important;
    z-index: 9999 !important;
    display: flex !important;
    flex-direction: column !important;
    transform: translateX(100%) !important;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: -8px 0 48px rgba(44,31,14,0.22) !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
}
.cart-drawer.open {
    transform: translateX(0) !important;
}

/* ══════════════════════════════════════
   DRAWER HEADER
══════════════════════════════════════ */
.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(200,134,42,0.18);
    background: #FDF9F3;
    flex-shrink: 0;
}

.cart-header-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.cart-header-left svg { color: #C8862A; }
.cart-header-left h3 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 400;
    color: #2C1F0E;
    margin: 0;
}

.cart-count-badge {
    background: #C8862A;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'DM Sans', sans-serif;
}

.cart-close-btn {
    width: 36px;
    height: 36px;
    background: #FAF5EC;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #7A6A52;
    transition: all 0.3s ease;
    flex-shrink: 0;
}
.cart-close-btn:hover {
    background: #C8862A;
    color: #fff;
}

/* ══════════════════════════════════════
   FREE SHIPPING BAR
══════════════════════════════════════ */
.cart-shipping-bar {
    padding: 0.8rem 1.5rem;
    background: #FAF5EC;
    border-bottom: 1px solid rgba(200,134,42,0.18);
    flex-shrink: 0;
}
.shipping-label {
    font-size: 0.76rem;
    color: #7A6A52;
    margin-bottom: 0.5rem;
    font-family: 'DM Sans', sans-serif;
}
.shipping-label strong { color: #9A6018; }
.shipping-track {
    height: 4px;
    background: rgba(200,134,42,0.18);
    border-radius: 2px;
    overflow: hidden;
}
.shipping-fill {
    height: 100%;
    background: linear-gradient(to right, #C8862A, #E8A84A);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* ══════════════════════════════════════
   CART ITEMS SCROLLABLE AREA
══════════════════════════════════════ */
.cart-items {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.2rem 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(200,134,42,0.2) transparent;
}
.cart-items::-webkit-scrollbar { width: 4px; }
.cart-items::-webkit-scrollbar-track { background: transparent; }
.cart-items::-webkit-scrollbar-thumb {
    background: rgba(200,134,42,0.3);
    border-radius: 2px;
}

/* Empty State */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1rem;
    gap: 0.8rem;
    min-height: 300px;
}
.cart-empty-icon { font-size: 3.5rem; line-height: 1; }
.cart-empty h4 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.3rem;
    color: #2C1F0E;
    margin: 0;
}
.cart-empty p {
    font-size: 0.85rem;
    color: #7A6A52;
    margin: 0;
    font-family: 'DM Sans', sans-serif;
}

/* Cart List */
.cart-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    padding: 0;
    margin: 0;
}

/* ══════════════════════════════════════
   CART ITEM ROW
══════════════════════════════════════ */
.cart-item {
    display: flex;
    gap: 1rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid rgba(200,134,42,0.15);
    animation: slideInItem 0.3s ease both;
}
.cart-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
@keyframes slideInItem {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}

.cart-item-img {
    width: 76px;
    height: 76px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #FAF5EC;
}
.cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}
.cart-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}
.cart-item-info h5 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.95rem;
    font-weight: 400;
    color: #2C1F0E;
    line-height: 1.2;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-size {
    font-size: 0.7rem;
    color: #7A6A52;
    font-family: 'DM Sans', sans-serif;
}
.cart-item-remove {
    width: 24px;
    height: 24px;
    background: none;
    border: 1px solid rgba(200,134,42,0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #7A6A52;
    flex-shrink: 0;
    transition: all 0.25s ease;
}
.cart-item-remove:hover {
    background: #feeaea;
    border-color: #f88;
    color: #c00;
}
.cart-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Qty control inside cart */
.cart-qty-control {
    display: flex;
    align-items: center;
    border: 1px solid rgba(200,134,42,0.25);
    border-radius: 4px;
    overflow: hidden;
    height: 30px;
}
.cart-qty-control button {
    width: 28px;
    height: 100%;
    background: #FAF5EC;
    border: none;
    font-size: 1rem;
    color: #3A2E1E;
    cursor: pointer;
    transition: background 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.cart-qty-control button:hover {
    background: #C8862A;
    color: #fff;
}
.cart-qty-control span {
    width: 32px;
    text-align: center;
    font-size: 0.82rem;
    color: #3A2E1E;
    border-left: 1px solid rgba(200,134,42,0.2);
    border-right: 1px solid rgba(200,134,42,0.2);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'DM Sans', sans-serif;
}
.cart-item-price {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1rem;
    color: #9A6018;
}

/* ══════════════════════════════════════
   DRAWER FOOTER
══════════════════════════════════════ */
.cart-drawer-footer {
    padding: 1.2rem 1.5rem;
    border-top: 1px solid rgba(200,134,42,0.18);
    background: #FDF9F3;
    flex-shrink: 0;
}
.cart-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.4rem;
}
.cart-subtotal span:first-child {
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #7A6A52;
    font-family: 'DM Sans', sans-serif;
}
.cart-subtotal span:last-child {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem;
    color: #2C1F0E;
}
.cart-tax-note {
    font-size: 0.7rem;
    color: #7A6A52;
    margin-bottom: 1rem;
    font-family: 'DM Sans', sans-serif;
}
.cart-continue {
    display: block;
    width: 100%;
    background: none;
    border: none;
    text-align: center;
    font-size: 0.76rem;
    color: #7A6A52;
    cursor: pointer;
    margin-top: 0.75rem;
    padding: 0.4rem;
    transition: color 0.25s ease;
    font-family: 'DM Sans', sans-serif;
    letter-spacing: 0.04em;
}
.cart-continue:hover { color: #C8862A; }

/* Checkout button inside footer */
.cart-drawer-footer .btn-primary,
.cart-drawer-footer a.btn {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    padding: 0.85em !important;
    background: #C8862A !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px !important;
    font-family: 'DM Sans', sans-serif !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.1em !important;
    text-transform: uppercase !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: background 0.3s ease !important;
}
.cart-drawer-footer .btn-primary:hover,
.cart-drawer-footer a.btn:hover {
    background: #9A6018 !important;
}

/* ══════════════════════════════════════
   CART BADGE ON HEADER ICON
══════════════════════════════════════ */
.cart-btn { position: relative; }
.cart-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #C8862A;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    font-family: 'DM Sans', sans-serif;
}

/* ══════════════════════════════════════
   CART TOAST
══════════════════════════════════════ */
.cart-toast {
    position: fixed !important;
    bottom: 2rem !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) translateY(120px) !important;
    background: #2C1F0E !important;
    color: #fff !important;
    padding: 0.85em 1.5em !important;
    border-radius: 30px !important;
    font-size: 0.85rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.6rem !important;
    box-shadow: 0 12px 48px rgba(44,31,14,0.25) !important;
    opacity: 0 !important;
    transition: all 0.4s cubic-bezier(0.4,0,0.2,1) !important;
    z-index: 99999 !important;
    white-space: nowrap !important;
    font-family: 'DM Sans', sans-serif !important;
    pointer-events: none !important;
}
.cart-toast svg { color: #6fcf7a; flex-shrink: 0; }
.cart-toast.show {
    opacity: 1 !important;
    transform: translateX(-50%) translateY(0) !important;
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 480px) {
    .cart-drawer {
        width: 100vw !important;
    }
    .cart-toast {
        left: 1rem !important;
        right: 1rem !important;
        transform: translateX(0) translateY(120px) !important;
        white-space: normal !important;
    }
    .cart-toast.show {
        transform: translateX(0) translateY(0) !important;
    }
}