/**
 * Estilos para el Carrito Flotante - SaborLab
 */

/* Wrapper del botón flotante - Posición fija */
#floating-cart-btn {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2c5aa0 0%, #4a7bc8 100%);
    color: #FFFFFF;
    border: 2px solid #1e3d73;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(44, 90, 160, 0.4);
    font-size: 1.5rem;
    will-change: transform;
    margin: 0;
    padding: 0;
}

#floating-cart-btn:hover {
    background: linear-gradient(135deg, #1e3d73 0%, #2c5aa0 100%);
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 8px 30px rgba(44, 90, 160, 0.6);
    color: #FFFFFF !important; /* Texto siempre blanco */
}

#floating-cart-btn:active {
    transform: translateY(-2px) scale(1.05);
}

#floating-cart-btn i {
    color: #FFFFFF;
    position: relative;
    z-index: 1;
}

/* Badge de contador - Centrado exactamente en el centro del botón */
#floating-cart-btn .cart-badge,
.cart-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #28a745 !important;
    color: white !important;
    border-radius: 50%;
    min-width: 28px;
    width: 28px;
    height: 28px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.75rem !important;
    font-weight: bold !important;
    border: 3px solid #FFFFFF !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5) !important;
    padding: 0 !important;
    box-sizing: border-box;
    line-height: 1 !important;
    z-index: 10001 !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: none;
    /* Centrado perfecto del texto */
    text-align: center !important;
    margin: 0 !important;
    /* Asegurar que el contenido esté centrado */
    flex-shrink: 0;
    /* Asegurar que el texto esté centrado */
    overflow: visible;
}

/* Badge con números grandes (más de 9) */
.cart-badge.has-double-digit {
    min-width: 32px;
    width: auto;
    height: 28px;
    border-radius: 14px;
    padding: 0 5px !important;
    /* Asegurar centrado perfecto en números de dos dígitos */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    /* Mantener centrado exacto en el centro */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Badge cuando está en 0 - Oculto completamente */
.cart-badge.is-zero {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Badge con items - Verde brillante */
.cart-badge.has-items {
    background: #28a745;
    opacity: 1;
    animation: pulseBadge 0.5s ease;
}

@keyframes pulseBadge {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.15); }
}

/* Modal del carrito */
.cart-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.cart-modal.active {
    display: flex;
    opacity: 1;
}

.cart-modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.cart-modal.active .cart-modal-content {
    transform: scale(1);
}

/* Header del modal */
.cart-modal-header {
    padding: 20px;
    border-bottom: 2px solid #E0E0E0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #F8F9FA 0%, #FFFFFF 100%);
    border-radius: 15px 15px 0 0;
}

.cart-modal-header h3 {
    margin: 0;
    color: #2c5aa0;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-modal-header h3 i {
    color: #4a7bc8;
}

.close-cart-btn {
    background: transparent;
    border: none;
    color: #999;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 50%;
    transition: all 0.3s;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-cart-btn:hover {
    background: #F0F0F0;
    color: #2c5aa0;
    transform: rotate(90deg);
}

/* Body del modal */
.cart-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 200px;
}

.cart-items-container {
    min-height: 150px;
    max-height: 400px;
    overflow-y: auto;
}

/* Item del carrito */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid #E0E0E0;
    border-radius: 10px;
    transition: all 0.3s;
}

.cart-item:hover {
    border-color: #2c5aa0;
    box-shadow: 0 2px 8px rgba(44, 90, 160, 0.15);
    transform: translateX(5px);
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    font-size: 1em;
}

.cart-item-details {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #666;
}

.quantity-badge {
    background: linear-gradient(135deg, #2c5aa0 0%, #4a7bc8 100%);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 0.85em;
}

.price-info {
    color: #999;
}

.subtotal {
    color: #4a7bc8;
    font-weight: bold;
    margin-left: auto;
}

.remove-cart-item-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1em;
    margin-left: 15px;
}

.remove-cart-item-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* Estado vacío */
.cart-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.cart-empty-state i {
    font-size: 4em;
    margin-bottom: 15px;
    opacity: 0.3;
    color: #BBB;
}

.cart-empty-state p {
    font-size: 1.1em;
    margin: 10px 0;
    color: #666;
}

.cart-empty-state small {
    font-size: 0.9em;
    color: #999;
}

