/* ═══════════════════════════════════════════════════════════════════════════════
   Mini-Cart Drawer — Cubic Promote
   Design matches live Nectar/Salient theme mini-cart.
   Slide-in from right. Mobile: full-width. Desktop: 480px.
   No jQuery. Minimal CSS. GPU-accelerated transitions.
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Backdrop ─────────────────────────────────────────────────────────────── */
.cp-minicart-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cp-minicart-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

/* ── Drawer Panel ─────────────────────────────────────────────────────────── */
.cp-minicart {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 9999;
    width: 600px;
    max-width: 100%;
    height: 500px;
    max-height: 500px;
    background: #fff;
    border: 1px solid #0597d4;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: none;
    will-change: transform;
    visibility: hidden;
}

.cp-minicart.is-ready {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
}

.cp-minicart.is-open {
    transform: translateX(0);
    visibility: visible;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.cp-minicart__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 20px 24px;
    border-bottom: none;
    flex-shrink: 0;
}

.cp-minicart__header::after {
    content: '';
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 0;
    height: 1px;
    background: rgba(0,0,0,.1);
}

.cp-minicart__header {
    position: relative;
}

.cp-minicart__title {
    font-size: 32px;
    font-weight: 600;
    margin: 0;
    color: #000;
}

.cp-minicart__close {
    background: rgba(0, 0, 0, .05);
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 4px 8px;
    border-radius: 50%;
    transition: background 0.15s;
}

.cp-minicart__close:hover {
    background: #f5f5f5;
    color: #1a1a1a;
}

/* ── Items Container (scrollable) ─────────────────────────────────────────── */
.cp-minicart__items {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* ── Empty State ──────────────────────────────────────────────────────────── */
.cp-minicart__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #888;
}

.cp-minicart__empty svg {
    margin-bottom: 16px;
    color: #ccc;
}

.cp-minicart__empty p {
    font-size: 1rem;
    margin: 0 0 20px;
}

.cp-minicart__shop-btn {
    display: inline-block;
    padding: 10px 24px;
    background: #F9A32F;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.cp-minicart__shop-btn:hover {
    background: #000;
    color: #fff;
}

/* ── Item List ────────────────────────────────────────────────────────────── */
.cp-minicart__list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-weight: 400;
    line-height: 1.2;
}

/* ── Single Item — 3-column: image | details | price+remove ───────────────── */
.cp-minicart-item {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 14px;
    padding: 18px 24px;
    border-bottom: 1px solid #f0f0f0;
    align-items: start;
    transition: opacity 0.2s;
}

.cp-minicart-item:last-child {
    border-bottom: none;
}

.cp-minicart-item__img {
    width: 64px;
    height: 64px;
    border-radius: 4px;
    overflow: hidden;
    background: #f9f9f9;
    flex-shrink: 0;
}

