/* ==========================================================================
   ExhaustHub — Cart Slideout Drawer
   Brand: purple #9B51E0 / dark #7B3CB8, near-black text, clean white panel
   ========================================================================== */

:root {
    --eh-purple: #9b51e0;
    --eh-purple-dark: #7b3cb8;
    --eh-ink: #1f2937;
    --eh-muted: #6b7280;
    --eh-line: #e5e7eb;
    --eh-bg-soft: #f9fafb;
    --eh-radius: 12px;
    --eh-drawer-w: 420px;
}

/* Hide Elementor's native mini-cart dropdown — we drive our own panel,
   but keep the toggle button + count bubble in the header intact. */
.elementor-menu-cart__container {
    display: none !important;
}

/* ---- Overlay ---------------------------------------------------------- */
.eh-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
    z-index: 999998;
    backdrop-filter: blur(2px);
}
.eh-cart-overlay[hidden] {
    display: block; /* override the HTML hidden attr; we animate instead */
}
body.eh-cart-open .eh-cart-overlay {
    opacity: 1;
    visibility: visible;
}

/* ---- Drawer shell ----------------------------------------------------- */
.eh-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: var(--eh-drawer-w);
    max-width: 100%;
    background: #fff;
    box-shadow: -8px 0 40px rgba(17, 24, 39, 0.18);
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    font-family: inherit;
    color: var(--eh-ink);
    will-change: transform;
}
body.eh-cart-open .eh-cart-drawer {
    transform: translateX(0);
}

/* ---- Header ----------------------------------------------------------- */
.eh-cart-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--eh-line);
    flex: 0 0 auto;
}
.eh-cart-drawer__title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--eh-ink);
    letter-spacing: -0.01em;
}
.eh-cart__count {
    color: var(--eh-purple);
    font-weight: 700;
}
.eh-cart-drawer__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--eh-bg-soft);
    color: var(--eh-ink);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}
.eh-cart-drawer__close:hover {
    background: #f3e8ff;
    color: var(--eh-purple-dark);
}

/* ---- Body / items ----------------------------------------------------- */
.eh-cart__body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.eh-cart-items {
    list-style: none;
    margin: 0;
    padding: 6px 20px;
    overflow-y: auto;
    flex: 1 1 auto;
    -webkit-overflow-scrolling: touch;
}
.eh-cart-item {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--eh-line);
}
.eh-cart-item:last-child {
    border-bottom: none;
}

.eh-cart-item__thumb {
    display: block;
    width: 72px;
    height: 72px;
    border-radius: var(--eh-radius);
    border: 1px solid var(--eh-line);
    overflow: hidden;
    background: var(--eh-bg-soft);
}
.eh-cart-item__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin: 0;
}

.eh-cart-item__details {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.eh-cart-item__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}
.eh-cart-item__name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--eh-ink);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
a.eh-cart-item__name:hover {
    color: var(--eh-purple-dark);
}
.eh-cart-item__remove {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--eh-muted);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}
.eh-cart-item__remove:hover {
    background: #fef2f2;
    color: #ef4444;
}
.eh-cart-item__meta {
    font-size: 12px;
    color: var(--eh-muted);
    line-height: 1.4;
}
.eh-cart-item__meta p {
    margin: 0;
}
.eh-cart-item__unit {
    font-size: 12px;
    color: var(--eh-muted);
}

.eh-cart-item__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
}
.eh-cart-item__line {
    font-size: 15px;
    font-weight: 700;
    color: var(--eh-ink);
    white-space: nowrap;
}
.eh-cart-item__line del {
    color: var(--eh-muted);
    font-weight: 400;
    margin-right: 4px;
}

