/* === Cart Drawer Styles === */

/* Overlay oscuro detrás del carrito */
#cartDrawerOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#cartDrawerOverlay.active {
    opacity: 1;
    visibility: visible;
}

/* Panel del Carrito */
#cartDrawer {
    position: fixed;
    top: 0;
    right: -450px;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: #ffffff;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#cartDrawer.active {
    right: 0;
}

/* Header del Carrito */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #f0f0f0;
}

.cart-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-family: var(--font-heading);
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-cart-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.close-cart-btn:hover {
    background: #f5f5f5;
    color: #333;
}

/* Cuerpo del Carrito (Lista de items) */
.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 25px;
}

.cart-empty-message {
    text-align: center;
    color: #888;
    margin-top: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.cart-empty-message svg {
    color: #ddd;
}

.cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Item del Carrito */
.cart-item {
    display: flex;
    gap: 15px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f5f5f5;
    position: relative;
}

.cart-item-img {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    object-fit: cover;
    background: #f9f9f9;
}

.cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cart-item-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 5px 0;
    line-height: 1.2;
    padding-right: 25px; /* Spacing for delete btn */
}

.cart-item-variant {
    font-size: 0.8rem;
    color: #777;
    margin-bottom: 10px;
}

.cart-item-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

.cart-item-locked-price {
    font-size: 0.85rem;
    color: #f39c12;
    font-weight: 500;
}

.cart-item-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

/* Selector de Cantidad */
.qty-selector {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 20px;
    overflow: hidden;
}

.qty-btn {
    background: none;
    border: none;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #555;
    transition: background 0.2s;
}

.qty-btn:hover {
    background: #e0e0e0;
}

.qty-value {
    width: 30px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

/* Botón Eliminar */
.remove-item-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.remove-item-btn:hover {
    color: #e74c3c;
}

/* Footer del Carrito */
.cart-footer {
    padding: 20px 25px;
    background: #fafafa;
    border-top: 1px solid #eee;
}

.cart-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cart-subtotal span {
    font-size: 1.1rem;
    color: #555;
    font-weight: 500;
}

.cart-subtotal-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.cart-footer-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-checkout {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-checkout-wa {
    background: #25D366;
    color: white;
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-checkout-wa:hover {
    background: #1ebc5a;
}

/* Icono del Carrito en el Header */
.nav-cart-btn {
    position: relative;
    background: none;
    border: none;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    margin-left: 15px;
}

.nav-cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

@media (max-width: 768px) {
    #cartDrawer {
        width: 100vw;
        max-width: 100vw;
        right: -100vw;
    }
}
