/* ============================================================
   AQUARUBIN — cart-drawer.css
   Slide-in Cart Drawer — Dark Glassmorphism
   ============================================================ */

/* ---- Backdrop ---- */
.cart-drawer__backdrop {
    position: fixed;
    inset: 0;
    z-index: 299;
    background: rgba(11, 9, 24, 0.70);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s var(--ease-out-expo);
}

/* ---- Panel ---- */
.cart-drawer__panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 300;
    width: min(430px, 100vw);
    display: flex;
    flex-direction: column;
    background: rgba(20, 18, 42, 0.97);
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    border-left: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow:
        -8px 0 32px rgba(0, 0, 0, 0.55),
        inset 1px 0 0 rgba(255, 255, 255, 0.04);
    transform: translateX(100%);
    /* visibility hides the panel (+ its shadow) completely when closed */
    visibility: hidden;
    transition:
        transform 0.48s var(--ease-out-expo),
        visibility 0s linear 0.48s;
    overflow: hidden;
}

/* ---- Open State ---- */
.cart-drawer.is-open .cart-drawer__backdrop {
    opacity: 1;
    pointer-events: auto;
}

.cart-drawer.is-open .cart-drawer__panel {
    transform: translateX(0);
    visibility: visible;
    transition:
        transform 0.48s var(--ease-out-expo),
        visibility 0s linear 0s;
}

/* ---- Header ---- */
.cart-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(255, 0, 255, 0.05) 0%, transparent 100%);
}

.cart-drawer__heading {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.cart-drawer__heading svg {
    color: var(--clr-ruby);
    opacity: 0.85;
    flex-shrink: 0;
}

.cart-drawer__title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--clr-text);
    letter-spacing: -0.025em;
}

.cart-drawer__item-count {
    display: inline-flex;
    align-items: center;
    padding: 0.18em 0.6em;
    background: rgba(255, 0, 255, 0.12);
    border: 1px solid rgba(255, 0, 255, 0.22);
    border-radius: var(--radius-pill);
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--clr-ruby-light);
    letter-spacing: 0.05em;
    line-height: 1.5;
}

.cart-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--clr-text-muted);
    cursor: pointer;
    transition:
        border-color 0.25s,
        background 0.25s,
        color 0.25s,
        transform 0.3s var(--ease-spring);
    flex-shrink: 0;
}

.cart-drawer__close:hover {
    border-color: rgba(255, 0, 255, 0.32);
    background: rgba(255, 0, 255, 0.09);
    color: var(--clr-ruby);
    transform: rotate(90deg);
}

/* ---- Body (scrollable) ---- */
.cart-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.09) transparent;
}

.cart-drawer__body::-webkit-scrollbar { width: 3px; }
.cart-drawer__body::-webkit-scrollbar-track { background: transparent; }
.cart-drawer__body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.10);
    border-radius: 9999px;
}

/* ---- Empty State ---- */
.cart-drawer__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 4rem 1.5rem;
    text-align: center;
}

.cart-drawer__empty svg {
    color: var(--clr-text-faint);
    opacity: 0.30;
}

.cart-drawer__empty p {
    font-size: 0.95rem;
    color: var(--clr-text-muted);
    font-weight: 500;
    line-height: 1.55;
}

/* ---- Items List ---- */
.cart-drawer__items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ---- Single Item ---- */
.cart-item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.cart-item:last-child { border-bottom: none; }

.cart-item:hover { background: rgba(255, 255, 255, 0.015); }

/* Thumbnail */
.cart-item__thumb {
    flex-shrink: 0;
    width: 68px;
    height: 68px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: var(--clr-bg-3);
    display: block;
    position: relative;
}

.cart-item__thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
    pointer-events: none;
}

.cart-item__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.38s var(--ease-spring);
}

.cart-item:hover .cart-item__thumb img {
    transform: scale(1.07);
}

/* Info column */
.cart-item__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding-top: 0.1rem;
}

.cart-item__name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--clr-text);
    text-decoration: none;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}

.cart-item__name:hover { color: var(--clr-ruby); }

.cart-item__qty {
    font-size: 0.76rem;
    color: var(--clr-text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.cart-item__qty-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.12em 0.55em;
    background: rgba(0, 128, 255, 0.12);
    border: 1px solid rgba(0, 128, 255, 0.22);
    border-radius: var(--radius-pill);
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--clr-blue-light);
    letter-spacing: 0.04em;
}

.cart-item__unit-price {
    color: var(--clr-text-faint);
    font-size: 0.73rem;
}

/* Right column */
.cart-item__right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.5rem;
    flex-shrink: 0;
    min-height: 68px;
}

.cart-item__subtotal {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--clr-text);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

