/* ========================================
   STYLE_CATEGORIAS.CSS
   ======================================== */

html, body { height: 100%; margin: 0; padding: 0; }

body {
    background-color: var(--fondo-general) !important;
    font-family: var(--fuente-principal) !important;
    overflow-x: hidden !important;
    color: var(--texto-principal);
}

@media (min-width: 1080px) {
    body { padding-top: 160px !important; }
}

@media (min-width: 992px) and (max-width: 1079.98px) {
    body { padding-top: 150px !important; }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    body { padding-top: 130px !important; }
}

@media (max-width: 767.98px) {
    body { padding-top: 100px !important; }
}

@media (max-width: 576px) {
    body { padding-top: 90px !important; }
}

@media (max-width: 380px) {
    body { padding-top: 85px !important; }
}

/* ========================================
   BREADCRUMB
   ======================================== */
.breadcrumb {
    background-color: transparent !important;
    margin-bottom: 0 !important;
    padding-top: 5px !important;
    padding-bottom: 5px !important;
}

.breadcrumb-item {
    font-size: 0.95rem;
}

.breadcrumb-item a {
    color: var(--texto-secundario);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
    color: var(--texto-principal);
}

.breadcrumb-item.active {
    color: var(--texto-principal);
    font-weight: 700;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--texto-secundario);
    content: "/" !important;
}

@media (max-width: 992px) {
    .breadcrumb {
        padding-top: 5px !important;
        padding-bottom: 3px !important;
    }
}

@media (max-width: 768px) {
    .breadcrumb {
        padding-top: 5px !important;
        padding-bottom: 2px !important;
        padding-left: 0;
        padding-right: 0;
    }
}

@media (max-width: 576px) {
    .breadcrumb {
        padding-top: 5px !important;
        padding-bottom: 0 !important;
        font-size: 0.9rem;
    }
}

.d-flex.flex-wrap.align-items-center.justify-content-between.mb-3 h1.h4 {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.page-content { min-height: calc(100vh - 200px); width: 100%; overflow: visible; }
.catalog-page .container { overflow: visible; }
.catalog-page .row { display: flex; overflow: visible; }

/* ========================================
   FILTRO DE CATEGORÍAS
   ======================================== */

.filters-card {
    border: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin-bottom: 20px;
}

.filters-card .card-header {
    background: transparent !important;
    border-bottom: none !important;
    padding: 0.3rem 0 0.8rem 0 !important;
    margin-bottom: 0.5rem; 
    border-bottom: 2px solid var(--texto-principal) !important;
}

.filters-card .card-header h5 {
    color: var(--texto-principal) !important;
    font-weight: 700 !important;
    margin: 0 !important;
    font-size: 1.15rem !important;
    padding-left: 0 !important;
    line-height: 1.2 !important;
}

.filters-card .card-body {
    padding: 0 !important;
    background: transparent !important;
}

.filters-card .list-group {
    background: transparent !important;
}

.filters-card .list-group-item {
    background: transparent !important;
    border: none !important;
    padding: 0.5rem 0 !important;
    color: var(--texto-principal) !important;
    font-size: 1.15rem !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
}

.filters-card .list-group-item:hover {
    color: var(--azul-industrial) !important;
    background: transparent !important;
}

.filters-card .list-group-item.active {
    color: var(--texto-principal) !important;
    font-weight: 700 !important;
    background: transparent !important;
    font-size: 1.15rem !important;
}

.filters-card .list-group-item .cantidad {
    font-size: 0.95rem;
    font-weight: normal;
    opacity: 0.8;
}

/* RESPONSIVE para tablets y móviles */
@media (max-width: 992px) {
    .filters-card .card-header {
        padding: 0.25rem 0 0.6rem 0 !important;
        border-bottom: 2px solid var(--azul-industrial) !important;
    }
    
    .filters-card .card-header h5 {
        font-size: 1rem !important;
        line-height: 1.2 !important;
    }
    
    .filters-card .list-group-item {
        font-size: 1rem !important;
        padding: 0.45rem 0 !important;
        line-height: 1.2 !important;
    }
}

@media (max-width: 768px) {
    .filters-card .card-header {
        padding: 0.2rem 0 0.5rem 0 !important;
        border-bottom: 2px solid var(--azul-industrial) !important;
    }
    
    .filters-card .card-header h5 {
        font-size: 0.95rem !important;
        line-height: 1.2 !important;
    }
    
    .filters-card .list-group-item {
        font-size: 0.95rem !important;
        padding: 0.4rem 0 !important;
        line-height: 1.2 !important;
    }
}

/* ========================================
   ETIQUETAS DE PRODUCTO (NUEVO / PRÓXIMAMENTE)
   ======================================== */
.product-etiqueta {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--radio-pill);
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.product-etiqueta.nuevo {
    background-color: var(--azul-industrial);
    color: var(--texto-principal);
}

.product-etiqueta.proximamente {
    background-color: var(--azul-industrial);
    color: var(--texto-principal);
}

/* ========================================
   TÍTULO DEL PRODUCTO
   ======================================== */
.product-title {
    color: var(--texto-principal) !important;
    line-height: 1.4;
    margin-bottom: 0.5rem !important;
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
}

/* ========================================
   BADGE DE CÓDIGO DE PRODUCTO 
   ======================================== */
.product-codigo-badge {
    display: inline-block;
    background-color: transparent !important;
    color: var(--texto-principal) !important;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-top: 0;
    margin-bottom: 10px !important;
    width: auto;
    max-width: 100%;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    align-self: flex-start;
    line-height: 1.2;
}

/* ========================================
   TARJETAS DE PRODUCTO
   ======================================== */
.product-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: var(--radio-sm);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--fondo-general) !important;
    border: 1px solid var(--categoria-borde-tarjeta);
}

