/* ==============================================
   Asaba Seafood — Cart Drawer + App Checkout
   Mobile-first. Uses theme CSS vars.
   ============================================== */

/* ── Shared variables (fallbacks if theme vars absent) ── */
:root {
    --adr-bg:        #111827;
    --adr-card:      #1f2937;
    --adr-border:    rgba(255,255,255,.10);
    --adr-orange:    var(--orange,  #FF6240);
    --adr-teal:      var(--teal,    #0d9488);
    --adr-white:     var(--white,   #f9fafb);
    --adr-muted:     var(--muted,   #9ca3af);
    --adr-radius:    18px;
    --adr-transition: .32s cubic-bezier(.4,0,.2,1);
}

/* ══════════════════════════════════════════════
   DRAWER OVERLAY
══════════════════════════════════════════════ */
#asaba-drawer-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(3px);
    z-index: 9998;
    opacity: 0; pointer-events: none;
    transition: opacity var(--adr-transition);
}
#asaba-drawer-overlay.is-open {
    opacity: 1; pointer-events: all;
}

/* ══════════════════════════════════════════════
   BOTTOM SHEET DRAWER
══════════════════════════════════════════════ */
#asaba-cart-drawer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    max-height: 92dvh;
    background: var(--adr-bg);
    border-radius: var(--adr-radius) var(--adr-radius) 0 0;
    z-index: 9999;
    display: flex; flex-direction: column;
    transform: translateY(100%);
    transition: transform var(--adr-transition);
    will-change: transform;
    /* safe area for notched phones */
    padding-bottom: env(safe-area-inset-bottom, 0);
}
#asaba-cart-drawer.is-open {
    transform: translateY(0);
}

/* Drag handle */
.drawer-handle {
    width: 44px; height: 5px;
    background: var(--adr-border);
    border-radius: 99px;
    margin: 12px auto 0;
    flex-shrink: 0;
}

/* Header */
.drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px 10px;
    border-bottom: 1px solid var(--adr-border);
    flex-shrink: 0;
}
.drawer-title {
    font-size: 17px; font-weight: 600;
    color: var(--adr-white);
    display: flex; align-items: center; gap: 8px;
}
.drawer-item-count {
    font-size: 12px; font-weight: 500;
    background: var(--adr-orange);
    color: #fff;
    border-radius: 99px;
    padding: 2px 8px;
}
.drawer-close {
    background: rgba(255,255,255,.08);
    border: none; border-radius: 50%;
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    color: var(--adr-white); font-size: 18px;
    cursor: pointer; flex-shrink: 0;
    transition: background .2s;
}
.drawer-close:hover { background: rgba(255,255,255,.16); }

/* Scrollable content area */
#asaba-drawer-content {
    overflow-y: auto;
    flex: 1;
    padding: 12px 20px;
    -webkit-overflow-scrolling: touch;
}

/* Loading state */
.drawer-loading {
    text-align: center; padding: 40px 0;
    color: var(--adr-muted); font-size: 15px;
}

/* Cart item row */
.drawer-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--adr-border);
}
.drawer-item:last-child { border-bottom: none; }
.drawer-item-img {
    width: 64px; height: 64px; border-radius: 12px;
    object-fit: cover; flex-shrink: 0;
    background: var(--adr-card);
}
.drawer-item-img-placeholder {
    width: 64px; height: 64px; border-radius: 12px;
    background: var(--adr-card);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; flex-shrink: 0;
}
.drawer-item-info { flex: 1; min-width: 0; }
.drawer-item-name {
    font-size: 14px; font-weight: 500;
    color: var(--adr-white);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drawer-item-price {
    font-size: 13px; color: var(--adr-orange);
    font-weight: 600; margin-top: 2px;
}
.drawer-qty-row {
    display: flex; align-items: center; gap: 0; margin-top: 8px;
}
.drawer-qty-dec,
.drawer-qty-inc {
    background: rgba(255,255,255,.09);
    border: 1px solid var(--adr-border);
    color: var(--adr-white);
    width: 30px; height: 30px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; cursor: pointer;
    transition: background .2s;
}
.drawer-qty-dec:hover, .drawer-qty-inc:hover { background: rgba(255,255,255,.18); }
.drawer-qty-val {
    min-width: 32px; text-align: center;
    font-size: 14px; font-weight: 600; color: var(--adr-white);
}
.drawer-remove {
    background: none; border: none;
    color: var(--adr-muted); font-size: 18px;
    cursor: pointer; margin-left: auto;
    padding: 4px; border-radius: 6px;
    transition: color .2s;
}
.drawer-remove:hover { color: #ef4444; }

/* Empty cart */
.drawer-empty {
    text-align: center; padding: 48px 0;
    color: var(--adr-muted);
}
.drawer-empty-icon { font-size: 48px; margin-bottom: 12px; }
.drawer-empty p { font-size: 15px; }
.drawer-empty a {
    display: inline-block; margin-top: 14px;
    background: var(--adr-orange); color: #fff;
    padding: 10px 24px; border-radius: 12px;
    font-weight: 600; text-decoration: none;
}

/* Drawer footer */
.drawer-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--adr-border);
    flex-shrink: 0; background: var(--adr-bg);
}
.drawer-subtotal-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px;
}
.drawer-subtotal-label { font-size: 14px; color: var(--adr-muted); }
.drawer-subtotal-val   { font-size: 18px; font-weight: 700; color: var(--adr-white); }
.drawer-checkout-btn {
    width: 100%;
    background: var(--adr-orange);
    color: #fff; border: none;
    border-radius: 14px; padding: 15px;
    font-size: 16px; font-weight: 700;
    cursor: pointer; display: flex;
    align-items: center; justify-content: center; gap: 8px;
    transition: opacity .2s, transform .15s;
}
.drawer-checkout-btn:active { transform: scale(.97); opacity: .9; }
.drawer-view-cart {
    display: block; text-align: center;
    margin-top: 10px; font-size: 13px;
    color: var(--adr-muted); text-decoration: none;
}
.drawer-view-cart:hover { color: var(--adr-white); }

