/* Estilos para el carrito de compras - Diamond Studio */

/* Ícono del carrito en la barra de navegación */
.cart-icon {
    position: relative;
    cursor: pointer;
    font-size: 1.5rem;
    transition: transform 0.2s ease;
}

.cart-icon:hover {
    transform: scale(1.1);
}

.cart-icon:active {
    transform: scale(0.95);
}

.cart-counter {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #fbb3d3;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}

/* Sidebar del carrito */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 350px;
    height: 100%;
    background-color: white;
    z-index: 2000;
    transition: right 0.3s ease;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    visibility: hidden;
}
.cart-sidebar.active {
    right: 0;
    visibility: visible;
}

/* Cabecera del carrito */
.cart-header {
    background-color: #fbb3d3;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cart-header h5 {
    margin: 0;
    font-weight: 600;
}
.cart-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Alerta del carrito */
.cart-alert {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

.cart-alert-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
}

.cart-alert-content i {
    color: #856404;
    font-size: 1.2rem;
    margin-top: 2px;
}

.cart-alert-content p {
    color: #856404;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.cart-alert-close {
    background: none;
    border: none;
    color: #856404;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.cart-alert-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Cuerpo del carrito */
.cart-body {
    padding: 15px;
}

/* Elementos del carrito */
.cart-item {
    display: flex;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
}
.cart-item-img-container {
    width: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.cart-item-img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    background-color: #f8f9fa;
    border-radius: 6px;
}
.cart-item-details {
    flex: 1;
    padding-left: 15px;
}
.cart-item-title {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.9rem;
}
.cart-item-price {
    color: #fbb3d3;
    font-weight: bold;
    margin-bottom: 5px;
}

/* Control de cantidad */
.cart-quantity {
    display: flex;
    align-items: center;
    margin-top: 8px;
}
.cart-quantity-btn {
    background-color: #f0f0f0;
    border: none;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-weight: bold;
}
.cart-quantity-btn:hover {
    background-color: #e0e0e0;
}
.cart-quantity-input {
    width: 45px;
    text-align: center;
    border: 1px solid #f0f0f0;
    margin: 0 5px;
    height: 28px;
    border-radius: 4px;
}

/* Botón de eliminar */
.cart-remove {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    margin-left: 10px;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}
.cart-remove:hover {
    background-color: #ffebee;
}

/* Subtotal por item */
.cart-item-subtotal {
    margin-top: 5px;
    font-size: 0.85rem;
    text-align: right;
}

/* Pie del carrito */
.cart-footer {
    background-color: #f8f9fa;
    padding: 15px;
    position: absolute;
    bottom: 0;
    width: 100%;
}
.cart-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: bold;
}
.cart-total-price {
    color: #fbb3d3;
}

/* Botón de checkout */
.btn-checkout {
    width: 100%;
    background-color: #fbb3d3;
    border: none;
    color: white;
    padding: 10px;
    font-weight: 600;
    border-radius: 5px;
}

.btn-continue-shopping {
    width: 100%;
    background-color: #f8f9fa;
    border: 1px solid #fbb3d3;
    color: #fbb3d3;
    padding: 10px;
    font-weight: 600;
    border-radius: 5px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.btn-continue-shopping:hover {
    background-color: #fbb3d3;
    color: white;
}

/* Overlay (fondo oscuro) */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}
.overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Carrito vacío */
.cart-empty {
    text-align: center;
    padding: 30px 0;
    color: #6c757d;
}
.cart-empty i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #e0e0e0;
}
.cart-empty p {
    margin-bottom: 20px;
}

/* Botón añadir al carrito */
.btn-add-to-cart {
    background-color: #fbb3d3;
    border-color: #fbb3d3;
    color: white;
}
.btn-add-to-cart:hover {
    background-color: #f79bc0;
    border-color: #f79bc0;
}

/* Botón flotante del carrito para móviles */
.cart-floating-button {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #fbb3d3;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
.cart-floating-button:hover {
    background-color: #f79bc0;
    transform: scale(1.05);
}
.cart-floating-button i {
    font-size: 1.8rem;
}
.cart-floating-counter {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #fff;
    color: #fbb3d3;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Media queries para mostrar/ocultar botones según el tamaño de pantalla */
@media (max-width: 767px) {
    .navbar .cart-icon {
        display: none;
    }
    .cart-floating-button {
        display: flex;
    }
}
@media (min-width: 768px) {
    .cart-floating-button {
        display: none;
    }
}

/* Ajuste para el sidebar del carrito en móviles */
@media (max-width: 576px) {
    .cart-sidebar {
        width: 90%;
        right: -100%; /* Asegurar que el carrito esté completamente fuera en dispositivos móviles */
    }
}

/* Estilos globales para elementos de lista */
li {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Excepciones para los elementos de lista en cards y descripciones */
.card .list-group-item,
.producto-descripcion li {
    white-space: normal;
}

/* Estilos para asegurar que los elementos de lista en el carrito se muestren en una línea */
.cart-sidebar .cart-item-title,
.cart-sidebar li {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}