.product-card:hover {
    box-shadow: var(--sombra-fuerte) !important;
}

.product-image-wrapper {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: var(--fondo-mas-elevado);
    flex-shrink: 0;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease;
}

.product-image-default {
    opacity: 1;
    z-index: 1;
}

.product-image-hover {
    opacity: 0;
    z-index: 2;
}

.product-card:hover .product-image-hover {
    opacity: 1;
}

.product-card:hover .product-image-hover + .product-image-default,
.product-card:hover .product-image-hover ~ .product-image-default {
    opacity: 0;
}

/* CARD BODY - PADDING INFERIOR REDUCIDO */
.product-card .card-body {
    padding: 0.75rem 1rem 0.25rem 1rem !important;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* ========================================
   GRID DE PRODUCTOS - ESPACIO AJUSTADO
   ======================================== */

/* Contenedor del grid */
#productos-grid {
    --bs-gutter-x: 0 !important;
    margin-right: -8px !important;
    margin-left: -8px !important;
}

/* Cada columna de producto */
#productos-grid > [class*="col-"] {
    padding-right: 8px !important;
    padding-left: 8px !important;
    margin-bottom: 4px !important;
}

/* ========================================
   GRID DE PRODUCTOS - RESPONSIVE
   ======================================== */

@media (min-width: 1400px) {
    .col-xxl-3 { flex: 0 0 auto; width: 25%; }
    .product-image-wrapper { height: 300px; }
    .product-card .card-body {
        padding: 0.75rem 1rem 0.25rem 1rem !important;
    }
    
    #productos-grid {
        margin-right: -10px !important;
        margin-left: -10px !important;
    }
    
    #productos-grid > [class*="col-"] {
        padding-right: 10px !important;
        padding-left: 10px !important;
        margin-bottom: 4px !important;
    }
}

