/* ============================================================================
   CARRITO DE COMPRAS
   ============================================================================ */

.cart-icon-wrapper {
    position: relative;
}

.cart-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    position: relative;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-icon-btn:hover {
    color: var(--primary-color);
}

.cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Overlay de fondo al abrir el carrito */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cart-sidebar {
    position: fixed;
    top: 80px;
    right: -450px;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: auto !important;
    max-height: calc(88vh - 80px);
    background: var(--bg-primary);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18), 0 2px 10px rgba(0, 0, 0, 0.08);
    z-index: 10001 !important;
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1), top 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

/* Ajustar el carrito cuando el announcement bar está visible */
body.has-announcement-bar .cart-sidebar {
    top: calc(var(--announcement-bar-height, 40px) + 80px);
    max-height: calc(88vh - var(--announcement-bar-height, 40px) - 80px);
}

.cart-sidebar.active {
    right: 20px;
}

.cart-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.cart-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.cart-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.cart-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.cart-items {
    flex: 0 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    min-height: 0;
    max-height: calc(88vh - 220px);
}

.cart-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.cart-empty svg {
    margin-bottom: 1rem;
    opacity: 0.3;
}

.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    background: var(--bg-secondary);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.cart-item-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.3;
}

.cart-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cart-item-name {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

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

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cart-qty-btn {
    width: 28px;
    height: 28px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: var(--transition);
}

.cart-qty-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.cart-qty {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 24px;
    text-align: center;
}

.cart-item-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    align-self: flex-start;
}

.cart-item-remove:hover {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
}

.cart-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
    margin-top: auto;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

.cart-checkout {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
}

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

/* ============================================================================
   MODAL DE PREVISUALIZACIÓN
   ============================================================================ */

.product-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: visible;
    box-shadow: var(--shadow-xl);
    z-index: 1;
    padding-bottom: 40px;
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--bg-tertiary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--text-primary);
    color: white;
}

.modal-product {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
    padding-bottom: 2rem;
    overflow: visible;
    position: relative;
    align-items: start;
}

/* Responsive: en mobile pasa a una sola columna */
@media (max-width: 768px) {
    .modal-product {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   MODAL PRODUCT IMAGE WRAPPER (Contenedor izquierdo)
   ============================================================================ */
.modal-product-image-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    grid-column: 1;
}

/* ============================================================================
   MODAL PRODUCT IMAGE (Solo imagen / carrusel)
   ============================================================================ */
.modal-product-image {
    position: relative;
    width: 100%;
    min-height: 300px;
    max-height: 400px;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-product-image .web-modal-product-image-carousel {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: visible;
}

.modal-product-image .web-modal-product-image-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    border-radius: 8px;
    background: var(--bg-tertiary);
}

.modal-product-image .web-modal-carousel-item {
    width: 100%;
    height: 100%;
    display: none;
}

.modal-product-image .web-modal-carousel-item.active {
    display: block;
}

.modal-product-image .web-modal-carousel-item img {
    width: 100%;
    height: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
}

/* ============================================================================
   MODAL CAROUSEL CONTROLS (Botones DEBAJO de la imagen)
   ============================================================================ */
.modal-carousel-controls {
    position: static;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 14px;
    padding: 0;
    background: transparent;
    align-items: center;
}

/* Estilos aplicados directamente a los botones hijos reales */
.modal-carousel-controls > button,
.modal-carousel-controls button.modal-carousel-btn {
    width: 42px !important;
    height: 42px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 18px !important;
    color: #ff6fae !important;
    font-weight: bold !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    position: static !important;
    z-index: auto !important;
    overflow: visible !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.modal-carousel-controls > button:hover,
.modal-carousel-controls button.modal-carousel-btn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25) !important;
    background: rgba(255, 255, 255, 1) !important;
}

/* Estilos para iconos dentro de los botones */
.modal-carousel-controls svg,
.modal-carousel-controls i {
    font-size: 18px;
    color: #ff6fae;
}

