/**
 * Cart Drawer styles — Phase 2a of customer funnel overhaul.
 *
 * Desktop (>=768px): right-side slide-in, 420px wide
 * Mobile (<768px): bottom-sheet, ~85vh tall, drag-down-to-dismiss
 *
 * Color palette matches site dark/skeuomorphic theme:
 *   - Backdrop: rgba(0,0,0,0.65)
 *   - Panel: linear-gradient(135deg, #0a1929 0%, #050d18 100%)
 *   - Accent: cyan #00c8ff
 *   - Borders: rgba(255,255,255,0.06)
 */

.aor-cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
}

.aor-cart-drawer:not([hidden]) {
    pointer-events: auto;
}

.aor-cart-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    opacity: 0;
    transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.aor-cart-drawer.is-open .aor-cart-drawer-backdrop {
    opacity: 1;
}

.aor-cart-drawer-panel {
    position: absolute;
    background: linear-gradient(135deg, #0a1929 0%, #050d18 100%);
    color: #fff;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

.aor-cart-drawer.is-open .aor-cart-drawer-panel {
    transform: translateX(0);
}

/* Desktop: right slide-in */
@media (min-width: 768px) {
    .aor-cart-drawer-panel {
        top: 0;
        right: 0;
        bottom: 0;
        width: 420px;
        max-width: 100vw;
    }
}

/* Mobile: bottom sheet */
@media (max-width: 767px) {
    .aor-cart-drawer-panel {
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 85vh;
        height: 85vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }

    .aor-cart-drawer.is-open .aor-cart-drawer-panel {
        transform: translateY(0);
    }

    /* Drag handle bar at top of bottom sheet */
    .aor-cart-drawer-panel::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 2px;
        margin: 8px auto 0;
        flex-shrink: 0;
    }
}

/* Header */
.aor-cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.aor-cart-drawer-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.aor-cart-drawer-count {
    font-size: 12px;
    font-weight: 700;
    background: rgba(0, 200, 255, 0.15);
    color: #00c8ff;
    padding: 2px 10px;
    border-radius: 999px;
    min-width: 24px;
    text-align: center;
}

.aor-cart-drawer-close {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.aor-cart-drawer-close:hover,
.aor-cart-drawer-close:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

/* Shipping banner */
.aor-cart-drawer-shipping-banner {
    margin: 12px 16px 0;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    background: rgba(34, 197, 94, 0.10);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.25);
    flex-shrink: 0;
}

.aor-cart-drawer-shipping-banner.is-flat-rate {
    background: rgba(255, 200, 0, 0.10);
    color: #ffc800;
    border-color: rgba(255, 200, 0, 0.25);
}

/* Body */
.aor-cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

/* Items list */
.aor-cart-drawer-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.aor-cart-drawer-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    align-items: start;
    transition: background 200ms ease;
}

.aor-cart-drawer-item.is-just-added {
    animation: aor-cart-just-added-glow 1500ms ease-out;
}

@keyframes aor-cart-just-added-glow {
    0%   { background: rgba(0, 200, 255, 0.18); }
    100% { background: transparent; }
}

.aor-cart-drawer-item-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.aor-cart-drawer-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.aor-cart-drawer-item-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: #fff;
}

.aor-cart-drawer-item-title a {
    color: inherit;
    text-decoration: none;
}

.aor-cart-drawer-item-title a:hover {
    color: #00c8ff;
}

.aor-cart-drawer-item-sku {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    font-family: ui-monospace, "SF Mono", monospace;
    letter-spacing: 0.04em;
}

.aor-cart-drawer-item-price {
    font-size: 15px;
    font-weight: 700;
    color: #00c8ff;
    margin-top: 2px;
}

.aor-cart-drawer-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.aor-cart-drawer-item-remove {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 150ms ease, background 150ms ease;
}

.aor-cart-drawer-item-remove:hover,
.aor-cart-drawer-item-remove:focus-visible {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
    outline: none;
}

/* Empty state */
.aor-cart-drawer-empty {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.aor-cart-drawer-empty svg {
    color: rgba(255, 255, 255, 0.25);
    margin-bottom: 16px;
}

.aor-cart-drawer-empty h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.aor-cart-drawer-empty p {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.5;
}

.aor-cart-drawer-empty-cta {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(180deg, #00c8ff 0%, #0099cc 100%);
    color: #001624;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.aor-cart-drawer-empty-cta:hover {
    transform: translateY(-1px);
    color: #001624;
}

/* Footer */
.aor-cart-drawer-footer {
    flex-shrink: 0;
    padding: 16px 20px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.25);
}

.aor-cart-drawer-totals {
    margin-bottom: 14px;
}

.aor-cart-drawer-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
    font-size: 14px;
}

.aor-cart-drawer-totals-row:last-child {
    margin-bottom: 0;
}

.aor-cart-drawer-totals-label {
    color: rgba(255, 255, 255, 0.7);
}

.aor-cart-drawer-totals-value {
    font-weight: 700;
    color: #fff;
}

.aor-cart-drawer-totals-shipping .aor-cart-drawer-totals-value {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-weight: 500;
}

.aor-cart-drawer-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.aor-cart-drawer-continue {
    flex: 1;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 150ms ease;
}

.aor-cart-drawer-continue:hover,
.aor-cart-drawer-continue:focus-visible {
    background: rgba(255, 255, 255, 0.06);
    outline: none;
}

.aor-cart-drawer-checkout {
    flex: 2;
    background: linear-gradient(180deg, #00c8ff 0%, #0099cc 100%);
    color: #001624;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 150ms ease;
    box-shadow: 0 2px 8px rgba(0, 200, 255, 0.25);
}

.aor-cart-drawer-checkout:hover,
.aor-cart-drawer-checkout:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 200, 255, 0.35);
    color: #001624;
    outline: none;
}

.aor-cart-drawer-help {
    margin: 0;
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.aor-cart-drawer-help a {
    color: #00c8ff;
    text-decoration: none;
}

.aor-cart-drawer-help a:hover {
    text-decoration: underline;
}

/* Loading spinner overlay */
.aor-cart-drawer-loading {
    position: absolute;
    inset: 0;
    background: rgba(10, 25, 41, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    pointer-events: none;
}

.aor-cart-drawer-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #00c8ff;
    border-radius: 50%;
    animation: aor-cart-spin 800ms linear infinite;
}

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

/* Mini-cart icon pulse animation (used by JS on add) */
.aor-cart-icon.is-just-added {
    animation: aor-cart-icon-pulse 1200ms ease-out;
}

@keyframes aor-cart-icon-pulse {
    0%   { transform: scale(1);    filter: drop-shadow(0 0 0 rgba(0, 200, 255, 0)); }
    30%  { transform: scale(1.18); filter: drop-shadow(0 0 8px rgba(0, 200, 255, 0.7)); }
    100% { transform: scale(1);    filter: drop-shadow(0 0 0 rgba(0, 200, 255, 0)); }
}