@media (min-width: 1200px) and (max-width: 1399.98px) {
    .col-xl-3 { flex: 0 0 auto; width: 25%; }
    .product-image-wrapper { height: 280px; }
    
    #productos-grid {
        margin-right: -10px !important;
        margin-left: -10px !important;
    }
    
    #productos-grid > [class*="col-"] {
        padding-right: 10px !important;
        padding-left: 10px !important;
        margin-bottom: 4px !important;
    }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    .col-lg-4 { 
        flex: 0 0 auto; 
        width: 33.33333333%; 
    }
    .product-image-wrapper { height: 260px; }
    .product-title { font-size: 0.95rem; }
    .product-card .card-body {
        padding: 0.7rem 0.9rem 0.25rem 0.9rem !important;
    }
    
    #productos-grid {
        margin-right: -8px !important;
        margin-left: -8px !important;
    }
    
    #productos-grid > [class*="col-"] {
        padding-right: 8px !important;
        padding-left: 8px !important;
        margin-bottom: 4px !important;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .container {
        max-width: 100% !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    .col-md-4 { 
        flex: 0 0 33.333333% !important;
        max-width: 33.333333% !important;
    }
    
    .product-image-wrapper { height: 230px; }
    .product-title {
        font-size: 0.9rem;
        margin-bottom: 0.45rem !important;
    }
    .product-codigo-badge {
        font-size: 0.75rem;
    }
    .product-card .card-body {
        padding: 0.65rem 0.85rem 0.2rem 0.85rem !important;
    }
    
    #productos-grid {
        margin-right: -6px !important;
        margin-left: -6px !important;
    }
    
    #productos-grid > [class*="col-"] {
        padding-right: 6px !important;
        padding-left: 6px !important;
        margin-bottom: 4px !important;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    .container {
        max-width: 100% !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    .col-sm-6 { 
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
    .product-image-wrapper { height: 300px; }
    .product-title {
        font-size: 0.9rem;
        margin-bottom: 0.4rem !important;
    }
    .product-codigo-badge {
        font-size: 0.75rem;
    }
    .product-card .card-body {
        padding: 0.6rem 0.8rem 0.2rem 0.8rem !important;
    }
    
    #productos-grid {
        margin-right: -5px !important;
        margin-left: -5px !important;
    }
    
    #productos-grid > [class*="col-"] {
        padding-right: 5px !important;
        padding-left: 5px !important;
        margin-bottom: 4px !important;
    }
}

@media (max-width: 575.98px) {
    .container {
        max-width: 100% !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    
    .col-6 { 
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
    .product-image-wrapper { height: 250px; }
    .product-title {
        font-size: 0.85rem;
        margin-bottom: 0.35rem !important;
    }
    .product-codigo-badge {
        font-size: 0.7rem;
    }
    .product-card .card-body {
        padding: 0.55rem 0.75rem 0.15rem 0.75rem !important;
    }
    
    #productos-grid {
        margin-right: -4px !important;
        margin-left: -4px !important;
    }
    
    #productos-grid > [class*="col-"] {
        padding-right: 4px !important;
        padding-left: 4px !important;
        margin-bottom: 3px !important;
    }
}

@media (max-width: 380px) {
    .product-image-wrapper { height: 200px; }
    .product-title {
        font-size: 0.8rem;
        margin-bottom: 0.3rem !important;
    }
    .product-codigo-badge {
        font-size: 0.65rem;
    }
    .product-card .card-body {
        padding: 0.5rem 0.5rem 0.15rem 0.5rem !important;
    }
    
    #productos-grid {
        margin-right: -3px !important;
        margin-left: -3px !important;
    }
    
    #productos-grid > [class*="col-"] {
        padding-right: 3px !important;
        padding-left: 3px !important;
        margin-bottom: 2px !important;
    }
}

@media (min-width: 1900px) and (max-width: 1920px) {
    .container { max-width: 1450px !important; }
    .product-image-wrapper { height: 320px; }
    .product-title { font-size: 1.05rem; }
    
    #productos-grid {
        margin-right: -12px !important;
        margin-left: -12px !important;
    }
    
    #productos-grid > [class*="col-"] {
        padding-right: 12px !important;
        padding-left: 12px !important;
        margin-bottom: 4px !important;
    }
}

@media (min-width: 1366px) and (max-width: 1366px) {
    .container { max-width: 1350px !important; }
    .product-image-wrapper { height: 290px; }
}

