/* ============================================================
   Carrito - Estilos (carrito.css)
   ============================================================ */

.cart-page {
    padding: calc(72px + 2.5rem) 1.5rem 2.5rem;
    max-width: 900px;
    margin: 0 auto;
}

/* Cart overlay - oculto por defecto */
.cart-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cart-overlay.open {
    pointer-events: all;
    visibility: visible;
    opacity: 1;
}

.cart-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.cart-drawer {
    position: absolute;
    top: 0;
    right: 0;
    height: 100dvh;
    /* Usa dvh para respetar barras de navegación móviles, o vh */
    max-height: 100vh;
    /* Límite estricto */
    width: 100%;
    max-width: 420px;
    background: #111111;
    border-left: 1px solid rgba(201, 168, 76, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    /* overflow: hidden;  <-- Quitamos esto, el overflow va en .cart-items */
}

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

/* Header */
.cart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.cart-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--white-pure);
    margin-bottom: 2px;
}

.cart-header p {
    font-size: 12px;
    color: var(--gray);
}

.cart-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--white-pure);
    cursor: pointer;
    transition: border-color 0.3s, color 0.3s;
    flex-shrink: 0;
}

.cart-close-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* Items list */
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(201, 168, 76, 0.2) transparent;
}

/* Empty state */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--gray);
    text-align: center;
    padding: 64px 0;
    flex: 1;
}

.cart-empty .material-symbols-outlined {
    font-size: 52px;
    opacity: 0.25;
    color: var(--gold);
}

.cart-empty p {
    font-size: 14px;
    color: var(--gray);
}

/* Cart item */
.cart-item {
    display: flex;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cart-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.cart-item-img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 4px;
}

.cart-item-header h3 {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--white-pure);
}

.cart-item-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold);
    white-space: nowrap;
}

.cart-item-note {
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 10px;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-qty {
    display: flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.cart-qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.04);
    border: none;
    color: var(--white-pure);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.cart-qty-btn:hover {
    background: rgba(201, 168, 76, 0.15);
    color: var(--gold);
}

.cart-qty-btn .material-symbols-outlined {
    font-size: 14px;
}

.cart-qty-value {
    padding: 0 12px;
    font-size: 13px;
    font-weight: 700;
    min-width: 32px;
    text-align: center;
    color: var(--white-pure);
}

.cart-remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.cart-remove-btn:hover {
    color: #ff5555;
    background: rgba(255, 85, 85, 0.1);
}

.cart-remove-btn .material-symbols-outlined {
    font-size: 18px;
}

/* Instructions */
.cart-instructions {
    padding-top: 8px;
}

.cart-instructions textarea {
    min-height: 80px;
    resize: none;
    margin-top: 8px;
}

/* Summary */
.cart-summary {
    padding: 20px 24px 28px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.cart-discount {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.cart-discount .form-input {
    flex: 1;
}

.cart-discount-btn {
    padding: 0 16px;
    background: rgba(201, 168, 76, 0.1);
    border: 1px solid rgba(201, 168, 76, 0.3);
    color: var(--gold);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.cart-discount-btn:hover {
    background: rgba(201, 168, 76, 0.2);
}

.cart-totals {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--gray-light);
}

.cart-total-final {
    font-size: 15px;
    font-weight: 700;
    color: var(--white-pure);
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 4px;
}

.cart-total-amount {
    color: var(--gold);
    font-size: 1.1rem;
}

.cart-checkout-btn {
    width: 100%;
    justify-content: center;
    margin-bottom: 12px;
    padding: 14px;
    font-size: 14px;
}

.cart-secure {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 11px;
    color: var(--gray);
}

.cart-secure .material-symbols-outlined {
    font-size: 14px;
}