/* ══════════════════════════════════════════════
   APP-STYLE CHECKOUT
══════════════════════════════════════════════ */
#asaba-checkout-wrap {
    max-width: 560px;
    margin: 0 auto;
    padding: 0 0 120px; /* room for fixed pay button */
    min-height: 100dvh;
    background: var(--adr-bg);
}

/* Progress header */
.aco-header {
    position: sticky; top: 0; z-index: 100;
    background: var(--adr-bg);
    padding: 14px 20px 0;
    border-bottom: 1px solid var(--adr-border);
}
.aco-header-top {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.aco-back-btn {
    background: rgba(255,255,255,.08);
    border: none; border-radius: 50%;
    width: 36px; height: 36px;
    color: var(--adr-white); font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; text-decoration: none;
}
.aco-page-title {
    font-size: 17px; font-weight: 600;
    color: var(--adr-white);
}

/* Step dots row */
.aco-steps-row {
    display: flex; align-items: flex-start;
    justify-content: center; gap: 0;
    padding-bottom: 16px;
}
.aco-step-item {
    display: flex; flex-direction: column; align-items: center;
    flex: 1; position: relative;
}
.aco-step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 14px; left: 60%;
    width: 80%; height: 2px;
    background: var(--adr-border);
    transition: background .4s;
}
.aco-step-item.is-complete::after,
.aco-step-item.is-active::after {
    background: var(--adr-orange);
}
.aco-step-dot {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--adr-card);
    border: 2px solid var(--adr-border);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: var(--adr-muted);
    font-weight: 700; cursor: pointer;
    transition: all .3s; position: relative; z-index: 1;
}
.aco-step-dot.is-active {
    background: var(--adr-orange); border-color: var(--adr-orange);
    color: #fff; transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(255,98,64,.22);
}
.aco-step-dot.is-complete {
    background: var(--adr-teal); border-color: var(--adr-teal); color: #fff;
}
.aco-step-label {
    font-size: 10px; margin-top: 5px;
    color: var(--adr-muted); font-weight: 500;
    text-align: center;
    transition: color .3s;
}
.aco-step-label.is-active { color: var(--adr-orange); font-weight: 600; }

/* Progress bar */
.aco-progress-track {
    height: 3px; background: var(--adr-border);
    margin-bottom: -1px;
}
#aco-progress-bar {
    height: 100%; width: 0;
    background: linear-gradient(90deg, var(--adr-orange), var(--adr-teal));
    transition: width .4s ease;
}

/* Order summary strip */
.aco-summary-strip {
    margin: 16px 20px 0;
    background: var(--adr-card);
    border: 1px solid var(--adr-border);
    border-radius: 14px; overflow: hidden;
}
.aco-summary-toggle {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; cursor: pointer;
    font-size: 14px; font-weight: 500; color: var(--adr-white);
}
.aco-summary-toggle .aco-total {
    font-size: 16px; font-weight: 700; color: var(--adr-orange);
}
.aco-caret { font-size: 10px; color: var(--adr-muted); transition: transform .2s; }
#aco-summary-body {
    display: none; border-top: 1px solid var(--adr-border);
}
#aco-summary-body.is-open { display: block; }
.aco-sum-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 16px;
    font-size: 13px; color: var(--adr-muted);
    border-bottom: 1px solid var(--adr-border);
}
.aco-sum-item:last-child { border-bottom: none; }
.aco-sum-item-name { flex: 1; }
.aco-sum-item-qty  { color: var(--adr-muted); margin: 0 12px; }
.aco-sum-item-price{ color: var(--adr-white); font-weight: 500; }