/* Contenedor de dots (NO debe tener estilo de botón) */
.modal-carousel-controls .modal-carousel-dots {
    width: auto;
    height: auto;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    cursor: default;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    flex: 1;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.modal-carousel-controls .modal-carousel-dots:hover {
    transform: none;
    box-shadow: none;
    background: transparent;
}

/* Compatibilidad con clases específicas */
.modal-carousel-btn {
    width: 42px !important;
    height: 42px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 18px !important;
    color: #ff6fae !important;
    font-weight: bold !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
}

.modal-carousel-btn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25) !important;
    background: rgba(255, 255, 255, 1) !important;
}

.modal-carousel-dots {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.modal-carousel-dots .web-modal-carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ddd;
    display: inline-block;
    margin: 0 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.modal-carousel-dots .web-modal-carousel-dot.active {
    background: #ff9ec4;
}

/* ============================================================================
   MODAL PRODUCT INFO (Lado derecho, info del producto)
   ============================================================================ */
.modal-product-info {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    max-height: 90vh;
}

.modal-product-image {
    width: 100%;
    min-height: auto;
    border-radius: var(--radius-lg);
    overflow: visible !important;
    background: transparent;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    position: relative;
    padding-bottom: 0;
    margin-bottom: 0;
    z-index: 1;
}

.modal-product-image .web-modal-product-image-carousel {
    width: 100%;
    overflow: visible !important;
    position: relative;
    z-index: 1;
    margin-bottom: 0;
}

.modal-product-image .web-modal-product-image-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    z-index: 1;
    margin-bottom: 0;
    border-radius: 8px;
    background: var(--bg-tertiary);
}


.modal-product-image img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 20px;
}

.modal-product-image .web-modal-product-image-carousel {
    width: 100%;
    overflow: visible !important;
    position: relative;
    z-index: 1;
    margin-bottom: 0;
}

.modal-product-image .web-modal-product-image-carousel > div:first-child {
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 0;
}

.modal-product-image .web-modal-product-image-carousel .web-modal-carousel-controls {
    overflow: visible !important;
    position: relative;
    z-index: 100;
    margin-top: 25px;
    margin-bottom: 0;
    padding: 20px 10px;
    width: 100%;
    box-sizing: border-box;
    background: transparent;
}

/* Estilos antiguos eliminados - usar los nuevos de .modal-carousel-controls */

