/* Estilos para la página de tienda */

/* Contenedor principal de la página */
.shop-page-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header de productos */
.woocommerce-products-header {
    margin-bottom: 30px;
    text-align: center;
}

.woocommerce-products-header__title {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #333;
}

/* Contenedor principal de la tienda */
.shop-container {
    display: flex;
    gap: 30px;
    position: relative;
}

/* Botón de filtro móvil */
.mobile-filter-toggle {
    display: none;
    margin-bottom: 20px;
    width: 100%;
}

.mobile-filter-button {
    background-color: #000;
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.3s ease;
}

.mobile-filter-button:hover {
    background-color: #333;
}

.filter-icon {
    font-size: 18px;
}

/* Sidebar de filtros - 25% del ancho */
.shop-sidebar {
    width: 25%;
    max-width: 280px;
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

/* Header del sidebar */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.filter-close-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.filter-close-btn:hover {
    background-color: #e0e0e0;
}

/* Contenido de filtros */
.filters-content {
    max-height: 80vh;
    overflow-y: auto;
}

/* Secciones de filtros */
.filter-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.filter-section h4 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
}

/* Categorías de filtros */
.filter-categories .filter-category {
    margin-bottom: 8px;
}

.category-header {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.category-header:hover {
    background-color: #f0f0f0;
}

.category-main {
    display: flex;
    align-items: center;
    flex-grow: 1;
}

.category-checkbox,
.subcategory-checkbox,
.attribute-checkbox {
    margin-right: 10px;
    transform: scale(1.1);
}

.category-label,
.subcategory-label {
    cursor: pointer;
    font-size: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-count {
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

/* Botón de toggle para subcategorías */
.toggle-subcategory {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    color: #666;
}

.toggle-subcategory:hover {
    background-color: #e0e0e0;
    color: #333;
}

.toggle-subcategory .arrow {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 12px;
}

.toggle-subcategory.active .arrow {
    transform: rotate(180deg);
}

/* Subcategorías */
.subcategories {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding-left: 25px;
    padding-top: 0;
    padding-bottom: 0;
}

.subcategories.show {
    max-height: 500px; /* Aumentado para más subcategorías */
    padding-top: 8px;
    padding-bottom: 8px;
}

.subcategory-item,
.attribute-item {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    padding: 4px 0;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.subcategory-item:hover,
.attribute-item:hover {
    background-color: #f0f0f0;
}

.subcategory-label,
.attribute-item label {
    cursor: pointer;
    font-size: 14px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Filtro de precios */
.price-filter {
    margin-top: 10px;
}

.price-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.price-field {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0 8px;
    flex: 1;
}

.currency {
    color: #666;
    font-size: 14px;
    margin-right: 4px;
}

.price-input {
    border: none;
    padding: 8px 4px;
    font-size: 14px;
    width: 100%;
    outline: none;
}

.price-separator {
    color: #666;
    font-weight: bold;
}

/* Slider de precios */
.price-slider-container {
    position: relative;
    height: 40px;
    margin-bottom: 15px;
}

.price-slider-track {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    right: 0;
    height: 4px;
    background-color: #ddd;
    border-radius: 2px;
}

.price-slider-range {
    position: absolute;
    height: 100%;
    background-color: #000;
    border-radius: 2px;
}

.price-slider {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    pointer-events: none;
    appearance: none;
    outline: none;
}

.price-slider::-moz-range-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #000;
    cursor: pointer;
    pointer-events: all;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Fallback para navegadores que no soportan appearance */
.price-slider::-ms-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #000;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.price-display {
    text-align: center;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Botones de acción de filtros */
.filter-actions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-apply-filters,
.btn-clear-filters {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-apply-filters {
    background-color: #000;
    color: white;
}

.btn-apply-filters:hover {
    background-color: #333;
}

.btn-clear-filters {
    background-color: transparent;
    color: #666;
    border: 1px solid #ddd;
}

.btn-clear-filters:hover {
    background-color: #f5f5f5;
    color: #333;
}

/* Contenido principal - 75% del ancho */
.shop-content {
    width: 75%;
    flex-grow: 1;
    max-width: none;
    min-width: 0;
}

.shop-toolbar {
    margin-bottom: 20px;
}

/* Contenedor de productos */
.products-container {
    position: relative;
    width: 100%;
}

/* Grid de productos mejorado */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

/* Responsive para el grid */
@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
}

@media (max-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .product-title {
        font-size: 14px;
        height: 36px;
    }
    
    .product-price {
        font-size: 16px;
    }
    
    .add-to-cart-btn {
        padding: 10px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .product-info {
        padding: 12px;
    }
    
    .product-title {
        font-size: 13px;
        height: 32px;
    }
    
    .product-price {
        font-size: 15px;
    }
    
    .add-to-cart-btn {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* Cards de productos mejoradas */
.product-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 85%;
    padding-right: 35px;
}

.woocommerce .woocommerce-ordering select{
    display: none;
}

.woocommerce .woocommerce-result-count{
    display: none;
}

.woocommerce:where(body:not(.woocommerce-uses-block-theme)) .woocommerce-breadcrumb{
    display: none;
}

.product-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-5px);
    border-color: #ccc;
}

/* Contenedor de imagen */
.product-image-container {
    position: relative;
    overflow: hidden;
    background: #fff;
    padding: 15px;
    min-height: 180px;
    width: 100%;
    text-align: center !important;
}

.product-image-link {
    display: block !important;
    width: 100%;
    height: 100%;
    text-align: center !important;
}

.product-image,
.product-image-container img {
    max-width: 100% !important;
    max-height: 160px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    transition: transform 0.3s ease;
    display: block !important;
    margin: 0 auto !important;
    text-align: center !important;
}

.product-card:hover .product-image,
.product-card:hover .product-image-container img {
    transform: scale(1.05);
}

/* Placeholder para productos sin imagen */
.product-image-placeholder {
    width: 100%;
    height: 160px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
    border: 2px dashed #ddd;
    border-radius: 4px;
}

/* Badge de oferta */
.sale-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #e74c3c;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 2;
}

/* Información del producto */
.product-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 10px;
    width: 100%;
    text-align: center;
}

.product-title {
    margin: 0 auto !important;
    font-size: 15px;
    line-height: 1.3;
    height: 50px !important;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    width: 100%;
    text-align: center !important;
    padding: 5px;
}

/* Cross-browser line clamping fallback */
.product-title::after {
    display: none !important;
}

/* Fallback for all browsers */
.product-title {
    max-height: 50px !important;
    word-wrap: break-word;
    overflow: hidden;
}

.product-title a {
    color: #333 !important;
    text-decoration: none !important;
    font-weight: 500;
    display: block !important;
    text-align: center !important;
    width: 100%;
    margin: 0 auto !important;
    line-height: 1.3;
}

.product-title a:hover {
    color: #000;
}

.product-price {
    font-size: 18px !important;
    font-weight: bold;
    color: #000 !important;
    margin: 0 auto !important;
    width: 100%;
    text-align: center !important;
    display: block !important;
}

.product-price del {
    color: #999;
    font-weight: normal;
    margin-right: 8px;
    font-size: 16px;
}

.product-price ins {
    text-decoration: none;
    color: #e74c3c;
}

.product-rating {
    height: 16px;
    margin: 0;
    text-align: center;
}

.product-rating .star-rating {
    font-size: 14px;
}

.product-actions {
    margin-top: auto;
    padding-top: 10px;
    width: 100%;
    text-align: center !important;
}

.add-to-cart-btn {
    display: block !important;
    width: 100% !important;
    padding: 12px 15px !important;
    background-color: #000 !important;
    color: white !important;
    text-align: center !important;
    border-radius: 6px;
    text-decoration: none !important;
    font-weight: 500;
    font-size: 14px;
    border: none !important;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 auto !important;
    box-sizing: border-box;
}

.add-to-cart-btn:hover {
    background-color: #333;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.woocommerce .woocommerce-result-count{
	display: none !important;
}

.woocommerce .woocommerce-ordering select{
	display: none !important;
}


/* Loading overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No products found */
.no-products-found {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .shop-container {
        gap: 20px;
    }
}

@media (max-width: 992px) {
    .shop-sidebar {
        width: 30%;
        max-width: 250px;
    }
    
    .shop-content {
        width: 70%;
    }
}




@media (max-width: 768px) {
    .shop-page-wrapper {
        padding: 15px;
    }
    
    .shop-container {
        flex-direction: column;
        gap: 0;
    }
    
    .mobile-filter-toggle {
        display: block;
    }
    
    /* Sidebar como overlay móvil */
    .shop-sidebar {
        width: 85%;
        max-width: none;
        position: fixed;
        top: 0;
        left: -100%;
        height: 100vh;
        background-color: white;
        z-index: 9999;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        transition: left 0.3s ease;
        padding: 20px;
        border-radius: 0;
    }
    
    .shop-sidebar.active {
        left: 0;
    }
    
    .filter-close-btn {
        display: block;
    }
    
    .shop-content {
        width: 100%;
    }
    
    .product-title {
        font-size: 14px;
        height: 40px;
    }
    
    .product-price {
        font-size: 16px;
    }
    
    .add-to-cart-btn {
        padding: 10px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .shop-sidebar {
        width: 70%;
    }
    
    .product-info {
        padding: 12px;
    }
    
    .product-title {
        font-size: 13px;
        height: 36px;
    }
    
    .product-price {
        font-size: 15px;
    }
    
    .add-to-cart-btn {
        padding: 8px;
        font-size: 12px;
    }
}

/* Overlay para móvil cuando sidebar está abierto */
@media (max-width: 768px) {
    .shop-sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .shop-sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}