/* Reset y variables CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --border-radius: 12px;
    --transition: all 0.2s ease-in-out;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--white);
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Header minimalista */
.minimal-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.95);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.minimal-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
    letter-spacing: -0.02em;
}

.stats-inline {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 400;
}

.stats-inline span {
    font-weight: 600;
    color: var(--gray-900);
}

/* Búsqueda minimalista */
.search-minimal {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.search-input-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

#searchInput {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 50px;
    background: var(--white);
    transition: var(--transition);
    outline: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#searchInput:focus {
    border-color: var(--gray-400);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#searchInput::placeholder {
    color: var(--gray-400);
}

#clearSearch {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.25rem;
    border-radius: 50%;
    transition: var(--transition);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#clearSearch:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Opciones de filtro */
.filter-options {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.toggle-container input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--gray-300);
    border-radius: 12px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--white);
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-container input:checked + .toggle-slider {
    background: var(--primary-color);
}

.toggle-container input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.875rem;
    color: var(--gray-700);
    font-weight: 500;
}

/* Estadísticas */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* Estados minimalistas */
.loading-minimal, .message-minimal {
    text-align: center;
    padding: 3rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.loading-dots div {
    width: 8px;
    height: 8px;
    background: var(--gray-400);
    border-radius: 50%;
    animation: loading-bounce 1.4s infinite ease-in-out both;
}

.loading-dots div:nth-child(1) { animation-delay: -0.32s; }
.loading-dots div:nth-child(2) { animation-delay: -0.16s; }

@keyframes loading-bounce {
    0%, 80%, 100% { 
        transform: scale(0);
    } 40% { 
        transform: scale(1);
    }
}

.message-minimal p {
    color: var(--gray-600);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.btn-minimal {
    background: var(--gray-900);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.btn-minimal:hover {
    background: var(--gray-700);
}

.error-message {
    color: var(--danger-color);
}

.error-message i {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.retry-btn {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    margin-top: 1rem;
    transition: var(--transition);
}

.retry-btn:hover {
    background: var(--primary-hover);
}

.no-results i {
    font-size: 3rem;
    color: var(--gray-400);
    margin-bottom: 1rem;
}

.no-results p {
    font-size: 1.25rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.no-results small {
    color: var(--gray-500);
}

/* Contenedor de productos minimalista */
.products-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

.products-grid-minimal {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

/* Tarjeta de producto minimalista */
.product-card {
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    border-color: var(--gray-300);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Contenedor de imagen mejorado */
.product-image-container {
    position: relative;
    width: 100%;
    height: 220px;
    background: var(--gray-50);
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: var(--transition);
    background: var(--white);
    padding: 0.5rem;
}

.product-image:hover {
    transform: scale(1.02);
}

.no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    color: var(--gray-400);
    font-size: 3rem;
    flex-direction: column;
    gap: 0.5rem;
}

.no-image::after {
    content: "Sin imagen";
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
}

.variant-indicator {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.8);
    color: var(--white);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    backdrop-filter: blur(4px);
}

/* Contenido de la tarjeta minimalista */
.product-content {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-header {
    margin-bottom: 1rem;
}

.product-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.product-code {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-family: 'Monaco', 'Menlo', monospace;
}

.product-category {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* Marca del producto */
.product-brand {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--gray-50);
    border-radius: 4px;
    display: inline-block;
}



/* Atributos de variante minimalistas */
.product-attributes {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.attribute-badge {
    background: var(--gray-900);
    color: var(--white);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 400;
}

.product-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}



/* Sección de stock rediseñada */
.stock-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.stock-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stock-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stock-text {
    font-size: 0.8rem;
    opacity: 0.9;
}

.stock-status-text {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.stock-badge.available {
    background: rgb(16 185 129 / 0.1);
    color: var(--success-color);
}

.stock-badge.out-of-stock {
    background: rgb(239 68 68 / 0.1);
    color: var(--danger-color);
}

.stock-badge.low-stock {
    background: rgb(245 158 11 / 0.1);
    color: var(--warning-color);
}

.stock-quantity {
    font-weight: 600;
}

.stock-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.stock-icon.available {
    background: var(--success-color);
}

.stock-icon.out-of-stock {
    background: var(--danger-color);
}

.stock-icon.low-stock {
    background: var(--warning-color);
}

/* Responsive minimalista */
@media (max-width: 768px) {
    .header-content {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .search-minimal {
        padding: 1rem;
    }
    
    .products-container {
        padding: 0 1rem 2rem;
    }
    
    .products-grid-minimal {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .product-image-container {
        height: 200px;
    }
    
    .product-image {
        padding: 0.25rem;
    }
    

    
    .stock-section {
        margin-top: 1rem;
        padding: 0.75rem;
    }
    
    .stock-badge {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .product-content {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .minimal-header h1 {
        font-size: 1.25rem;
    }
    
    .stats-inline {
        font-size: 0.8rem;
    }
    
    .search-input-container {
        max-width: 100%;
    }
    
    .product-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .products-grid-minimal {
        gap: 1rem;
    }
    
    .product-image-container {
        height: 180px;
    }
    
    .product-image {
        padding: 0.25rem;
    }
}

/* Estilos para vista agrupada */
.grouped-card {
    border-left: 4px solid var(--primary-color);
}

.variants-count {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--primary-color);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    min-width: 20px;
    text-align: center;
}



/* Contenedor de variantes minimalista */
.variants-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0;
}

.variant-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    padding: 6px 8px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    text-align: center;
}

.variant-badge:hover {
    background: var(--gray-50);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.variant-badge.selected {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.variant-attributes {
    font-weight: 500;
    line-height: 1.2;
}



/* Info de variante seleccionada */
.selected-variant-info {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.variant-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.variant-name-selected {
    font-weight: 500;
    color: var(--gray-900);
}

.variant-stock-selected.available {
    color: var(--success-color);
    font-weight: 500;
}

.variant-stock-selected.out-of-stock {
    color: var(--danger-color);
    font-weight: 500;
}

/* Estilos de toggles eliminados - ya no se necesitan */

/* Responsividad para vista agrupada */
@media (max-width: 768px) {
    .variants-container {
        gap: 4px;
    }
    
    .variant-badge {
        min-width: 40px;
        padding: 5px 6px;
        font-size: 0.7rem;
    }
    
    .variant-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}