.modal-product-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-product-category {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modal-product-name {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-product-description {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.modal-product-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

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

.detail-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.detail-value {
    font-weight: 600;
    color: var(--text-primary);
}

.detail-value.price {
    font-size: 1.25rem;
    color: var(--primary-color);
}

.modal-product-actions {
    margin-top: auto;
}

.modal-product-actions .btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* ============================================================================
   BOTONES DE PRODUCTO
   ============================================================================ */

.product-actions {
    display: flex;
    gap: 0.525rem;
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--border-color);
}

.btn-view,
.btn-add-cart {
    flex: 1;
    padding: 0.438rem 0.7rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.613rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-family: inherit;
}

.btn-view {
    background: var(--bg-primary);
    color: var(--text-secondary);
}

.btn-view:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(42, 116, 255, 0.05);
}

.btn-add-cart {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-add-cart:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

/* ============================================================================
   NOTIFICACIONES
   ============================================================================ */

.notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--text-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 1024px) {
    .cart-sidebar {
        width: 90%;
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .cart-sidebar {
        top: 70px;
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
        height: auto !important;
        max-height: calc(85vh - 70px);
        border-radius: 16px;
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
        transform: translateY(-15px);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.3s ease, opacity 0.3s ease, top 0.3s ease;
    }
    
    /* Ajustar el carrito cuando el announcement bar está visible en tablet */
    body.has-announcement-bar .cart-sidebar {
        top: calc(var(--announcement-bar-height, 36px) + 70px);
        max-height: calc(85vh - var(--announcement-bar-height, 36px) - 70px);
    }

    .cart-sidebar.active {
        right: 12px;
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .cart-header {
        flex-shrink: 0;
        padding: 1rem 1.25rem;
    }

    .cart-header h2,
    .cart-header h3 {
        font-size: 1.25rem;
    }

    .cart-items {
        flex: 0 1 auto;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 0.875rem;
        max-height: calc(85vh - 200px);
    }
    
    .cart-footer {
        flex-shrink: 0;
        margin-top: auto;
        padding: 1rem 1.25rem;
    }

    .cart-item {
        padding: 0.875rem;
        gap: 0.75rem;
    }

    .cart-item-image {
        width: 80px;
        height: 80px;
        flex-shrink: 0;
    }

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

    .cart-item-name {
        font-size: 0.9375rem;
    }

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

    .cart-item-controls {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }

    .quantity-control {
        gap: 0.375rem;
    }

    .qty-btn {
        width: 32px;
        height: 32px;
        min-height: 32px;
        font-size: 1rem;
    }

    .qty-input {
        width: 40px;
        padding: 0.375rem;
        font-size: 0.875rem;
    }

    .remove-item-btn {
        padding: 0.5rem;
        min-height: 32px;
        width: 32px;
        height: 32px;
    }

    .cart-footer {
        padding: 1rem;
    }

    .cart-total {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    .btn-checkout {
        padding: 1rem;
        font-size: 1rem;
        min-height: 50px;
    }

    .modal-product {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .modal-product-name {
        font-size: 1.375rem;
    }

    .modal-product-price {
        font-size: 1.5rem;
    }

    .product-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn-view,
    .btn-add-cart {
        width: 100%;
        padding: 1rem;
        min-height: 48px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .cart-sidebar {
        top: 65px;
        left: 8px;
        right: 8px;
        max-height: calc(85vh - 65px);
        border-radius: 14px;
    }
    
    /* Ajustar el carrito cuando el announcement bar está visible en móvil */
    body.has-announcement-bar .cart-sidebar {
        top: calc(var(--announcement-bar-height, 32px) + 65px);
        max-height: calc(85vh - var(--announcement-bar-height, 32px) - 65px);
    }

    .cart-sidebar.active {
        right: 8px;
    }

    .cart-header {
        padding: 0.875rem 1rem;
        flex-shrink: 0;
    }

    .cart-header h2,
    .cart-header h3 {
        font-size: 1.125rem;
    }

    .cart-items {
        flex: 0 1 auto;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 0.75rem;
        max-height: calc(85vh - 180px);
    }
    
    .cart-footer {
        flex-shrink: 0;
        margin-top: auto;
        padding: 0.875rem 1rem;
    }

    .cart-item {
        flex-direction: row;
        padding: 0.75rem;
        gap: 0.625rem;
    }

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

    .cart-item-info {
        gap: 0.25rem;
    }

    .cart-item-name {
        font-size: 0.875rem;
        line-height: 1.3;
    }

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

    .cart-item-controls {
        flex-direction: column;
        gap: 0.375rem;
    }

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

    .qty-input {
        width: 36px;
        padding: 0.25rem;
        font-size: 0.8125rem;
    }

    .remove-item-btn {
        padding: 0.4375rem;
        min-height: 28px;
        width: 28px;
        height: 28px;
    }

    .cart-footer {
        padding: 0.875rem;
    }

    .cart-total {
        font-size: 1.125rem;
    }

    .btn-checkout {
        padding: 0.875rem;
        font-size: 0.9375rem;
        min-height: 48px;
    }

    .modal-product {
        padding: 1rem;
    }

    .modal-product-name {
        font-size: 1.25rem;
    }

    .modal-product-price {
        font-size: 1.375rem;
    }

    .notification {
        right: 0.75rem;
        left: 0.75rem;
        bottom: 0.75rem;
        padding: 0.875rem;
        font-size: 0.875rem;
    }
}