.cp-minicart-item__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Item Details (middle column) ─────────────────────────────────────────── */
.cp-minicart-item__details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.cp-minicart-item__top {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cp-minicart-item__name {
    font-size: 16px;
    font-weight: 400;
    color: #f9a32f;
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cp-minicart-item__name:hover {
    text-decoration: underline;
}

.cp-minicart-item__deco {
    font-size: 13px;
    font-weight: 400;
    color: #000;
    line-height: 1.4;
}

.cp-minicart-item__actions {
    display: flex;
    align-items: center;
}

/* ── Quantity Controls ────────────────────────────────────────────────────── */
.cp-minicart-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 999px;
    overflow: hidden;
    padding: 4px 8px;
    gap: 4px;
    max-width: 120px;
}

.cp-minicart-qty__btn {
    background: none;
    border: none;
    width: 24px;
    height: 24px;
    font-size: 1.125rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: color 0.15s;
    padding: 0;
    line-height: 1;
}

.cp-minicart-qty__btn:hover {
    color: #000;
}

.cp-minicart-qty__val {
    min-width: 28px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 400;
    color: #555;
    padding: 0;
    border: none;
    outline: none;
    background: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

.cp-minicart-qty__val::-webkit-inner-spin-button,
.cp-minicart-qty__val::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ── Right Column (price + remove) ────────────────────────────────────────── */
.cp-minicart-item__right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.cp-minicart-item__price {
    font-size: 0.875rem;
    font-weight: 400;
    color: #e74c3c;
}

.cp-minicart-item__remove {
    background: none;
    border: none;
    font-size: 0.75rem;
    font-weight: 400;
    color: #000;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    transition: color 0.15s;
}

.cp-minicart-item__remove:hover {
    color: #e74c3c;
}

/* ── Footer (Subtotal + Buttons) ──────────────────────────────────────────── */
.cp-minicart__footer {
    position: relative;
    border-top: none;
    padding: 20px 24px 24px;
    flex-shrink: 0;
    background: #fff;
}

.cp-minicart__footer::before {
    content: '';
    position: absolute;
    left: 24px;
    right: 24px;
    top: 0;
    height: 1px;
    background: rgba(0,0,0,.1);
}

.cp-minicart__subtotal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    font-size: 18px;
    color: #000;
}

.cp-minicart__subtotal small {
    color: #666;
    font-weight: 400;
}

.cp-minicart__subtotal strong {
    font-size: 18px;
    font-weight: 400;
    color: #000;
}

/* ── Action Buttons — side by side ────────────────────────────────────────── */
.cp-minicart__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.cp-minicart__action-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cp-minicart__btn {
    display: block;
    text-align: center;
    padding: 12px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
    cursor: pointer;
}

.cp-minicart__btn:active {
    transform: scale(0.98);
}

.cp-minicart__btn--primary {
    background: #F9A32F;
    color: #fff;
    border-radius: 999px;
}

.cp-minicart__btn--primary:hover {
    background: #000;
    color: #fff;
}

.cp-minicart__btn--secondary {
    background: #0087ce;
    color: #fff;
    border: none;
    border-radius: 999px;
}

.cp-minicart__btn--secondary:hover {
    background: #000;
    color: #fff;
}

.cp-minicart__btn-desc {
    font-size: 13.6px;
    color: #000;
    line-height: 1.4;
    margin: 0;
    text-align: center;
}

/* ── Loading State (Add to Cart button) ───────────────────────────────────── */
.button_open-minicart.is-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.button_open-minicart.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cp-spin 0.6s linear infinite;
}

@keyframes cp-spin {
    to { transform: rotate(360deg); }
}

/* ── Highlight variation options when not selected ────────────────────────── */
.cp-highlight-options {
    animation: cp-pulse 0.4s ease 3;
    border-radius: 8px;
    box-shadow: 0 0 0 3px rgba(249, 163, 47, 0.5);
}

@keyframes cp-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(249, 163, 47, 0.5); }
    50% { box-shadow: 0 0 0 6px rgba(249, 163, 47, 0.3); }
}

/* ── Cart Count Badge ─────────────────────────────────────────────────────── */
.cp-cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ffb400;
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1;
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-inline: 3px;
}

/* ── Mobile Responsive ────────────────────────────────────────────────────── */

/* Tablet: slightly narrower */
@media (max-width: 768px) {
    .cp-minicart {
        width: 420px;
        height: 480px;
    }
}

/* Mobile: full screen */
@media (max-width: 480px) {
    .cp-minicart {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        top: 0;
        right: 0;
    }

    .cp-minicart-item {
        grid-template-columns: 56px 1fr auto;
        gap: 10px;
        padding: 14px 16px;
    }

    .cp-minicart-item__img {
        width: 56px;
        height: 56px;
    }

    .cp-minicart__header {
        padding: 16px;
    }

    .cp-minicart__footer {
        padding: 16px;
    }

    .cp-minicart__actions {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .cp-minicart__btn-desc {
        display: none;
    }
}
