/*==================================================
  LUCID CART OVERLAY
==================================================*/

.lucid-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 9997;
}

.lucid-cart-overlay.lucid-cart-open,
.lucid-cart-overlay.active {
    opacity: 1;
    visibility: visible;
}


/*==================================================
  LUCID CART PANEL
==================================================*/

.lucid-cart-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: clamp(280px, 88vw, 420px);
    max-width: 100%;
    height: 100vh;
    height: 100dvh; /* Solves mobile Safari bar overlap */
    background: #ffffff;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 9998;
    box-sizing: border-box;
}

.lucid-cart-panel.lucid-cart-open,
.lucid-cart-panel.active {
    right: 0;
}

/*==================================================
  CART HEADER
==================================================*/

.lucid-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(12px, 3vw, 20px);
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
    flex-shrink: 0; /* Prevents header from collapsing */
}

.lucid-cart-header h2 {
    font-size: clamp(16px, 4vw, 22px);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #0f172a;
    font-weight: 700;
}

.lucid-cart-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: clamp(20px, 5vw, 28px);
    color: #64748b;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.2s ease, background-color 0.2s ease;
    flex-shrink: 0;
}

@media (hover: hover) {
    .lucid-cart-close:hover {
        color: #0f172a;
        background-color: #f1f5f9;
    }
}

/*==================================================
  CART BODY
==================================================*/

.lucid-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: clamp(12px, 3vw, 20px);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.lucid-cart-empty {
    text-align: center;
    margin: auto 0;
    padding: 40px 0;
    color: #94a3b8;
}

.lucid-cart-empty i {
    font-size: clamp(40px, 10vw, 70px);
    margin-bottom: 16px;
    display: block;
}

.lucid-cart-empty p {
    font-size: clamp(14px, 2.5vw, 16px);
    margin: 0;
}

/*==================================================
  CART ITEM (FIXED FLEXBOX GRID)
==================================================*/

.lucid-cart-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #e5e7eb;
    width: 100%;
    box-sizing: border-box;
}

.lucid-cart-image {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 8px;
    background: #f8fafc;
    padding: 4px;
    flex-shrink: 0;
}

.lucid-cart-details {
    flex: 1;
    min-width: 0; /* Critical: allows child text wrapping/truncation */
}

.lucid-cart-details h4 {
    margin: 0 0 4px 0;
    font-size: clamp(13px, 3vw, 15px);
    color: #0f172a;
    font-weight: 600;
    line-height: 1.3;
    /* Clean 2-line title wrap */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lucid-cart-details p {
    font-weight: 700;
    color: #2563eb;
    margin: 0 0 2px 0;
    font-size: clamp(13px, 2.5vw, 15px);
}

.lucid-cart-details small {
    color: #64748b;
    font-size: clamp(11px, 2vw, 12px);
    display: block;
}

.lucid-cart-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.lucid-cart-qty {
    display: flex;
    align-items: center;
    gap: 4px;
}

.lucid-cart-plus,
.lucid-cart-minus {
    width: 28px;
    height: 28px;
    border: none;
    background: #2563eb;
    color: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
}

@media (hover: hover) {
    .lucid-cart-plus:hover,
    .lucid-cart-minus:hover {
        background: #1d4ed8;
    }
}

.lucid-cart-plus:active,
.lucid-cart-minus:active {
    transform: scale(0.92);
}

.lucid-cart-quantity {
    min-width: 18px;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    color: #0f172a;
}

.lucid-cart-remove {
    border: none;
    background: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 16px;
    padding: 2px 4px;
    transition: color 0.2s ease;
}

@media (hover: hover) {
    .lucid-cart-remove:hover {
        color: #dc2626;
    }
}

/*==================================================
  CART FOOTER & CHECKOUT BUTTON
==================================================*/

.lucid-cart-footer {
    padding: clamp(14px, 3vw, 20px);
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
    flex-shrink: 0; /* Ensures footer stays anchored at bottom */
}

.lucid-cart-footer h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 clamp(10px, 2vw, 16px) 0;
    font-size: clamp(16px, 3.5vw, 20px);
    color: #0f172a;
}

.lucid-cart-checkout-btn {
    width: 100%;
    padding: clamp(12px, 2.5vw, 16px);
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: clamp(14px, 3vw, 16px);
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    transition: background-color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
    box-sizing: border-box;
}

@media (hover: hover) {
    .lucid-cart-checkout-btn:hover {
        background: #1d4ed8;
        transform: translateY(-1px);
        box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
    }
}

.lucid-cart-checkout-btn:active {
    transform: scale(0.98);
}

/*==================================================
  RESPONSIVE BREAKPOINTS
==================================================*/

@media (max-width: 480px) {
    .lucid-cart-panel {
        width: 100vw; /* Takes full width on small screens */
    }

    .lucid-cart-item {
        gap: 10px;
    }

    .lucid-cart-image {
        width: 54px;
        height: 54px;
    }
}