/* ---- Quantity stepper ------------------------------------------------- */
.eh-cart-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--eh-line);
    border-radius: 999px;
    overflow: hidden;
    background: #fff;
}
.eh-cart-qty__btn {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--eh-ink);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.eh-cart-qty__btn:hover {
    background: #f3e8ff;
    color: var(--eh-purple-dark);
}
.eh-cart-qty__input {
    width: 38px;
    height: 30px;
    border: none;
    border-left: 1px solid var(--eh-line);
    border-right: 1px solid var(--eh-line);
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--eh-ink);
    background: #fff;
    padding: 0;
    -moz-appearance: textfield;
    border-radius: 0;
}
.eh-cart-qty__input::-webkit-outer-spin-button,
.eh-cart-qty__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.eh-cart-qty__input:focus {
    outline: none;
}

/* Row-level loading state */
.eh-cart-item.is-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ---- Footer ----------------------------------------------------------- */
.eh-cart-foot {
    flex: 0 0 auto;
    padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--eh-line);
    background: #fff;
    box-shadow: 0 -6px 18px rgba(17, 24, 39, 0.04);
}
.eh-cart-foot__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 4px;
}
.eh-cart-foot__label {
    font-size: 15px;
    font-weight: 600;
    color: var(--eh-ink);
}
.eh-cart-foot__value {
    font-size: 20px;
    font-weight: 800;
    color: var(--eh-ink);
    letter-spacing: -0.01em;
}
.eh-cart-foot__note {
    margin: 0 0 14px;
    font-size: 12px;
    color: var(--eh-muted);
}

/* ---- Buttons ---------------------------------------------------------- */
.eh-cart-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 14px 18px;
    border-radius: var(--eh-radius);
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.05s ease;
    box-sizing: border-box;
}
.eh-cart-btn:active {
    transform: translateY(1px);
}
.eh-cart-btn--primary {
    background: var(--eh-purple);
    color: #fff;
    border: 2px solid var(--eh-purple);
    margin-bottom: 10px;
    box-shadow: 0 6px 16px rgba(155, 81, 224, 0.28);
}
.eh-cart-btn--primary:hover {
    background: var(--eh-purple-dark);
    border-color: var(--eh-purple-dark);
    color: #fff;
}
.eh-cart-btn--ghost {
    background: #fff;
    color: var(--eh-purple-dark);
    border: 2px solid var(--eh-line);
}
.eh-cart-btn--ghost:hover {
    border-color: var(--eh-purple);
    color: var(--eh-purple-dark);
}
.eh-cart-foot__continue {
    display: block;
    width: 100%;
    margin: 12px 0 0;
    padding: 4px;
    border: none;
    background: transparent;
    color: var(--eh-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.eh-cart-foot__continue:hover {
    color: var(--eh-ink);
}

/* ---- Empty state ------------------------------------------------------ */
.eh-cart-empty {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 28px;
    gap: 6px;
}
.eh-cart-empty__icon {
    color: var(--eh-purple);
    margin-bottom: 8px;
    opacity: 0.85;
}
.eh-cart-empty__title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--eh-ink);
}
.eh-cart-empty__text {
    margin: 0 0 18px;
    font-size: 14px;
    color: var(--eh-muted);
}
.eh-cart-empty .eh-cart-btn {
    width: auto;
    min-width: 200px;
}

/* ---- Drawer-level loader --------------------------------------------- */
.eh-cart-drawer__loader {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.55);
    z-index: 5;
}
.eh-cart-drawer.is-busy .eh-cart-drawer__loader {
    display: flex;
}
.eh-cart-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e9d5ff;
    border-top-color: var(--eh-purple);
    border-radius: 50%;
    animation: eh-cart-spin 0.7s linear infinite;
}
@keyframes eh-cart-spin {
    to { transform: rotate(360deg); }
}

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 480px) {
    :root {
        --eh-drawer-w: 100%;
    }
    .eh-cart-drawer__head {
        padding: 16px;
    }
    .eh-cart-items {
        padding: 4px 16px;
    }
    .eh-cart-foot {
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    }
    .eh-cart-item {
        grid-template-columns: 64px 1fr;
        gap: 12px;
    }
    .eh-cart-item__thumb {
        width: 64px;
        height: 64px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .eh-cart-drawer,
    .eh-cart-overlay {
        transition: none;
    }
}
