/* ============================================================
   ABS Delivery Manager — Checkout & Cart Styles
   Matches theme: Poppins font, --bs-primary #CC1A20, --bs-denger #CE2E35
   ============================================================ */

/* ── Shared vars (mirror theme) ───────────────────────────── */
:root {
    --adm-primary: #CC1A20;
    --adm-denger: #CE2E35;
    --adm-green: #26955D;
    --adm-orange: #FFA500;
    --adm-gray: #F9F9F9;
    --adm-border: #EBEBEB;
    --adm-radius: 1.25rem;
    --adm-radius-sm: .625rem;
    --adm-font: "Poppins", sans-serif;
}

/* ============================================================
   HOORAY / ADD-TO-CART TOAST
   ============================================================ */
#abs-cart-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(90px);
    background: #1B1B1E;
    color: #fff;
    padding: 11px 22px 11px 16px;
    border-radius: 50px;
    font-family: var(--adm-font);
    font-size: .8125rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 9px;
    z-index: 99999;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .22);
    opacity: 0;
    transition: opacity .28s ease, transform .28s cubic-bezier(.34, 1.56, .64, 1);
    pointer-events: none;
    white-space: nowrap;
    max-width: 90vw;
}

#abs-cart-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.abs-toast-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.abs-toast-msg {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   FREE DELIVERY PROGRESS BAR  (cart page)
   ============================================================ */
.abs-delivery-bar {
    background: #FFF8F0;
    border: 1px solid #FFE0B2;
    border-radius: var(--adm-radius-sm);
    padding: 14px 18px;
    margin-bottom: 20px;
    font-family: var(--adm-font);
    font-size: .8125rem;
}

.abs-delivery-bar__msg {
    margin: 0 0 10px;
    color: #333;
    line-height: 1.5;
}

.abs-delivery-bar__msg--free {
    color: var(--adm-green);
}

.abs-delivery-bar__track {
    background: #EBEBEB;
    border-radius: 50px;
    height: 8px;
    overflow: hidden;
}

.abs-delivery-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, #ec9a06 0%, #ff0000 100%);
    border-radius: 50px;
    transition: width .5s cubic-bezier(.4, 0, .2, 1);
    min-width: 5px;
}

.abs-delivery-bar__labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: .75rem;
    color: #888;
}

/* ── Celebration animation when free delivery is unlocked ── */
.abs-delivery-bar.abs-bar-celebrate {
    animation: absBarCelebrate 0.6s ease;
    background: #E8F5E9;
    border-color: #A5D6A7;
}

.abs-delivery-bar.abs-bar-celebrate .abs-delivery-bar__fill {
    background: linear-gradient(90deg, #43A047 0%, #26955D 100%);
}

@keyframes absBarCelebrate {
    0%   { transform: scale(1); }
    15%  { transform: scale(1.02); }
    30%  { transform: scale(0.98); }
    50%  { transform: scale(1.015); }
    70%  { transform: scale(0.995); }
    100% { transform: scale(1); }
}

/* ============================================================
   CHECKOUT DELIVERY WRAPPER
   ============================================================ */
.abs-dm-delivery-wrapper {
    margin: 24px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-sm);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
    font-family: var(--adm-font);
}

.abs-dm-delivery-wrapper h3 {
    margin: 0 0 16px;
    font-size: .9375rem;
    font-weight: 700;
    color: #0D0D0E;
    letter-spacing: .01em;
}

/* ── Progress bar (checkout) ──────────────────────────────── */
.abs-dm-progress-wrap {
    background: #FFF8F0;
    border: 1px solid #FFE0B2;
    border-radius: var(--adm-radius-sm);
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: .8125rem;
}

.abs-dm-progress-msg {
    margin-bottom: 8px;
    color: #333;
    line-height: 1.4;
}

.abs-dm-progress-track {
    background: #EBEBEB;
    border-radius: 50px;
    height: 7px;
    overflow: hidden;
}

.abs-dm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--adm-orange) 0%, var(--adm-green) 100%);
    border-radius: 50px;
    transition: width .4s ease;
    min-width: 4px;
}

/* ── Delivery option cards ────────────────────────────────── */
.abs-dm-delivery-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.abs-dm-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--adm-gray);
    border: 1.5px solid var(--adm-border);
    border-radius: var(--adm-radius-sm);
    cursor: pointer;
    transition: border-color .2s, background .2s, box-shadow .2s;
    margin: 0;
}

.abs-dm-option:hover {
    border-color: #ccc;
    background: #f3f3f3;
}

/* selected state — JS adds .is-selected class */
.abs-dm-option.is-selected,
.abs-dm-option:has(input:checked) {
    border-color: var(--adm-denger);
    background: #FEF2F6;
    box-shadow: 0 0 0 3px rgba(206, 46, 53, .08);
}

.abs-dm-option input[type="radio"] {
    width: 17px;
    height: 17px;
    accent-color: var(--adm-denger);
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

.abs-dm-option__icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.abs-dm-option__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.abs-dm-option__title {
    font-size: .875rem;
    font-weight: 600;
    color: #0D0D0E;
}

.abs-dm-option__sub {
    font-size: .75rem;
    color: #555;
}

.abs-dm-option__price {
    font-size: .9375rem;
    font-weight: 700;
    color: #0D0D0E;
    white-space: nowrap;
}

.abs-dm-free {
    color: var(--adm-green);
    font-weight: 700;
}

/* "Enter PIN ↓" prompt shown before user checks their pincode */
.abs-dm-enter-pin {
    font-size: 0.6875rem;
    font-weight: 500;
    color: #888;
    white-space: nowrap;
}

/* ── Slot selector ────────────────────────────────────────── */
.abs-dm-slot-selector {
    margin: 0 0 10px;
    padding: 14px 16px;
    background: var(--adm-gray);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-sm);
}

