/* ============================================
   VARIABLES GLOBALES
   ============================================ */
:root {
    --primary-color: #8a1a1a;
    --primary-dark: #6a1414;
    --primary-light: #f8e6e6;
    --light-bg: #f5f5f5;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.08);
    --card-hover-shadow: 0 8px 24px rgba(0,0,0,0.12);
    --oro-color: #ffd700;
    --plata-color: #c0c0c0;
    --bronce-color: #cd7f32;
}

/* ============================================
   ESTILOS DEL BODY
   ============================================ */
body.categorias-body {
    background-color: var(--light-bg);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ============================================
   CONTENEDOR PRINCIPAL
   ============================================ */
.categorias-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 15px;
}

/* ============================================
   TOP BAR - BREADCRUMB Y SELECTOR DE PAÍS EN UNA SOLA LÍNEA
   ============================================ */
.top-bar-categorias {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    margin-bottom: 20px !important;
    padding: 0 !important;
    gap: 20px !important;
}

/* Breadcrumb - Izquierda */
.top-bar-categorias nav {
    flex: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.breadcrumb-custom {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}

.breadcrumb-custom .breadcrumb-item {
    font-size: 0.9rem !important;
}

.breadcrumb-custom .breadcrumb-item a {
    color: #6c757d !important;
    text-decoration: none !important;
}

.breadcrumb-custom .breadcrumb-item a:hover {
    color: #8a1a1a !important;
}

.breadcrumb-custom .breadcrumb-item.active {
    color: #8a1a1a !important;
    font-weight: 600 !important;
}

/* Selector de país - Derecha */
.pais-selector-container-categorias {
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    max-width: 280px !important;
    flex-shrink: 0 !important;
}

.pais-selector-container-categorias .input-group {
    background: white !important;
    border-radius: 40px !important;
    border: 1px solid rgba(202, 26, 28, 0.2) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    margin: 0 !important;
    padding: 0 !important;
}

.pais-selector-container-categorias .input-group:hover {
    box-shadow: 0 4px 12px rgba(202, 26, 28, 0.15) !important;
    border-color: rgba(202, 26, 28, 0.3) !important;
}

.pais-selector-container-categorias .input-group-text {
    padding: 8px 0 8px 12px !important;
    background: transparent !important;
    border: none !important;
}

.pais-selector-container-categorias .form-select {
    border: none !important;
    background: transparent !important;
    font-size: 0.9rem !important;
    padding: 8px 12px 8px 8px !important;
    cursor: pointer !important;
    width: auto !important;
    min-width: 160px !important;
}

/* ============================================
   HEADER DE CATEGORÍA
   ============================================ */
.categoria-header {
    background: white;
    border-radius: 15px;
    padding: 25px 30px;
    margin-bottom: 25px;
    box-shadow: var(--card-shadow);
    border-left: 5px solid var(--primary-color);
}

.categoria-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.categoria-header .text-muted {
    margin-bottom: 0;
}

.badge-contador {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 8px 15px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.categorias-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
}

@media (max-width: 992px) {
    .categorias-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ============================================
   SIDEBAR DE FILTROS
   ============================================ */
.filters-sidebar {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--card-shadow);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.filter-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

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

.filter-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333;
    border-left: none;
    padding-left: 0;
}

.filter-title i {
    color: var(--primary-color);
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.filter-option {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: #f8f9fa;
    border-radius: 20px;
    text-decoration: none;
    color: #495057;
    font-size: 0.85rem;
    transition: all 0.2s;
    border: 1px solid #e9ecef;
}

.filter-option:hover {
    background: #e9ecef;
    color: var(--primary-color);
    transform: translateY(-1px);
}

.filter-option.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filter-group {
    margin-bottom: 15px;
}

.filter-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: #495057;
}

/* ============================================
   LISTA DE CATEGORÍAS - SIN SCROLL Y CON MEJOR ESPACIADO
   ============================================ */
.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
    /* Scroll eliminado */
}

.category-list li {
    margin-bottom: 8px;
}

.category-list .filter-option {
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    font-size: 0.9rem;
    display: flex !important;
    gap: 8px;
}

.category-list .filter-option:hover {
    background: #e9ecef;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    transform: translateX(3px);
}

/* Contenedor del icono y texto */
.category-list .filter-option .category-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

/* Icono de categoría */
.category-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    text-align: center;
    flex-shrink: 0;
}

/* Texto de la categoría */
.category-list .filter-option .category-name {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Categoría activa */
.category-list .filter-option.active {
    background: var(--primary-color);
    color: white;
    border-left-color: var(--primary-color);
    font-weight: 600;
}

/* Icono en categoría activa */
.category-list .filter-option.active .category-icon {
    color: white !important;
}

/* Contador de anuncios */
.category-count {
    font-size: 0.7rem;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
    color: #495057;
    font-weight: 600;
    flex-shrink: 0;
    margin-left: 8px;
}

/* Contador de anuncios - ESTADO ACTIVO */
.category-list .filter-option.active .category-count {
    background: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
    font-weight: 600;
}

/* Contador de anuncios - HOVER */
.category-list .filter-option:hover .category-count {
    background: rgba(0, 0, 0, 0.1);
    color: var(--primary-color);
}

/* Para cuando la categoría activa está en hover */
.category-list .filter-option.active:hover .category-count {
    background: rgba(255, 255, 255, 0.35) !important;
    color: #ffffff !important;
}

/* ============================================
   CONTENIDO PRINCIPAL
   ============================================ */
.categorias-content {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--card-shadow);
}

