/* ================== CARRITO DE COMPRAS - ESTILOS ================== */

:root {
    --gold: #c9a24d;
    --gold-light: #deb887;
    --gold-dark: #9d8344;
    --bg-dark: #1a1817;
    --bg-darker: #0f0d0b;
    --bg-surface: #2a2723;
    --text-light: #f7f7f7;
    --white: #ffffff;
    --text-dark: #1a1a1a;
}

/* ================== BOTÓN DEL CARRITO EN HEADER ================== */
.cart-toggle-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.cart-toggle-btn:hover {
    color: var(--gold);
    transform: scale(1.1);
}

.cart-toggle-btn i {
    transition: all 0.3s ease;
}

.cart-toggle-btn:hover i {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* Badge de cantidad */
.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--gold);
    color: var(--bg-dark);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    animation: badgePulse 0.3s ease;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ================== MODAL DEL CARRITO ================== */
.cart-modal {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 450px;
    height: 100vh;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-surface) 100%);
    border-left: 2px solid var(--gold);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5), -5px 0 20px rgba(201, 162, 77, 0.2);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
    z-index: 2001;
}

.cart-modal-content {
    display: contents;
}

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

/* Overlay */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s ease;
    z-index: 1999;
}

.cart-overlay.open {
    background: rgba(0, 0, 0, 0.7);
    opacity: 1;
    pointer-events: all;
}

/* ================== ENCABEZADO DEL CARRITO ================== */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid var(--gold);
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    flex-shrink: 0;
}

.cart-header h2 {
    margin: 0;
    color: var(--text-light);
    font-size: 1.5rem;
    letter-spacing: 1px;
}

.close-cart-btn {
    background: none;
    border: none;
    color: var(--gold);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-cart-btn:hover {
    color: var(--gold-light);
    transform: rotate(90deg) scale(1.1);
}

/* ================== CONTENEDOR DE ITEMS ================== */
.cart-items-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0;
    min-height: 0;
}

.cart-items-container::-webkit-scrollbar {
    width: 8px;
}

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

.cart-items-container::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 4px;
}

.cart-items-container::-webkit-scrollbar-thumb:hover {
    background: var(--gold-light);
}

/* Carrito vacío */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-light);
    text-align: center;
    opacity: 0.7;
}

.cart-empty i {
    font-size: 3rem;
    color: var(--gold);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.cart-empty p {
    margin: 0;
    font-size: 1rem;
}

/* Lista de items */
.cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
}

/* ================== ITEM DEL CARRITO ================== */
.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto auto auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(201, 162, 77, 0.2);
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

/* ================== FOOTER DEL CARRITO (FIJO) - AGREGA ESTO ================== */
.cart-footer {
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    border-top: 2px solid var(--gold);
    padding: 1.5rem;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
}

/* Resumen del total */
.cart-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.cart-summary h3 {
    margin: 0;
    color: var(--text-light);
    font-size: 1.1rem;
}

.cart-total {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--gold);
}

/* Botones del carrito */
.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.btn-checkout, .btn-clear-cart {
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-checkout {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    color: var(--bg-darker);
}

.btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(201, 162, 77, 0.4);
}