.abs-dm-slot-dropdown {
    width: 100%;
    padding: .7rem 1rem;
    font-size: .9375rem;
    font-family: var(--adm-font);
    border: 1px solid var(--adm-border);
    border-radius: .625rem;
    background: #fff;
    cursor: pointer;
}

.abs-dm-slot-dropdown:focus {
    outline: none;
    border-color: var(--adm-denger);
    box-shadow: 0 0 0 2px rgba(206, 46, 53, .12);
}

.abs-dm-error .abs-dm-slot-dropdown,
.abs-dm-slot-selector.abs-dm-error {
    border-color: var(--adm-denger);
}

/* ── PIN code field ───────────────────────────────────────── */
.abs-dm-pincode-wrap {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.abs-dm-pincode-wrap label {
    font-size: .8125rem;
    font-weight: 600;
    color: #444;
    font-family: var(--adm-font);
}

.abs-dm-pincode-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.abs-dm-pincode-wrap input[type="text"] {
    width: 160px;
    padding: .6rem 1rem;
    font-size: .9375rem;
    font-family: var(--adm-font);
    border: 1px solid var(--adm-border);
    border-radius: .625rem;
    letter-spacing: 3px;
    transition: border-color .2s;
}

.abs-dm-pincode-wrap input[type="text"]:focus {
    outline: none;
    border-color: var(--adm-denger);
    box-shadow: 0 0 0 2px rgba(206, 46, 53, .12);
}

/* Check button — matches theme .btn-outline-denger */
.abs-dm-pin-check-btn {
    padding: .5rem 1.1rem;
    font-size: .8125rem;
    font-weight: 600;
    font-family: var(--adm-font);
    color: var(--adm-denger);
    background: transparent;
    border: 1.5px solid var(--adm-denger);
    border-radius: .5rem;
    cursor: pointer;
    transition: background .2s, color .2s;
    white-space: nowrap;
}

.abs-dm-pin-check-btn:hover {
    background: var(--adm-denger);
    color: #fff;
}

.abs-dm-pincode-note {
    font-size: .75rem;
    min-height: 16px;
    font-family: var(--adm-font);
}

.abs-dm-pincode-note.ok {
    color: var(--adm-green);
}

.abs-dm-pincode-note.err {
    color: var(--adm-denger);
}

.abs-dm-pincode-note.inf {
    color: #555;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
    .abs-dm-delivery-wrapper {
        padding: 14px;
    }

    .abs-dm-option {
        padding: 11px 12px;
    }

    .abs-dm-option__title {
        font-size: .8125rem;
    }

    .abs-dm-option__price {
        font-size: .875rem;
    }

    .abs-dm-pincode-wrap input[type="text"] {
        width: 100%;
    }

    .abs-dm-pincode-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .abs-dm-pin-check-btn {
        width: 100%;
        text-align: center;
    }
}

/* ============================================================
   CART PAGE — layout fixes
   ============================================================ */

/* Prevent the theme's section overflow:hidden from clipping cart content */
.woocommerce-cart section.section,
.woocommerce-cart .cart-wrap {
    overflow: visible !important;
}

/* Remove any unwanted full-height scroll lock on cart page */
.woocommerce-cart body,
.woocommerce-cart .site-content {
    overflow-x: hidden;
    overflow-y: auto;
}

/* Cart qty control button — make sure it's always visible & clickable */
.cart-qty-control .add_cart.quantity-set {
    display: inline-flex !important;
    pointer-events: auto !important;
}

.cart-qty-control .qty-wrap {
    background: #fff;
    border: 1px solid #EBEBEB;
    border-radius: 8px;
    padding: 4px 8px;
    gap: 4px;
}

.cart-qty-control .qty-btn {
    background: transparent;
    border: 0;
    font-size: 18px;
    font-weight: 600;
    padding: 0 8px;
    cursor: pointer;
    color: #CE2E35;
    line-height: 1;
    user-select: none;
}

.cart-qty-control .qty-btn:hover {
    color: #a01018;
}

.cart-qty-control .qty-number {
    font-size: .875rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    font-family: "Poppins", sans-serif;
}

/* ── Cart qty button loading state ───────────────────────── */
.cart-qty-control .qty-btn.is-loading {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}

/* Spinner inside qty-number while updating */
.cart-qty-control .qty-number.is-loading {
    position: relative;
    color: transparent;
    min-width: 28px;
}

.cart-qty-control .qty-number.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border: 2px solid #EBEBEB;
    border-top-color: #CE2E35;
    border-radius: 50%;
    animation: abs-cart-spin 0.6s linear infinite;
}

@keyframes abs-cart-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Full-card overlay while cart form submits */
.cart-item-updating {
    position: relative;
    pointer-events: none;
}

.cart-item-updating::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.65);
    border-radius: inherit;
    z-index: 10;
}

/* ============================================================
   DELIVERY METHOD CHANGE — full-page loader overlay
   ============================================================ */
#abs-dm-page-loader {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: all;
}

#abs-dm-page-loader.abs-dm-loader-visible {
    opacity: 1;
}

.abs-dm-loader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.abs-dm-loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #EBEBEB;
    border-top-color: #CE2E35;
    border-radius: 50%;
    animation: abs-dm-spin 0.7s linear infinite;
}

@keyframes abs-dm-spin {
    to {
        transform: rotate(360deg);
    }
}

.abs-dm-loader-msg {
    font-family: "Poppins", sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: #444;
    margin: 0;
}