/* ==========================================
   CONTENEDOR PRINCIPAL (DRAWER)
   ========================================== */
#cartPreview {
    position: fixed;
    right: 0;
    top: 0;
    width: 420px; 
    max-width: 95%;
    height: 100vh;
    background-color: #ffffff;
    z-index: 11000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
}
#cartPreview.show {
    transform: translateX(0);
}

/* ==========================================
   CABECERA Y FOOTER
   ========================================== */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.cart-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.cart-footer {
    padding: 20px 25px;
    border-top: 1px solid #f0f0f0;
    background-color: #ffffff; /* Evita transparencias al pasar ítems por detrás */
    flex-shrink: 0; /* Impide que el scroll empuje este contenedor hacia abajo */
    
    /* Soporte para barras de navegación del sistema en teléfonos como el S24 */
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    margin-top: 0;
    margin-bottom: 16px;
}

#checkoutBtn {
    width: 100%;
    background-color: #bfa36a;
    color: white;
    border: none;
    padding: 15px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

#checkoutBtn:active {
    background-color: #a68b54;
}

/* ==========================================
   LISTA DE ITEMS (EL CORRECTOR)
   ========================================== */

.cart-items {
    flex: 1;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch; /* Mantiene el scroll rápido nativo */
    padding: 10px 25px;

    /* Evita que el "efecto rebote" mueva los contenedores adyacentes */
    overscroll-behavior-y: contain; 
}

.cart-item {
    display: grid;
    /* Columna 1: Imagen (80px) | Columna 2: Texto (Flexible) | Columna 3: Remove (Auto) */
    grid-template-columns: 90px 1fr auto;
    align-items: center; /* CENTRA TODO VERTICALMENTE (Imagen y Remove) */
    gap: 20px; /* ESPACIO ENTRE IMAGEN E INFORMACIÓN */
    padding: 20px 0;
    border-bottom: 1px solid #f0f0f0;
    width: 100%;
}

.cart-item-img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    text-align: left;
}

/* TIPOGRAFÍA EXACTA */
.cart-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.2;
}

.cart-size {
    font-size: 15px;
    color: #999;
    margin-top: 20px
}

.cart-price {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-top: 3px;
    margin-bottom: 10x;
}

/* Controles de Cantidad (Estilo compacto de la captura) */
.qty-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qty-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #333;
    padding: 0 5px;
}

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

/* BOTÓN REMOVER (TEXTO SIMPLE) */
.remove-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    align-self: center;
    padding: 10px 0; /* Área de clic cómoda */
    transition: color 0.2s;
}

.remove-btn:hover {
    color: #000;
    text-decoration: underline;
}

/* BOTÓN CERRAR (La X arriba a la derecha) */
#closeCartBtn {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
}

#closeCartBtn:hover {
  color: #e7d882;
}

/* ==========================================
   ESTADO VACÍO (UNIFICADO)
   ========================================== */

.cart-empty-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1; /* Ocupa todo el espacio disponible en el panel */
    padding: 40px 20px;
    width: 100%; /* Se limita al ancho del #cartPreview */
    box-sizing: border-box;
}

.cart-empty-img {
    width: 300px; /* Tamaño elegante para boutique */
    height: auto;
    margin-bottom: 25px;
    display: block;
    /* Tu filtro dorado característico */
    filter: invert(72%) sepia(35%) saturate(1006%) hue-rotate(345deg) brightness(88%) contrast(85%);
    opacity: 0.8;
    transition: transform 0.3s ease;
}

.cart-empty-container h2 {
    font-family: 'Playfair Display', serif; /* Tu fuente de lujo */
    font-size: 1.4rem;
    color: #3d342d;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cart-empty-container p {
    font-size: 0.9rem;
    color: #8a7344;
    margin-bottom: 30px;
    max-width: 250px;
    line-height: 1.5;
}

/* El botón Continue Shopping */
.cart-empty-container .primary-btn {
    width: 100%;
    max-width: 280px;
    background: #c5a253;
    color: white;
    padding: 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
}

.cart-empty-container .primary-btn:hover {
    background-color: #a68b54;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(191, 163, 106, 0.3);
}

.drawer-content {
    height: 100%;
    overflow: hidden !important; /* Desactivamos el scroll viejo de todo el bloque */
}

.cart-drawer-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
}