/* Remove button */
.cart-item__remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.03);
    color: var(--clr-text-faint);
    cursor: pointer;
    text-decoration: none;
    transition:
        border-color 0.22s,
        background 0.22s,
        color 0.22s,
        transform 0.22s var(--ease-spring);
}

.cart-item__remove:hover {
    border-color: rgba(255, 68, 68, 0.40);
    background: rgba(255, 68, 68, 0.10);
    color: #ff5555;
    transform: scale(1.12);
}

/* ---- Remove animation ---- */
.cart-item--removing {
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

/* ---- Qty +/- controls ---- */
.cart-item__unit-price {
    font-size: 0.73rem;
    color: var(--clr-text-faint);
    margin-top: 0.1rem;
}

.cart-item__qty-controls {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin-top: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: var(--radius-pill);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    width: fit-content;
}

.cart-item__qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 26px;
    background: transparent;
    border: none;
    color: var(--clr-text-muted);
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    flex-shrink: 0;
    padding: 0;
}

.cart-item__qty-btn:hover {
    background: rgba(0, 128, 255, 0.14);
    color: var(--clr-blue-light);
}

.cart-item__qty-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.cart-item__qty-btn svg { pointer-events: none; }

.cart-item__qty-num {
    min-width: 26px;
    text-align: center;
    font-size: 0.80rem;
    font-weight: 700;
    color: var(--clr-text);
    line-height: 26px;
    border-left: 1px solid rgba(255,255,255,0.08);
    border-right: 1px solid rgba(255,255,255,0.08);
    user-select: none;
}

/* ---- Footer ---- */
.cart-drawer__footer {
    flex-shrink: 0;
    padding: 1.25rem 1.5rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(0deg, rgba(255, 0, 255, 0.05) 0%, transparent 100%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Divider */
.cart-drawer__footer::before {
    content: '';
    display: block;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 0, 255, 0.25), rgba(0, 128, 255, 0.20), transparent);
    margin-bottom: 0.25rem;
}

/* Free-shipping progress bar (shared: cart drawer + cart page) */
.aq-freeship:empty { display: none; }
.aq-freeship--active {
    padding: var(--space-3);
    border-radius: var(--radius-md);
    background: var(--clr-blue-glow);
    border: 1px solid var(--clr-border-blue);
}
.aq-freeship__label {
    font-size: 0.82rem;
    color: var(--clr-text-muted);
    margin-bottom: var(--space-2);
    text-align: center;
}
.aq-freeship__label strong { color: var(--clr-text); font-weight: 700; }
.aq-freeship__label--reached { color: #a6e9c6; font-weight: 700; }
.aq-freeship__track {
    height: 6px;
    border-radius: var(--radius-pill);
    background: rgba(255,255,255,0.08);
    overflow: hidden;
}
.aq-freeship__fill {
    display: block;
    height: 100%;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--clr-blue), var(--clr-blue-light));
    transition: width 0.4s var(--ease-spring);
}
@media (prefers-reduced-motion: reduce) {
    .aq-freeship__fill { transition: none; }
}
/* On the cart page the bar sits above the totals card and needs its own spacing
   (the drawer uses flex gap instead). */
.aq-cart__right .aq-freeship--active { margin-bottom: var(--space-4); }

/* Total Row */
.cart-drawer__total-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.cart-drawer__total-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--clr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    line-height: 1.4;
    flex-shrink: 0;
}

/* ---- Color-Morphing Total ---- */
@keyframes morphTotal {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.cart-drawer__total-price {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -0.035em;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1;
}

.cart-drawer__total-price .woocommerce-Price-amount,
.cart-drawer__total-price bdi {
    background: linear-gradient(270deg, #d080ff, #8860e0, #4488cc, #70b8e8, #d080ff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: morphTotal 10s ease-in-out infinite;
}

/* Tax note */
.cart-drawer__tax-note {
    font-size: 0.70rem;
    color: var(--clr-text-faint);
    margin: -0.5rem 0 0;
    text-align: right;
    line-height: 1.4;
}

/* ---- CTA Buttons ---- */
.cart-drawer__actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.cart-drawer__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.88em 1.5em;
    border-radius: var(--radius-pill);
    font-size: 0.875rem;
    font-weight: 700;
    font-family: var(--font-sans);
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition:
        opacity 0.25s,
        transform 0.28s var(--ease-spring),
        box-shadow 0.28s,
        background-position 0.4s;
    letter-spacing: -0.01em;
}

.cart-drawer__btn:focus-visible {
    outline: 2px solid var(--clr-blue);
    outline-offset: 3px;
}

/* Ghost / Secondary */
.cart-drawer__btn--ghost {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: var(--clr-text-muted);
}

.cart-drawer__btn--ghost:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--clr-text);
    transform: translateY(-1px);
}

