/* ==========================================================
   ADVANCED CATEGORIES PAGE STYLING - ENTERPRISE GRADE
   ========================================================== */

.category-main {
    margin-top: 76px;
    padding: 40px 0 80px;
    min-height: calc(100vh - 76px);
    background: #f4f7fb;
}

/* --- Hero Banner Moderno --- */
.category-header {
    margin-bottom: 36px;
}

.category-hero-card {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 28px;
    background: linear-gradient(135deg, #0b4f8a 0%, #173256 100%);
    border-radius: 24px;
    color: #ffffff;
    padding: 36px;
    box-shadow: 0 20px 50px rgba(11, 79, 138, 0.2);
    position: relative;
    overflow: hidden;
}

.category-hero-card::after {
    content: '';
    position: absolute;
    right: -50px;
    bottom: -50px;
    width: 250px;
    height: 250px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
    pointer-events: none;
}

.category-hero-copy h1 {
    color: #ffffff;
    font-size: 2.4rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.category-hero-copy p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.05rem;
    line-height: 1.6;
    max-width: 680px;
    margin-bottom: 24px;
}

.category-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
    backdrop-filter: blur(5px);
}

.category-hero-stats {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 20px;
}

.category-hero-stats div {
    display: flex;
    flex-direction: column;
}

.category-hero-stats strong {
    font-size: 1.4rem;
    font-weight: 700;
    color: #79c0ff;
}

.category-hero-stats span {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
}

.category-hero-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
}

.hero-side-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 14px 18px;
    color: #ffffff;
    font-weight: 500;
    font-size: 0.95rem;
    backdrop-filter: blur(5px);
}

.hero-side-item i {
    color: #4ea8de;
    font-size: 1.2rem;
}

/* --- Breadcrumbs --- */
.breadcrumb-simple {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    font-size: 0.9rem;
}

.breadcrumb-simple a, .breadcrumb-simple span {
    color: #64748b;
    font-weight: 500;
    transition: color 0.2s;
}

.breadcrumb-simple a:hover {
    color: #0b4f8a;
}

.breadcrumb-simple i {
    font-size: 0.7rem;
    color: #94a3b8;
}

/* --- Layout Principal --- */
.category-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    align-items: start;
}

/* --- Sidebar Avanzado --- */
.category-sidebar {
    position: sticky;
    top: 96px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    background: #ffffff;
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
}

.sidebar-section h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-section h3 i {
    color: #0b4f8a;
}

.active-filters-box {
    border-color: #fca5a5;
    background: #fff5f5;
}

.active-filters-box h3 {
    color: #dc2626;
}

.facet-clear {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #dc2626;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 0;
    transition: opacity 0.2s;
}

.facet-clear:hover {
    opacity: 0.8;
}

/* --- Árbol de Categorías Interactivo --- */
.cat-tree {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cat-item {
    border-radius: 10px;
    overflow: hidden;
}

.cat-row {
    display: flex;
    align-items: center;
    background: transparent;
    border-radius: 10px;
    transition: background 0.2s;
}

.cat-row:hover {
    background: #f8fafc;
}

.cat-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
    color: #334155;
    font-weight: 500;
}

.cat-link i {
    color: #64748b;
    font-size: 0.9rem;
    width: 16px;
    text-align: center;
}

.cat-link span {
    flex: 1;
}

.cat-link .count {
    background: #f1f5f9;
    color: #64748b;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.cat-link.active {
    background: #0b4f8a;
    color: #ffffff;
    border-radius: 10px;
}

.cat-link.active i, .cat-link.active .count {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
}

.cat-toggle {
    background: none;
    border: none;
    padding: 10px 12px;
    color: #64748b;
    cursor: pointer;
    transition: transform 0.3s;
}

.cat-item.open .cat-toggle i {
    transform: rotate(180deg);
}

.cat-sub {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 6px 0 6px 28px;
}

.cat-item.open .cat-sub {
    display: flex;
}

.cat-sub-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    font-size: 0.85rem;
    color: #64748b;
    border-radius: 8px;
    transition: all 0.2s;
}

