/**
 * Cart Drawer (Side Cart)
 * bg.olympusplus.com
 */

/* ── Overlay ─────────────────────────────── */
.cart-drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 9990;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.cart-drawer-overlay.is-open {
    opacity: 1;
    pointer-events: all;
}

/* ── Drawer Panel ────────────────────────── */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    bottom: 0;
    width: 400px;
    z-index: 9991;
    background: var(--bg-white, #ffffff);
    box-shadow: -4px 0 40px rgba(0, 0, 0, 0.12);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: 100vw;
    padding: 0;
}

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

/* ── Success Banner (between items and footer) ── */
.cart-drawer__success {
    background: #edf7f1;
    border-top: 0.5px solid #c5e8d4;
    padding: 10px 24px;
    text-align: center;
    font-size: 12px;
    font-weight: 400;
    color: #2d7a4f;
    display: none;
    flex-shrink: 0;
}

.cart-drawer__success.is-visible {
    display: block;
}

/* ── Drawer Header ───────────────────────── */
.cart-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.cart-drawer__title {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.cart-drawer__title-text {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-dark, #1a1a1a);
}

.cart-drawer__title-count {
    font-size: 12px;
    font-weight: 300;
    color: var(--text-light, #888888);
}

.cart-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    background: transparent;
    color: var(--text, #5e5e5e);
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
    padding: 0;
    line-height: 1;
}

.cart-drawer__close:hover {
    border-color: var(--text-dark, #1a1a1a);
    color: var(--text-dark, #1a1a1a);
}

/* ── Free Shipping Bar ───────────────────── */
.cart-drawer__shipping-bar {
    background: #f8fbf9;
    padding: 10px 20px;
    flex-shrink: 0;
}

.cart-drawer__shipping-text {
    font-size: 11px;
    font-weight: 400;
    color: #5e5e5e;
    margin-bottom: 6px;
}

.cart-drawer__shipping-track {
    height: 3px;
    background: #edf7f1;
    border-radius: 2px;
    overflow: hidden;
}

.cart-drawer__shipping-fill {
    height: 100%;
    background: #2d7a4f;
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* ── Cart Items ──────────────────────────── */
.cart-drawer__items {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    -webkit-overflow-scrolling: touch;
}

.cart-drawer__item {
    display: grid;
    grid-template-columns: 68px 1fr auto;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
    align-items: start;
    width: 100%;
}

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

.cart-drawer__item-img {
    width: 68px;
    min-width: 68px;
    height: 68px;
    border-radius: 8px;
    background: #f2f7f3;
    border: 0.5px solid rgba(0, 0, 0, 0.08);
    display: block;
    flex-shrink: 0;
    overflow: hidden;
}

.cart-drawer__item-img img {
    width: 68px;
    height: 68px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

.cart-drawer__item-info {
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cart-drawer__item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark, #1a1a1a);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
}

.cart-drawer__item-name:hover {
    color: #2d7a4f;
}

.cart-drawer__item-variation {
    font-size: 12px;
    font-weight: 300;
    color: var(--text-light, #888888);
}

/* Qty stepper */
.cart-drawer__qty {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.cart-drawer__qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 0.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    background: var(--bg-light, #f5f7f9);
    color: var(--text-dark, #1a1a1a);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.cart-drawer__qty-btn:hover {
    background: #edf7f1;
    border-color: rgba(0, 0, 0, 0.15);
}

.cart-drawer input.cart-drawer__qty-val[type="number"] {
    width: 36px !important;
    height: 28px !important;
    text-align: center !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: var(--text-dark, #1a1a1a) !important;
    border: 0.5px solid rgba(0, 0, 0, 0.08) !important;
    border-radius: 4px !important;
    background: var(--bg-white, #ffffff) !important;
    -moz-appearance: textfield !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.cart-drawer__qty-val::-webkit-inner-spin-button,
.cart-drawer__qty-val::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Price + Remove */
.cart-drawer__item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.cart-drawer__item-price {
    font-size: 15px;
    font-weight: 500;
    color: #2d7a4f;
    white-space: nowrap;
}

.cart-drawer__item-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--text-light, #888888);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.cart-drawer__item-remove:hover {
    color: #e55;
}

/* ── Empty State ─────────────────────────── */
.cart-drawer__empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.cart-drawer__empty dotlottie-player {
    width: 180px;
    height: 180px;
    margin-bottom: 8px;
}

.cart-drawer__empty-text {
    font-size: 14px;
    font-weight: 300;
    color: var(--text-light, #888888);
    margin-bottom: 20px;
}

.cart-drawer__empty-btn {
    display: inline-block;
    padding: 10px 24px;
    background: #2d7a4f;
    color: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s ease;
}

.cart-drawer__empty-btn:hover {
    background: #235f3d;
    color: #fff;
}

/* ── Drawer Footer ───────────────────────── */
.cart-drawer__footer {
    border-top: 0.5px solid rgba(0, 0, 0, 0.08);
    padding: 20px 24px;
    background: var(--bg-white, #ffffff);
    flex-shrink: 0;
}

.cart-drawer__subtotal {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 4px;
}

.cart-drawer__subtotal-label {
    font-size: 15px;
    font-weight: 500;
    color: var(--text, #5e5e5e);
}

.cart-drawer__subtotal-value {
    font-size: 16px;
    font-weight: 500;
    color: #2d7a4f;
}

.cart-drawer__subtotal-note {
    font-size: 11px;
    font-weight: 300;
    color: var(--text-light, #888888);
    margin-bottom: 16px;
}

.cart-drawer__checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px 24px;
    background: #2d7a4f;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease;
    text-align: center;
    line-height: 1;
}

.cart-drawer__checkout-btn:hover {
    background: #235f3d;
    color: #fff;
}

.cart-drawer__continue-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 11px;
    margin-top: 8px;
    background: transparent;
    border: 0.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 300;
    color: var(--text, #5e5e5e);
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
    text-align: center;
    line-height: 1;
}

.cart-drawer__continue-btn:hover {
    border-color: #2d7a4f;
    color: #2d7a4f;
}

/* ── Floating Button ─────────────────────── */
@keyframes fab-enter {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.cart-floating-btn {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9989;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #2d7a4f;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 16px rgba(45, 122, 79, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    padding: 0;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transform: scale(0);
}

.cart-floating-btn.is-visible {
    opacity: 1;
    pointer-events: all;
    animation: fab-enter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.cart-floating-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(45, 122, 79, 0.45);
}

.cart-floating-btn__count {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    background: #fff;
    color: #2d7a4f;
    font-size: 10px;
    font-weight: 500;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0 4px;
}

/* ── Loading state for qty/remove ────────── */
.cart-drawer__item.is-updating {
    opacity: 0.5;
    pointer-events: none;
}

/* ── Scrollbar styling ───────────────────── */
.cart-drawer__items::-webkit-scrollbar {
    width: 4px;
}

.cart-drawer__items::-webkit-scrollbar-track {
    background: transparent;
}

.cart-drawer__items::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 480px) {
    .cart-drawer {
        width: 100%;
    }

    .cart-floating-btn {
        right: 16px;
        bottom: 80px;
    }
}