/* ============================================
   BARRA DE HERRAMIENTAS
   ============================================ */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.results-count {
    color: #6c757d;
    font-size: 0.95rem;
}

.view-options {
    display: flex;
    gap: 10px;
}

.view-btn {
    width: 40px;
    height: 40px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.3s ease;
    cursor: pointer;
}

.view-btn:hover,
.view-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.sort-select {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 15px;
    background: white;
    color: #333;
    font-size: 0.9rem;
    min-width: 180px;
}

/* ============================================
   GRID DE ANUNCIOS
   ============================================ */
.anuncios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

/* TARJETA DE ANUNCIO - FONDO BLANCO FORZADO */
.anuncio-card {
    background: white !important;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.anuncio-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-hover-shadow);
}

.anuncio-image {
    position: relative;
    width: 100%;
    background: #f8f9fa;
    overflow: hidden;
    height: 200px;
}

.anuncio-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.anuncio-card:hover .anuncio-image img {
    transform: scale(1.05);
}

/* Badge de operación */
.anuncio-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    text-transform: uppercase;
    z-index: 5;
}

.badge-venta {
    background: linear-gradient(135deg, #198754, #20c997);
    color: white;
}

.badge-alquiler {
    background: linear-gradient(135deg, #0d6efd, #6ea8fe);
    color: white;
}


/* Anuncios resaltados */
.anuncio-resaltado {
    border-width: 2px !important;
}

.anuncio-resaltado.oro {
    border-color: var(--oro-color) !important;
}

.anuncio-resaltado.plata {
    border-color: var(--plata-color) !important;
}

.anuncio-resaltado.bronce {
    border-color: var(--bronce-color) !important;
}

/* Contenido de la tarjeta */
.anuncio-content {
    padding: 18px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: white !important;
}

.anuncio-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}

.anuncio-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.anuncio-title a:hover {
    color: var(--primary-color);
}

.anuncio-location {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.anuncio-location i {
    color: var(--primary-color);
}

.anuncio-descripcion {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 12px;
    line-height: 1.4;
    flex-grow: 1;
}

.anuncio-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.anuncio-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
}

.anuncio-price small {
    font-size: 0.75rem;
    color: #6c757d;
}

.anuncio-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #6c757d;
    text-decoration: none;
}

.action-btn:hover {
    background: #e9ecef;
    color: var(--primary-color);
}

.like-btn.liked i {
    color: #ca1a1c;
}

/* ============================================
   VISTA LISTA
   ============================================ */
.anuncios-lista {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.anuncios-lista .anuncio-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 20px !important;
    height: auto;
    min-height: 200px;
}

.anuncios-lista .anuncio-image {
    width: 200px !important;
    flex-shrink: 0 !important;
    height: 150px !important;
}

.anuncios-lista .anuncio-image img {
    height: 100% !important;
    border-radius: 12px !important;
}

.anuncios-lista .anuncio-content {
    flex: 1 !important;
}

.anuncios-lista .anuncio-title {
    font-size: 1.2rem;
}

/* ============================================
   PAGINACIÓN
   ============================================ */
.pagination-custom {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: white;
    border: 1px solid #e9ecef;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s;
}

.page-link.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-link:hover:not(.active) {
    background: #e9ecef;
}

/* ============================================
   NO RESULTADOS
   ============================================ */
.no-results {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 16px;
}

.no-results-icon {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 20px;
}

.no-results h3 {
    color: #666;
    margin-bottom: 10px;
}

/* ============================================
   PAÍS ACTIVO BADGE
   ============================================ */
.pais-activo-badge-categorias {
    background: #e3f2fd;
    border-left: 4px solid #0d6efd;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* ============================================
   SLIDER DE PRECIO
   ============================================ */
.price-slider-container {
    margin-top: 10px;
}

.slider-with-input {
    margin-bottom: 15px;
}

.slider-label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 5px;
    color: #6c757d;
}

.slider-value {
    display: inline-block;
    margin-top: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* ============================================
   BOTONES DE FILTROS
   ============================================ */
.apply-filters-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
    width: 100%;
    margin-top: 15px;
}

.apply-filters-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.reset-filters {
    color: #dc3545;
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-block;
}

.reset-filters:hover {
    text-decoration: underline;
}

/* ============================================
   INDICADORES DE RESALTADO
   ============================================ */
.resaltado-indicator {
    display: inline-block;
    margin-left: 5px;
}

.resaltado-oro-indicator i {
    color: var(--oro-color);
}

.resaltado-plata-indicator i {
    color: var(--plata-color);
}

.resaltado-bronce-indicator i {
    color: var(--bronce-color);
}

.orden-activo {
    background: rgba(255,215,0,0.2);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    margin-left: 8px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .categoria-header {
        padding: 20px;
    }
    
    .categoria-header h1 {
        font-size: 1.5rem;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .view-options {
        justify-content: center;
    }
    
    .sort-select {
        width: 100%;
    }
    
    .filters-sidebar {
        position: static;
    }
    
    .anuncios-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .anuncios-lista .anuncio-card {
        flex-direction: column !important;
    }
    
    .anuncios-lista .anuncio-image {
        width: 100% !important;
        height: 200px !important;
    }
    
    /* Responsive para top bar - se apila en móviles */
    .top-bar-categorias {
        flex-wrap: wrap !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }
    
    .pais-selector-container-categorias {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .pais-selector-container-categorias .form-select {
        width: 100% !important;
    }
}