.cat-sub-link span i {
    font-size: 0.65rem;
    margin-right: 4px;
    color: #94a3b8;
}

.cat-sub-link:hover {
    background: #f1f5f9;
    color: #0b4f8a;
}

.cat-sub-link.active {
    background: #e0f2fe;
    color: #0369a1;
    font-weight: 600;
}

/* --- Facet Pills (Filtros precio/oferta) --- */
.facet-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.facet-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8fafc;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.facet-pill i {
    color: #0b4f8a;
    font-size: 0.9rem;
}

.facet-pill:hover {
    background: #edf2f7;
    border-color: #cbd5e1;
}

.facet-pill.active {
    background: #0b4f8a;
    color: #ffffff;
    border-color: #0b4f8a;
}

.facet-pill.active i {
    color: #ffffff;
}

/* --- Toolbar Superior de Productos --- */
.category-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    padding: 16px 24px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 16px;
}

.toolbar-count {
    color: #64748b;
    font-size: 0.95rem;
}

.toolbar-count strong {
    color: #1e293b;
}

.toolbar-sort {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-sort label {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-sort select {
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    font-family: inherit;
    font-size: 0.9rem;
    color: #1e293b;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.toolbar-sort select:focus {
    border-color: #0b4f8a;
    background: #ffffff;
}

/* --- Alerta de stock dentro de la tarjeta --- */
.badge-stock-alert {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(220, 38, 38, 0.9);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    z-index: 2;
}

/* --- Empty State --- */
.empty-state {
    background: #ffffff;
    border-radius: 20px;
    padding: 60px 20px;
    text-align: center;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.empty-state i {
    font-size: 4rem;
    color: #cbd5e1;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: #1e293b;
    margin-bottom: 8px;
}

.empty-state p {
    color: #64748b;
    margin-bottom: 24px;
}

/* --- Gradientes Dinámicos para Tarjetas --- */
.product-image-initial {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 6rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.2);
    z-index: 0;
    user-select: none;
}

.product-image.grad-1 { background: linear-gradient(135deg, #0f4c81 0%, #4ea8de 100%); }
.product-image.grad-2 { background: linear-gradient(135deg, #1b8f6a 0%, #6fd8a8 100%); }
.product-image.grad-3 { background: linear-gradient(135deg, #d5485f 0%, #f08a9a 100%); }
.product-image.grad-4 { background: linear-gradient(135deg, #f0a33b 0%, #f7d08a 100%); }
.product-image.grad-5 { background: linear-gradient(135deg, #6a4fc0 0%, #a58fe0 100%); }
.product-image.grad-6 { background: linear-gradient(135deg, #0f766e 0%, #4fd1c5 100%); }

/* --- Responsive Design Avanzado --- */
@media (max-width: 1024px) {
    .category-layout {
        grid-template-columns: 1fr;
    }
    .category-hero-card {
        grid-template-columns: 1fr;
    }
    .category-sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .category-hero-copy h1 {
        font-size: 1.8rem;
    }
    .category-sidebar {
        grid-template-columns: 1fr;
    }
}
/* --- BARRA DE BÚSQUEDA AVANZADA INTERNA --- */
.advanced-search-bar-container {
    background: #ffffff;
    padding: 18px 24px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
}

.advanced-search-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-input-wrapper {
    flex: 1;
    min-width: 260px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper i {
    position: absolute;
    left: 16px;
    color: #64748b;
    font-size: 1rem;
}

.search-input-wrapper input {
    width: 100%;
    padding: 12px 16px 12px 46px;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    font-size: 0.95rem;
    color: #1e293b;
    outline: none;
    transition: all 0.2s;
}

.search-input-wrapper input:focus {
    border-color: #0b4f8a;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(11, 79, 138, 0.1);
}

.btn-reset-filters {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: #f1f5f9;
    color: #475569;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
    text-decoration: none;
}

.btn-reset-filters:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.search-tag-indicator {
    background: #e0f2fe;
    color: #0369a1;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
}