:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.hero-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 60px 0;
    margin-bottom: 40px;
}

/* ESPACIO ENTRE PRODUCTOS - FORMA MÁS EFECTIVA */
.products-grid .col-xl-3,
.products-grid .col-lg-4, 
.products-grid .col-md-6 {
    margin-bottom: 20px !important; /* ESPACIO DIRECTO EN LAS COLUMNAS */
    padding-bottom: 10px;
}

.product-card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    height: 100%;
    margin-bottom: 0; /* QUITAMOS EL MARGIN DE LA CARD */
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.product-image {
    height: 180px;
    object-fit: cover;
    width: 100%;
}

.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1050;
    overflow-y: auto;
}

.cart-sidebar.open {
    right: 0;
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
}

.cart-overlay.show {
    display: block;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    border-radius: 10px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-weight: 600;
}

.stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
}

.quantity-input {
    width: 50px;
    text-align: center;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 4px;
    font-size: 0.9rem;
}

.description-short {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.85rem;
    min-height: 40px;
}

.view-specs-btn {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    margin-top: 5px;
}

.view-specs-btn:hover {
    background: var(--primary);
    color: white;
}

.hidden {
    display: none !important;
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    height: 48px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
}

.product-category {
    font-size: 0.8rem;
    color: #6c757d;
}

@media (max-width: 768px) {
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .product-image {
        height: 150px;
    }
    
    /* ESPACIO EN MÓVIL TAMBIÉN */
    .products-grid .col-md-6 {
        margin-bottom: 40px !important;
    }
}

.loading-container {
    position: relative;
}

#loadingProducts {
    transition: opacity 0.3s ease;
}

.fade-out {
    opacity: 0;
}

/* ESPACIO ADICIONAL EN EL CONTENEDOR */
#productsContainer {
    padding-top: 10px;
    padding-bottom: 30px;
}