.btn-clear-cart {
    background: transparent;
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-clear-cart:hover {
    background: rgba(255, 0, 0, 0.1);
    color: #ff6b6b;
}

/* ================== RESPONSIVE PARA MÓVIL - AGREGA ESTO ================== */
@media (max-width: 768px) {
    .cart-modal {
        max-width: 100%;
        width: 100%;
    }
    
    /* Header más compacto en móvil */
    .cart-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    .cart-header h2 {
        font-size: 1.3rem;
    }
    
    .close-cart-btn {
        width: 30px;
        height: 30px;
        font-size: 1.3rem;
    }
    
    /* Items container con altura fija para evitar scroll del modal completo */
    .cart-items-container {
        flex: 1;
        padding: 0.8rem 0;
        max-height: calc(100vh - 250px); /* Altura calculada */
        min-height: 200px; /* Altura mínima */
    }
    
    /* Items más compactos en móvil */
    .cart-item {
        grid-template-columns: 60px 1fr auto auto;
        gap: 0.8rem;
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    .cart-item-image {
        width: 60px;
        height: 60px;
    }
    
    /* Footer fijo en móvil */
    .cart-footer {
        padding: 1rem;
        position: sticky;
        bottom: 0;
        background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
        border-top: 2px solid var(--gold);
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
    }
    
    .cart-summary {
        margin-bottom: 1rem;
    }
    
    .cart-summary h3 {
        font-size: 1rem;
    }
    
    .cart-total {
        font-size: 1.2rem;
    }
    
    .btn-checkout, .btn-clear-cart {
        padding: 0.9rem;
        font-size: 0.95rem;
    }
}

/* Para móviles muy pequeños */
@media (max-width: 480px) {
    .cart-header {
        padding: 0.8rem;
    }
    
    .cart-header h2 {
        font-size: 1.1rem;
    }
    
    .cart-item {
        grid-template-columns: 50px 1fr auto auto;
        gap: 0.6rem;
        padding: 0.6rem;
        font-size: 0.85rem;
    }
    
    .cart-item-image {
        width: 50px;
        height: 50px;
    }
    
    .cart-footer {
        padding: 0.8rem;
    }
    
    .cart-summary h3 {
        font-size: 0.9rem;
    }
    
    .cart-total {
        font-size: 1.1rem;
    }
    
    .btn-checkout, .btn-clear-cart {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    .cart-actions {
        gap: 0.6rem;
    }
}


/* Ajustes pantallas medianas (tablets y laptops chicas) */
@media (min-width: 769px) and (max-width: 1199px) {
    .cart-modal {
        max-width: 530px;
    }

    .cart-items-container {
        padding: 1.2rem 0;
    }

    .cart-item {
        grid-template-columns: 85px 1fr auto auto;
        grid-auto-rows: auto;
        gap: 0.9rem;
        padding: 1rem 1.1rem;
        position: relative;
    }

    .cart-item-image {
        width: 85px;
        height: 85px;
        grid-row: 1 / 3;
    }

    .cart-item-details {
        grid-column: 2;
        grid-row: 1;
    }

    .cart-item-details h4 {
        font-size: 0.95rem;
    }

    .cart-item-price {
        font-size: 0.9rem;
    }

    .cart-item-quantity {
        grid-column: 2;
        grid-row: 2;
        gap: 0.35rem;
        width: fit-content;
    }

    .qty-btn {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .qty-input {
        width: 35px;
    }

    .cart-item-subtotal {
        grid-column: 3;
        grid-row: 1 / 3;
        font-size: 0.95rem;
        min-width: 70px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    .remove-item-btn {
        grid-column: 4;
        grid-row: 1 / 3;
        justify-self: center;
        align-self: center;
    }
}

/* Ajustes pantallas grandes (desktop) */
@media (min-width: 1200px) {
    .cart-modal {
        max-width: 560px;
    }

    .cart-items-container {
        padding: 1.3rem 0;
    }

    .cart-item {
        grid-template-columns: 100px 1fr auto auto 44px;
        gap: 1.2rem;
        padding: 1.1rem 1.2rem;
    }

    .cart-item-image {
        width: 100px;
        height: 100px;
    }

    .cart-item-details h4 {
        font-size: 1.05rem;
    }

    .cart-item-price {
        font-size: 1rem;
    }

    .cart-item-quantity {
        gap: 0.45rem;
    }

    .qty-btn {
        width: 32px;
        height: 32px;
    }

    .cart-item-subtotal {
        font-size: 1.05rem;
        min-width: 90px;
    }
}

.cart-item:hover {
    background: rgba(201, 162, 77, 0.08);
    border-color: var(--gold);
    box-shadow: 0 4px 15px rgba(201, 162, 77, 0.15);
}

/* Imagen del item */
.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Detalles del item */
.cart-item-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cart-item-details h4 {
    margin: 0;
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
}

.cart-item-price {
    margin: 0;
    color: var(--gold);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.discount-badge {
    background: rgba(201, 162, 77, 0.2);
    color: var(--gold);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Cantidad */
.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 0.3rem;
}

.qty-btn {
    background: none;
    border: none;
    color: var(--gold);
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background: rgba(201, 162, 77, 0.2);
    border-radius: 4px;
    transform: scale(1.1);
}

.qty-input {
    width: 40px;
    background: transparent;
    border: none;
    color: var(--text-light);
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.3rem 0;
}

.qty-input:focus {
    outline: none;
}

/* Subtotal */
.cart-item-subtotal {
    color: var(--gold-light);
    font-weight: 600;
    font-size: 0.95rem;
    text-align: right;
    min-width: 70px;
}

/* Botón eliminar */
.remove-item-btn {
    background: none;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-item-btn:hover {
    color: #ff5252;
    transform: scale(1.2);
}

/* ================== FOOTER DEL CARRITO ================== */
.cart-footer {
    padding: 1.5rem;
    border-top: 2px solid var(--gold);
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-shrink: 0;
    z-index: 10;
}

/* Total */
.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(201, 162, 77, 0.3);
}

.cart-total span:first-child {
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 500;
}

#cartTotalPrice {
    color: var(--gold-light);
    font-size: 1.3rem;
    font-weight: 700;
}

/* Botones */
.checkout-btn,
.continue-shopping-btn {
    padding: 0.85rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.checkout-btn {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    color: var(--bg-dark);
    box-shadow: 0 4px 15px rgba(201, 162, 77, 0.3);
}

.checkout-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(201, 162, 77, 0.4);
}

.checkout-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.continue-shopping-btn {
    background: transparent;
    color: var(--gold);
    border: 2px solid var(--gold);
}

.continue-shopping-btn:hover {
    background: rgba(201, 162, 77, 0.1);
    transform: translateY(-2px);
}

/* ================== NOTIFICACIÓN DE PRODUCTO AGREGADO ================== */
.product-added-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    color: var(--bg-dark);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 600;
    box-shadow: 0 8px 30px rgba(201, 162, 77, 0.4);
    animation: slideInRight 0.4s ease;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    z-index: 2002;
}

.product-added-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.product-added-notification i {
    font-size: 1.3rem;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ================== CHECKOUT MODAL ================== */
.checkout-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    padding: 20px;
}

.checkout-modal.open {
    opacity: 1;
    pointer-events: all;
}

.checkout-form {
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-surface) 100%);
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.checkout-form h2 {
    color: var(--text-light);
    margin: 0 0 1.5rem 0;
    text-align: center;
    font-size: 1.5rem;
}

.close-checkout-btn {
    position: absolute;
    top: 20px;
    right: 40px;
    background: none;
    border: none;
    color: var(--gold);
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-checkout-btn:hover {
    transform: rotate(90deg);
    color: var(--gold-light);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid rgba(201, 162, 77, 0.3);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-light);
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--gold);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 10px rgba(201, 162, 77, 0.3);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.delivery-options {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.delivery-option {
    flex: 1;
    position: relative;
}

.delivery-option input[type="radio"] {
    display: none;
}

.delivery-option label {
    display: block;
    padding: 1rem;
    border: 2px solid rgba(201, 162, 77, 0.3);
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 0;
}

.delivery-option input[type="radio"]:checked + label {
    border-color: var(--gold);
    background: rgba(201, 162, 77, 0.15);
    color: var(--gold);
}

.checkout-submit-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    color: var(--bg-dark);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(201, 162, 77, 0.3);
}

.checkout-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(201, 162, 77, 0.4);
}

.checkout-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ================== RESPONSIVE ================== */
@media (max-width: 768px) {
    .cart-toggle-btn {
        padding: 0.5rem 0.8rem;
        font-size: 1.3rem;
    }

    .cart-modal {
        max-width: 100%;
        width: 100%;
    }

    .cart-modal-content {
        display: contents;
    }

    .cart-item {
        grid-template-columns: 70px 1fr;
        grid-auto-rows: auto;
        gap: 0.7rem;
        padding: 0.9rem;
    }

    .cart-item-image {
        width: 70px;
        height: 70px;
        grid-column: 1;
        grid-row: 1 / 3;
    }

    .cart-item-details {
        grid-column: 2;
        grid-row: 1;
    }

    .cart-item-price {
        flex-wrap: wrap;
        row-gap: 0.2rem;
    }

    .cart-item-quantity {
        grid-column: 1 / span 2;
        grid-row: 3;
        width: fit-content;
        justify-self: start;
    }

    .cart-item-subtotal {
        grid-column: 2;
        grid-row: 2;
        text-align: left;
        font-size: 0.85rem;
    }

    .remove-item-btn {
        position: static;
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
    }

    .product-added-notification {
        bottom: 20px;
        right: 20px;
        left: 20px;
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }

    .checkout-form {
        padding: 1.5rem;
        margin: 20px;
    }

    .close-checkout-btn {
        top: 15px;
        right: 30px;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .cart-toggle-btn {
        padding: 0.5rem 0.6rem;
        font-size: 1.2rem;
    }

    .cart-footer {
        padding: 1rem 1.2rem;
        gap: 0.8rem;
    }

    .cart-modal {
        max-width: 100%;
    }

    .cart-modal-content {
        display: contents;
    }

    .cart-header h2 {
        font-size: 1.1rem;
    }

    .cart-item-image {
        width: 50px;
        height: 50px;
    }

    .cart-item-details h4 {
        font-size: 0.75rem;
    }

    .cart-item {
        grid-template-columns: 50px 1fr;
        gap: 0.5rem;
        padding: 0.7rem;
    }

    .cart-total {
        padding: 0.7rem 0;
        border-bottom: 1px solid rgba(201, 162, 77, 0.3);
    }

    #cartTotalPrice {
        font-size: 1.1rem;
    }

    .cart-item-subtotal {
        grid-column: 2;
        grid-row: 2;
        font-size: 0.8rem;
    }

    .checkout-btn,
    .continue-shopping-btn {
        padding: 0.65rem 1rem;
        font-size: 0.8rem;
    }

    .checkout-form {
        padding: 1rem;
        max-width: 100%;
        margin: 10px;
    }

    .checkout-form h2 {
        font-size: 1.2rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .delivery-options {
        flex-direction: column;
    }

    .close-checkout-btn {
        top: 10px;
        right: 20px;
    }
}