/* Primary / Gradient CTA */
@keyframes btnGlow {
    0%, 100% { box-shadow: 0 4px 20px rgba(180, 0, 200, 0.32), 0 1px 4px rgba(0,0,0,0.4); }
    50%       { box-shadow: 0 5px 26px rgba(100, 0, 200, 0.38), 0 2px 6px rgba(0,0,0,0.4); }
}

.cart-drawer__btn--primary {
    background: linear-gradient(135deg, #cc00cc 0%, #ff00ff 45%, #8040ff 100%);
    background-size: 200% 200%;
    color: #fff;
    animation: btnGlow 3s ease infinite;
    position: relative;
    overflow: hidden;
}

.cart-drawer__btn--primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.25s;
}

.cart-drawer__btn--primary:hover::before { opacity: 1; }

.cart-drawer__btn--primary:hover {
    transform: translateY(-2px);
    background-position: right center;
    animation-play-state: paused;
    box-shadow: 0 10px 40px rgba(255, 0, 255, 0.55), 0 3px 10px rgba(0,0,0,0.5);
}

.cart-drawer__btn--primary:active {
    transform: translateY(0px);
    box-shadow: 0 4px 16px rgba(255, 0, 255, 0.35);
}

/* ---- Coupon Section ---- */
.cart-drawer__coupon {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.cart-drawer__coupon-form {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.cart-drawer__coupon-input {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: var(--radius-md);
    color: var(--clr-text);
    font-size: 0.82rem;
    font-family: var(--font-sans);
    padding: 0.55em 0.85em;
    outline: none;
    transition: border-color 0.22s, background 0.22s;
}

.cart-drawer__coupon-input::placeholder {
    color: var(--clr-text-faint);
}

.cart-drawer__coupon-input:focus {
    border-color: rgba(0, 128, 255, 0.45);
    background: rgba(0, 30, 80, 0.30);
}

.cart-drawer__coupon-btn {
    flex-shrink: 0;
    background: rgba(0, 128, 255, 0.14);
    border: 1px solid rgba(0, 128, 255, 0.28);
    border-radius: var(--radius-md);
    color: var(--clr-blue-light);
    font-size: 0.80rem;
    font-weight: 700;
    font-family: var(--font-sans);
    padding: 0.55em 1em;
    cursor: pointer;
    transition: background 0.22s, border-color 0.22s, color 0.22s;
    white-space: nowrap;
}

.cart-drawer__coupon-btn:hover {
    background: rgba(0, 128, 255, 0.26);
    border-color: rgba(0, 128, 255, 0.50);
    color: #8dcfff;
}

.cart-drawer__coupon-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Status messages */
.cart-drawer__coupon-msg {
    font-size: 0.76rem;
    line-height: 1.4;
    min-height: 0;
    transition: opacity 0.2s;
}

.cart-drawer__coupon-msg--ok  { color: #4ddd88; }
.cart-drawer__coupon-msg--err { color: #ff6666; }

/* ---- Applied Coupon Chips ---- */
.cart-coupons-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.cart-coupon-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28em 0.55em 0.28em 0.65em;
    background: rgba(0, 200, 100, 0.10);
    border: 1px solid rgba(0, 200, 100, 0.28);
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
}

.cart-coupon-chip svg {
    color: rgba(0, 200, 100, 0.70);
    flex-shrink: 0;
}

.cart-coupon-chip__code {
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #4ddd88;
}

.cart-coupon-chip__discount {
    color: rgba(77, 221, 136, 0.75);
    font-weight: 600;
}

.cart-coupon-chip__remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    padding: 0;
    margin-left: 0.1rem;
    transition: background 0.18s, color 0.18s;
    flex-shrink: 0;
}

.cart-coupon-chip__remove:hover {
    background: rgba(255, 80, 80, 0.22);
    color: #ff7777;
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    .cart-drawer__panel,
    .cart-drawer__backdrop  { transition: none; }
    .cart-drawer__total-price .woocommerce-Price-amount,
    .cart-drawer__total-price bdi { animation: none; }
    .cart-drawer__btn--primary { animation: none; box-shadow: 0 4px 20px rgba(180,0,200,0.32); }
    .cart-item__thumb img { transition: none; }
    .cart-drawer__close { transition: none; }
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
    .cart-drawer__panel { width: 100vw; }
    .cart-drawer__header { padding: 1rem 1.25rem; }
    .cart-drawer__body { padding: 0.5rem 1.25rem; }
    .cart-drawer__footer { padding: 1rem 1.25rem 1.25rem; }
    .cart-drawer__total-price { font-size: 1.35rem; }
}