@media (min-width: 1280px) and (max-width: 1280px) {
    .product-image-wrapper { height: 270px; }
}

/* ========================================
   BOTÓN CARGAR MÁS PRODUCTOS
   ======================================== */
#cargar-mas-btn {
    padding: 0.6rem 2.5rem;
    font-weight: 600;
    border-radius: var(--radio-pill);
    border: none;
    background-color: var(--azul-industrial);
    color: var(--texto-principal);
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

#cargar-mas-btn:hover {
    background-color: var(--azul-industrial-oscuro);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#cargar-mas-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   ORDENAR Y CONTADOR
   ======================================== */
.resultados-ordenar-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    margin-top: 0;
    width: 100%;
}

#resultados-contador {
    margin-bottom: 0 !important;
    font-size: 0.95rem;
    line-height: 38px;
    color: var(--texto-principal) !important;
}

.ordenar-contenedor-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}

.ordenar-contenedor { display: inline-block; margin-bottom: 0 !important; }
.ordenar-contenedor .d-flex { display: flex !important; align-items: center !important; gap: 8px; }
.ordenar-contenedor label {
    margin-bottom: 0 !important;
    line-height: 1.5;
    white-space: nowrap;
    color: var(--texto-principal) !important;
    font-size: 0.9rem;
}

#order-select {
    border-radius: var(--radio-pill);
    padding: 0.25rem 1.5rem 0.25rem 1rem;
    background-color: var(--fondo-elevado);
    border: 1px solid var(--borde-gris);
    font-size: 0.9rem;
    height: 38px;
    line-height: 1.5;
    color: var(--texto-principal);
}

/* ========================================
   CUSTOM SELECT CON FLECHA BLANCA
   ======================================== */

.custom-select-wrapper {
    position: relative;
    display: inline-block;
    width: auto;
}

.custom-select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    border-radius: var(--radio-pill);
    padding: 0.25rem 2.5rem 0.25rem 1rem;
    background-color: var(--fondo-elevado);
    border: 1px solid var(--borde-gris);
    font-size: 0.9rem;
    height: 38px;
    line-height: 1.5;
    color: var(--texto-principal) !important;
    cursor: pointer;
    width: 100%;
    min-width: 160px;
}

.custom-select-arrow {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    pointer-events: none;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--texto-principal);
    border-bottom: 2px solid var(--texto-principal);
    transform: translateY(-70%) rotate(45deg);
}

/* Para Firefox */
.custom-select::-moz-focus-inner {
    border: 0;
}

/* Para Edge/IE */
.custom-select::-ms-expand {
    display: none;
}

/* Responsive */
@media (max-width: 576px) {
    .custom-select {
        width: 100%;
        min-width: auto;
    }
}

/* ========================================
   RESPONSIVE MÓVIL/TABLET
   ======================================== */
@media (max-width: 991.98px) {
    aside.col-lg-3 { display: none !important; }
    section.col-lg-9 { 
        width: 100% !important; 
        flex: 0 0 100% !important; 
        max-width: 100% !important; 
    }
    
    .catalog-page .container {
        max-width: 100% !important;
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
}

@media (max-width: 768px) {
    .resultados-ordenar-container { flex-direction: row; align-items: center; gap: 10px; }
    #resultados-contador { line-height: 1.5; font-size: 0.9rem; }
    .ordenar-contenedor-wrapper { margin-left: 0; flex: 1; justify-content: flex-end; }
    .ordenar-contenedor { width: 100%; }
    .ordenar-contenedor .d-flex { width: 100%; justify-content: flex-end; }
    #order-select { width: auto; min-width: 160px; }
}

@media (max-width: 576px) {
    .resultados-ordenar-container { flex-direction: column; align-items: stretch; gap: 10px; }
    .ordenar-contenedor-wrapper { justify-content: flex-start; }
    .ordenar-contenedor .d-flex { justify-content: space-between; }
    #order-select { width: 100%; }
}

@media (max-width: 767.98px) {
    .page-content { min-height: calc(100vh - 250px); }
}