/* Step panels */
.aco-panels { padding: 20px 20px 0; }
.aco-panel {
    display: none; animation: acoPanelIn .32s ease;
}
.aco-panel.is-visible { display: block; }
@keyframes acoPanelIn {
    from { opacity: 0; transform: translateX(18px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Section headings */
.aco-section-title {
    font-size: 15px; font-weight: 600;
    color: var(--adr-white); margin: 20px 0 12px;
    display: flex; align-items: center; gap: 8px;
}

/* Form fields */
.aco-field-group { margin-bottom: 14px; }
.aco-field-group label {
    display: block; font-size: 12px; font-weight: 500;
    color: var(--adr-muted); margin-bottom: 6px; letter-spacing: .03em;
}
.aco-field-group input,
.aco-field-group select,
.aco-field-group textarea {
    width: 100%; background: var(--adr-card);
    border: 1.5px solid var(--adr-border);
    border-radius: 12px; padding: 13px 16px;
    font-size: 15px; color: var(--adr-white);
    font-family: inherit;
    transition: border-color .2s, box-shadow .2s;
    -webkit-appearance: none;
}
.aco-field-group input:focus,
.aco-field-group select:focus,
.aco-field-group textarea:focus {
    outline: none;
    border-color: var(--adr-orange);
    box-shadow: 0 0 0 3px rgba(255,98,64,.15);
}
.aco-field-group input.aco-field-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,.15);
}
.aco-field-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}

/* Delivery options */
.aco-delivery-opts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.aco-delivery-opt {
    display: flex; align-items: center; gap: 14px;
    background: var(--adr-card);
    border: 1.5px solid var(--adr-border);
    border-radius: 14px; padding: 14px 16px;
    cursor: pointer; transition: border-color .2s, background .2s;
}
.aco-delivery-opt.is-selected {
    border-color: var(--adr-orange);
    background: rgba(255,98,64,.08);
}
.aco-delivery-opt input[type="radio"] { display: none; }
.aco-delivery-icon { font-size: 26px; flex-shrink: 0; }
.aco-delivery-info { flex: 1; }
.aco-delivery-name { font-size: 14px; font-weight: 600; color: var(--adr-white); }
.aco-delivery-desc { font-size: 12px; color: var(--adr-muted); margin-top: 2px; }
.aco-delivery-price{ font-size: 14px; font-weight: 700; color: var(--adr-orange); }

/* Payment options */
.aco-payment-opts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.aco-payment-opt {
    display: flex; align-items: center; gap: 14px;
    background: var(--adr-card);
    border: 1.5px solid var(--adr-border);
    border-radius: 14px; padding: 14px 16px;
    cursor: pointer; transition: border-color .2s, background .2s;
}
.aco-payment-opt.is-selected {
    border-color: var(--adr-orange);
    background: rgba(255,98,64,.08);
}
.aco-payment-opt input[type="radio"] { display: none; }
.aco-payment-icon { font-size: 24px; flex-shrink: 0; }
.aco-payment-name { font-size: 14px; font-weight: 600; color: var(--adr-white); }
.aco-payment-desc { font-size: 12px; color: var(--adr-muted); margin-top: 2px; }

.aco-payment-detail {
    display: none;
    background: var(--adr-card); border: 1px solid var(--adr-border);
    border-radius: 12px; padding: 16px; margin-top: -4px; margin-bottom: 16px;
}

/* Note field */
.aco-note { font-size: 13px; color: var(--adr-muted); margin-top: 4px; }

/* Sticky bottom nav */
.aco-nav-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--adr-bg);
    border-top: 1px solid var(--adr-border);
    padding: 12px 20px;
    display: flex; gap: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
    z-index: 200;
    max-width: 560px; margin: 0 auto;
}
#aco-prev {
    flex-shrink: 0; width: 52px; height: 52px;
    background: rgba(255,255,255,.08);
    border: 1.5px solid var(--adr-border);
    border-radius: 14px; color: var(--adr-white);
    font-size: 20px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s;
}
#aco-prev:hover { background: rgba(255,255,255,.16); }
#aco-next, #aco-pay-btn {
    flex: 1; height: 52px;
    background: var(--adr-orange); color: #fff;
    border: none; border-radius: 14px;
    font-size: 16px; font-weight: 700;
    cursor: pointer; display: flex;
    align-items: center; justify-content: center; gap: 8px;
    transition: opacity .2s, transform .15s;
}
#aco-next:active, #aco-pay-btn:active { transform: scale(.97); }
#aco-pay-btn { background: var(--adr-teal); }
#aco-pay-btn:disabled { opacity: .6; pointer-events: none; }

/* Trust badge on payment step */
.aco-trust {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; font-size: 12px; color: var(--adr-muted);
    margin: 10px 0 4px;
}

/* Toast */
.aco-toast {
    position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: #1f2937; color: var(--adr-white);
    padding: 12px 20px; border-radius: 12px;
    font-size: 14px; font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    z-index: 9999; opacity: 0; pointer-events: none;
    transition: opacity .3s, transform .3s;
    white-space: nowrap;
}
.aco-toast.is-visible {
    opacity: 1; transform: translateX(-50%) translateY(0);
}
.aco-toast--error { border-left: 4px solid #ef4444; }
.aco-toast--info  { border-left: 4px solid var(--adr-orange); }

/* WooCommerce notices — hide defaults (we use our own UI) */
#asaba-checkout-wrap .woocommerce-notices-wrapper { display: none; }
#asaba-checkout-wrap .woocommerce-error { display: none; }