/* Footer del modal */
.cart-modal-footer {
    padding: 20px;
    border-top: 2px solid #E0E0E0;
    background: linear-gradient(135deg, #F8F9FA 0%, #FFFFFF 100%);
    border-radius: 0 0 15px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.cart-total {
    display: flex;
    align-items: center;
    gap: 10px;
}

.total-label {
    font-size: 1.1em;
    color: #666;
    font-weight: 600;
}

.total-amount {
    font-size: 1.5em;
    color: #4a7bc8;
    font-weight: bold;
}

.go-to-orders-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 24px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.go-to-orders-btn:hover {
    background: linear-gradient(135deg, #20c997 0%, #28a745 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.5);
}

.go-to-orders-btn:active {
    transform: translateY(0);
}

/* Notificación */
.cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 3000;
    display: none;
    animation: slideIn 0.3s ease;
}

.cart-notification.success {
    background: #28a745;
}

.cart-notification.error {
    background: #dc3545;
}

.cart-notification.info {
    background: #17a2b8;
}

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

/* Desktop - Ajustar posición para no tapar hamburger */
@media (min-width: 769px) {
    /* Posicionar carrito debajo del header - calcular dinámicamente */
    div[style*="position: fixed"][style*="top: 20px"],
    div[style*="position: fixed"][style*="top: 80px"] {
        top: calc(var(--header-height, 80px) + 10px) !important; /* Justo debajo del header + 10px de margen */
    }
}

/* Responsive */
@media (max-width: 768px) {
    /* Ajustar wrapper en tablets */
    #floating-cart-btn {
        font-size: 1.3rem;
    }
    
    /* Ajustar posición del wrapper - alineado verticalmente con el hamburguesa, debajo del header */
    /* La posición right se calcula dinámicamente con JavaScript para alinearse con el hamburguesa */
    div[style*="position: fixed"][style*="top: 20px"],
    div[style*="position: fixed"][style*="top: 80px"] {
        top: calc(var(--header-height, 80px) + 10px) !important; /* Justo debajo del header + 10px de margen */
        width: 55px !important;
        height: 55px !important;
        /* right se establece dinámicamente por JavaScript */
    }
    
    .cart-badge {
        min-width: 24px;
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
        border-width: 2.5px;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        margin: 0 !important;
        text-align: center !important;
        line-height: 1 !important;
    }
    
    .cart-badge.has-double-digit {
        min-width: 28px;
        width: auto;
        height: 24px;
        border-radius: 12px;
        padding: 0 4px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
    }
    
    .cart-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .cart-modal-header {
        padding: 15px;
    }
    
    .cart-modal-header h3 {
        font-size: 1.1rem;
    }
    
    .cart-modal-body {
        padding: 15px;
    }
    
    .cart-item {
        padding: 12px;
        flex-wrap: wrap;
    }
    
    .cart-item-name {
        font-size: 0.95em;
    }
    
    .cart-item-details {
        font-size: 0.85em;
        flex-wrap: wrap;
    }
    
    .remove-cart-item-btn {
        padding: 8px 12px;
        font-size: 0.9em;
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }
    
    .cart-modal-footer {
        padding: 15px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .cart-total {
        justify-content: space-between;
        width: 100%;
    }
    
    .go-to-orders-btn {
        width: 100%;
        justify-content: center;
    }
    
    .cart-notification {
        right: 10px;
        left: 10px;
        top: auto;
        bottom: 90px;
    }
}

@media (max-width: 480px) {
    #floating-cart-btn {
        font-size: 1.2rem;
    }
    
    /* Ajustar posición del wrapper en móviles - alineado verticalmente con el hamburguesa, debajo del header */
    /* La posición right se calcula dinámicamente con JavaScript para alinearse con el hamburguesa */
    div[style*="position: fixed"][style*="top: 20px"],
    div[style*="position: fixed"][style*="top: 70px"] {
        top: calc(var(--header-height, 70px) + 10px) !important; /* Justo debajo del header + 10px de margen */
        width: 50px !important;
        height: 50px !important;
        /* right se establece dinámicamente por JavaScript */
    }
    
    .cart-badge {
        min-width: 22px;
        width: 22px;
        height: 22px;
        font-size: 0.65rem;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
        border-width: 2px;
        padding: 0 !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        line-height: 1 !important;
    }
    
    .cart-badge.has-double-digit {
        min-width: 26px;
        width: auto;
        height: 22px;
        border-radius: 11px;
        padding: 0 3px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
    }
    
    .cart-items-container {
        max-height: 300px;
    }
    
    .cart-empty-state {
        padding: 40px 15px;
    }
    
    .cart-empty-state i {
        font-size: 3em;
    }
}

/* Ajuste para evitar conflicto con header en pantallas grandes */
@media (min-width: 769px) {
    #floating-cart-btn {
        top: calc(var(--header-height, 80px) + 10px);
        right: 30px;
    }
}

/* Scrollbar personalizado para el contenedor de items */
.cart-items-container::-webkit-scrollbar {
    width: 8px;
}

.cart-items-container::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.cart-items-container::-webkit-scrollbar-thumb {
    background: #2c5aa0;
    border-radius: 4px;
}

.cart-items-container::-webkit-scrollbar-thumb:hover {
    background: #1e3d73;
}

















