/* Estilos modernos para fichas de anuncios - Inspirado en Backmarket */

/* Variables CSS para consistencia */
:root {
    --primary-color: #059669;
    --primary-hover: #047857;
    --secondary-color: #3b82f6;
    --secondary-hover: #1d4ed8;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e0;
    --background-card: #ffffff;
    --background-hover: #f8fafc;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Grid de anuncios - Diseño responsive optimizado y compatible con Bootstrap */
.ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin: 0;
    padding: 0;
    width: 100%;
}

/* Anuncios patrocinados con diferentes niveles */

/* Nivel 1 - PREMIUM GOLD (patrocinado1 y patrocinado2) - Tarjeta premium dorada (LINGOTE DE ORO) */
.ad-card.premium-gold,
.ad-card.premium-silver {
    background: linear-gradient(135deg, 
        #d4af37 0%, 
        #ffd700 15%, 
        #ffed4e 30%, 
        #ffd700 45%, 
        #d4af37 60%, 
        #ffd700 75%, 
        #ffed4e 90%, 
        #d4af37 100%) !important;
    background-size: 300% 300% !important;
    animation: goldenShimmer 4s ease-in-out infinite !important;
    border: 4px solid #b8860b !important;
    border-radius: 16px !important;
    box-shadow: 
        0 0 25px rgba(212, 175, 55, 0.8),
        0 0 50px rgba(255, 215, 0, 0.6),
        0 10px 60px rgba(184, 134, 11, 0.5),
        0 20px 80px rgba(212, 175, 55, 0.4),
        inset 0 0 40px rgba(255, 215, 0, 0.2),
        inset 0 2px 10px rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.03) !important;
    position: relative !important;
    overflow: visible !important;
    transition: all 0.3s ease !important;
}

@keyframes goldenShimmer {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.ad-card.premium-gold::before,
.ad-card.premium-silver::before {
    content: '' !important;
    position: absolute !important;
    top: -4px !important;
    left: -4px !important;
    right: -4px !important;
    bottom: -4px !important;
    background: linear-gradient(45deg, 
        #b8860b, #d4af37, #ffd700, #ffed4e, 
        #ffd700, #d4af37, #b8860b, #d4af37, 
        #ffd700, #ffed4e, #b8860b) !important;
    background-size: 500% 500% !important;
    border-radius: 16px !important;
    z-index: -1 !important;
    animation: borderShine 4s linear infinite !important;
    opacity: 0.9 !important;
}

@keyframes borderShine {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

.ad-card.premium-gold .ad-image-container,
.ad-card.premium-silver .ad-image-container {
    position: relative !important;
    border-bottom: 4px solid rgba(184, 134, 11, 0.6) !important;
    background: linear-gradient(135deg, 
        rgba(255, 248, 220, 0.3) 0%, 
        rgba(255, 240, 200, 0.2) 100%) !important;
}

.ad-card.premium-gold .ad-image-container::after,
.ad-card.premium-silver .ad-image-container::after {
    content: '⭐ PREMIUM' !important;
    position: absolute !important;
    top: -15px !important;
    left: 15px !important;
    background: linear-gradient(135deg, #d4af37 0%, #ffd700 50%, #d4af37 100%) !important;
    color: #1a1a1a !important;
    padding: 8px 18px !important;
    border-radius: 25px !important;
    font-size: 12px !important;
    font-weight: 900 !important;
    letter-spacing: 1.5px !important;
    text-transform: uppercase !important;
    box-shadow: 
        0 5px 20px rgba(212, 175, 55, 0.8),
        0 0 30px rgba(255, 215, 0, 0.6),
        inset 0 2px 5px rgba(255, 255, 255, 0.4) !important;
    z-index: 15 !important;
    border: 3px solid #fff !important;
    animation: premiumPulse 2.5s ease-in-out infinite !important;
}

@keyframes premiumPulse {
    0%, 100% {
        transform: scale(1) translateY(0);
        box-shadow: 
            0 5px 20px rgba(212, 175, 55, 0.8),
            0 0 30px rgba(255, 215, 0, 0.6),
            inset 0 2px 5px rgba(255, 255, 255, 0.4);
    }
    50% {
        transform: scale(1.08) translateY(-2px);
        box-shadow: 
            0 8px 25px rgba(212, 175, 55, 1),
            0 0 40px rgba(255, 215, 0, 0.8),
            inset 0 2px 5px rgba(255, 255, 255, 0.5);
    }
}

/* Nota: premium-silver ahora usa los mismos estilos dorados que premium-gold */
/* Los estilos se aplican a ambos en la sección anterior */

/* Efecto hover para anuncios premium gold y silver */
.ad-card.premium-gold:hover,
.ad-card.premium-silver:hover {
    transform: translateY(-15px) scale(1.05) !important;
    box-shadow: 
        0 0 40px rgba(212, 175, 55, 1),
        0 0 80px rgba(255, 215, 0, 0.8),
        0 20px 90px rgba(184, 134, 11, 0.6),
        0 30px 100px rgba(212, 175, 55, 0.5),
        inset 0 0 50px rgba(255, 215, 0, 0.3),
        inset 0 3px 15px rgba(255, 255, 255, 0.5) !important;
}

/* Contenido de anuncios premium dorados */
.ad-card.premium-gold .ad-content,
.ad-card.premium-silver .ad-content {
    background: linear-gradient(180deg, 
        rgba(255, 248, 220, 0.98) 0%, 
        rgba(255, 240, 200, 0.95) 50%,
        rgba(255, 235, 180, 0.92) 100%) !important;
    border-radius: 0 0 12px 12px !important;
}

.ad-card.premium-gold .ad-title,
.ad-card.premium-silver .ad-title {
    font-weight: 900 !important;
    text-shadow: 
        0 2px 4px rgba(212, 175, 55, 0.4),
        0 1px 2px rgba(184, 134, 11, 0.3) !important;
    background: linear-gradient(135deg, #b8860b 0%, #1a1a1a 30%, #b8860b 60%, #1a1a1a 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    background-size: 200% 200% !important;
    animation: titleShine 3s ease-in-out infinite !important;
}

@keyframes titleShine {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.ad-card.premium-gold .ad-price,
.ad-card.premium-silver .ad-price {
    font-weight: 900 !important;
    font-size: 1.5em !important;
    text-shadow: 
        0 3px 6px rgba(212, 175, 55, 0.6),
        0 1px 3px rgba(184, 134, 11, 0.5) !important;
    background: linear-gradient(135deg, #ffd700 0%, #d4af37 30%, #b8860b 60%, #ffd700 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    background-size: 200% 200% !important;
    animation: priceShine 2.5s ease-in-out infinite !important;
}

@keyframes priceShine {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Grid responsive optimizado - compatible con Bootstrap */
@media (max-width: 1200px) {
    .ads-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .ads-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
    }

    .ad-image-container {
        height: 200px;
    }
}

/* Responsive simplificado para móviles */
@media (max-width: 576px) {
    .ads-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 0.75rem;
    }

    .ad-image-container {
        height: 180px;
    }
}

/* Los estilos básicos de .ad-card ya están definidos arriba */

.ad-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Contenedor de imagen */
.ad-image-container {
    position: relative;
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.ad-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

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

/* Contenedor de video embebido */
.ad-video-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    cursor: pointer;
}

.ad-video-thumbnail-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    transition: opacity 0.3s ease;
}

.ad-video-container:hover .ad-video-thumbnail-preview {
    opacity: 0;
}

.ad-video-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    object-fit: cover;
    z-index: 1;
}

/* Mantener compatibilidad con thumbnail (por si se necesita en el futuro) */
.ad-video-thumbnail-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.ad-video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.ad-card:hover .ad-video-thumbnail {
    transform: scale(1.05);
}

/* Overlay de play button estilo YouTube (mantener para compatibilidad) */
.ad-youtube-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0.9;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.ad-card:hover .ad-youtube-play-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.4);
}

.ad-youtube-play-button {
    width: 68px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.ad-card:hover .ad-youtube-play-button {
    transform: scale(1.1);
}

.ad-youtube-play-button svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

/* Badge de video en tarjetas de anuncios */
.ad-video-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(220, 53, 69, 0.95);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(4px);
}

.ad-video-badge i {
    font-size: 14px;
}

.ad-video-badge span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Placeholder para imágenes */
.ad-no-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 2.5rem;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
}

.ad-no-image i {
    margin-bottom: 8px;
    opacity: 0.6;
}

/* Badge de precio */
/* Badge de destacado */
.ad-featured-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.025em;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
}

.ad-featured-badge i {
    font-size: 0.875rem;
    color: #000;
}

.ad-featured-badge span {
    font-weight: 700;
}

/* Badge de precio */
.ad-price-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: -0.025em;
    z-index: 9;
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-md);
}

/* Contenido de la ficha */
.ad-content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Título del anuncio */
.ad-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

/* Precio principal */
.ad-price {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 4px 0;
    letter-spacing: -0.025em;
}

/* Metadatos del anuncio */
.ad-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: auto;
}

.ad-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ad-meta-item i {
    font-size: 0.75rem;
    width: 12px;
    text-align: center;
    color: var(--text-muted);
}

/* Estilos específicos para la información del país */
.ad-country {
    font-weight: 600;
    color: var(--text-secondary);
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid #bae6fd;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ad-country:hover {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    transform: translateY(-1px);
    transition: var(--transition);
}

/* Estado del producto */
.ad-condition {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #f0fdf4;
    color: #166534;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.ad-condition.new {
    background: #eff6ff;
    color: #1d4ed8;
}

.ad-condition.used {
    background: #fef3c7;
    color: #92400e;
}

/* Ubicación */
.ad-location {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Fecha de publicación */
.ad-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.8;
}

/* Reglas de compatibilidad hacia atrás para anuncios destacados antiguos */
.ad-card.featured:not(.premium-gold):not(.premium-silver) {
    border: 2px solid #fbbf24;
    position: relative;
}

.ad-card.featured:not(.premium-gold):not(.premium-silver)::before {
    content: '⭐ Destacado';
    position: absolute;
    top: 12px;
    left: 12px;
    background: #fbbf24;
    color: white;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 2;
}

/* Ficha de anuncio promocionado */
.ad-card.promoted {
    border: 2px solid var(--secondary-color);
    position: relative;
}

.ad-card.promoted::before {
    content: '🚀 Promocionado';
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--secondary-color);
    color: white;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 2;
}

/* Estados de hover mejorados */
.ad-card:hover .ad-title {
    color: var(--secondary-color);
}

.ad-card:hover .ad-price {
    color: var(--primary-hover);
}

/* Estilos responsive adicionales para listas de anuncios */
@media (max-width: 768px) {
    .ads-list .ad-card {
        grid-template-columns: 150px 1fr;
        gap: 0;
    }
    
    .ads-list .ad-image-container {
        height: 120px;
    }
    
    .ads-list .ad-content {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .ads-list .ad-card {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .ads-list .ad-image-container {
        height: 160px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .ads-list .ad-content {
        padding: 14px;
    }
}

/* Fichas de anuncios relacionados */
.related-ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.related-ad-card {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.related-ad-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.related-ad-image {
    height: 140px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.related-ad-content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.related-ad-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-ad-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

/* Estilos para listas de anuncios */
.ads-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ads-list .ad-card {
    display: grid;
    grid-template-columns: 200px 1fr;
    height: auto;
    gap: 0;
}

.ads-list .ad-image-container {
    height: 150px;
    border-bottom: none;
    border-right: 1px solid var(--border-color);
}

.ads-list .ad-content {
    padding: 20px;
}

/* Estados de carga */
.ad-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.ad-card.loading .ad-image-container {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Mejoras de accesibilidad */
.ad-card:focus-within {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

.ad-link:focus {
    outline: none;
}

/* Animaciones suaves */
.ad-card,
.ad-image,
.ad-title,
.ad-price {
    transition: var(--transition);
}

/* Estilos para categorías */
.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--background-hover);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
    margin-bottom: 8px;
}

.category-badge i {
    font-size: 0.625rem;
}

/* Estilos para badges de filtros */
.ad-filter-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.filter-badge {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #495057;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: var(--transition);
    white-space: nowrap;
}

.filter-badge:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    transform: translateY(-1px);
}

.filter-badge .badge-label {
    font-weight: 600;
    color: #6c757d;
    font-size: 0.65rem;
}

.filter-badge .badge-value {
    font-weight: 500;
    color: #495057;
    font-size: 0.7rem;
}

/* Colores específicos para diferentes tipos de filtros */
.filter-badge.badge-year {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    border-color: #ff6b6b;
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.2);
}

.filter-badge.badge-year .badge-label,
.filter-badge.badge-year .badge-value {
    color: white;
}

.filter-badge.badge-km {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white;
    border-color: #4ecdc4;
    box-shadow: 0 2px 4px rgba(78, 205, 196, 0.2);
}

.filter-badge.badge-km .badge-label,
.filter-badge.badge-km .badge-value {
    color: white;
}

.filter-badge.badge-fuel {
    background: linear-gradient(135deg, #45b7d1, #96c93d);
    color: white;
    border-color: #45b7d1;
    box-shadow: 0 2px 4px rgba(69, 183, 209, 0.2);
}

.filter-badge.badge-fuel .badge-label,
.filter-badge.badge-fuel .badge-value {
    color: white;
}

.filter-badge.badge-transmission {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
    border-color: #f093fb;
    box-shadow: 0 2px 4px rgba(240, 147, 251, 0.2);
}

.filter-badge.badge-transmission .badge-label,
.filter-badge.badge-transmission .badge-value {
    color: white;
}

.filter-badge.badge-default {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2);
}

.filter-badge.badge-default .badge-label,
.filter-badge.badge-default .badge-value {
    color: white;
}

/* Contador de fotos */
.ad-photos {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Responsive para badges de filtros */
@media (max-width: 768px) {
    .ad-filter-badges {
        gap: 4px;
    }
    
    .filter-badge {
        font-size: 0.65rem;
        padding: 2px 6px;
    }
    
    .filter-badge .badge-label {
        font-size: 0.6rem;
    }
    
    .filter-badge .badge-value {
        font-size: 0.65rem;
    }
}

/* Estilos para enlaces de categorías jerárquicas */
.filter-option-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin: 4px 0;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
}

.filter-option-link:hover {
    background: var(--background-hover);
    border-color: var(--border-hover);
    color: var(--primary-color);
    transform: translateX(4px);
}

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

.filter-option-link i {
    margin-right: 8px;
    font-size: 16px;
    width: 16px;
    text-align: center;
}

.subcategory-indicator {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: bold;
}

.filter-option-link.active .subcategory-indicator {
    color: rgba(255, 255, 255, 0.8);
}

/* Responsive para enlaces de categorías */
@media (max-width: 768px) {
    .filter-option-link {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .filter-option-link i {
        font-size: 14px;
        margin-right: 6px;
    }
}

/* ===== FILTROS JERÁRQUICOS MEJORADOS ===== */

/* Contenedor principal de categorías jerárquicas */
.hierarchical-categories {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Sección de filtros de categorías */
.category-filter-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #e9ecef;
}

.category-filter-section .filter-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin: -16px -16px 16px -16px;
    padding: 16px;
    border-radius: 12px 12px 0 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Niveles de categorías */
.category-level {
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.category-level:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Headers de niveles */
.level-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.level-header:hover {
    background: #f8f9fa;
}

.level-title {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    position: relative;
}

.level-icon {
    font-size: 12px;
    color: #6c757d;
    transition: transform 0.2s ease;
}

.level-text {
    flex: 1;
}

.level-count {
    background: #e9ecef;
    color: #6c757d;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

/* Colores específicos para cada nivel */
.level-1 .level-title {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #1565c0;
    border-bottom: 2px solid #2196f3;
}

.level-2 .level-title {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    color: #2e7d32;
    border-bottom: 2px solid #4caf50;
}

.level-3 .level-title {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    color: #f57c00;
    border-bottom: 2px solid #ff9800;
}

/* Contenido de niveles */
.level-content {
    padding: 0;
    background: white;
}

/* Opciones de filtro */
.filter-options {
    padding: 8px;
}

.filter-option-link {
    display: block;
    text-decoration: none;
    color: #495057;
    border-radius: 6px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.filter-option-link:hover {
    text-decoration: none;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.option-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}

.option-icon {
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.option-text {
    font-weight: 500;
    font-size: 13px;
}

/* Estilos específicos por nivel */
.level-1-option {
    background: #f8f9ff;
    border-left: 3px solid #2196f3;
}

.level-1-option:hover {
    background: #e3f2fd;
    border-left-color: #1976d2;
}

.level-1-option.active {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: white;
    border-left-color: #0d47a1;
}

.level-2-option {
    background: #f1f8e9;
    border-left: 3px solid #4caf50;
    margin-left: 12px;
}

.level-2-option:hover {
    background: #e8f5e8;
    border-left-color: #388e3c;
}

.level-2-option.active {
    background: linear-gradient(135deg, #4caf50, #388e3c);
    color: white;
    border-left-color: #2e7d32;
}

.level-3-option {
    background: #fffbf0;
    border-left: 3px solid #ff9800;
    margin-left: 24px;
}

.level-3-option:hover {
    background: #fff8e1;
    border-left-color: #f57c00;
}

.level-3-option.active {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    border-left-color: #e65100;
}

/* Grupos de subcategorías */
.subcategory-group {
    margin-bottom: 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}

.subcategory-parent {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    color: #2e7d32;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #c8e6c9;
}

.subcategory-children {
    padding: 4px;
    background: white;
}

/* Grupos de microcategorías */
.microcategory-group {
    margin-bottom: 16px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}

.microcategory-grandparent {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #1565c0;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #bbdefb;
}

.microcategory-parent {
    border-bottom: 1px solid #f0f0f0;
}

.microcategory-parent:last-child {
    border-bottom: none;
}

.microcategory-parent-header {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    color: #f57c00;
    padding: 6px 12px 6px 20px;
    font-weight: 600;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #ffecb3;
}

.microcategory-children {
    padding: 4px 4px 4px 32px;
    background: white;
}

/* Estados activos */
.level-1-option.active .option-icon,
.level-2-option.active .option-icon,
.level-3-option.active .option-icon {
    color: rgba(255, 255, 255, 0.9);
}

.level-1-option.active .option-text,
.level-2-option.active .option-text,
.level-3-option.active .option-text {
    color: white;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .hierarchical-categories {
        gap: 8px;
    }
    
    .category-filter-section {
        padding: 12px;
    }
    
    .category-filter-section .filter-title {
        margin: -12px -12px 12px -12px;
        padding: 12px;
        font-size: 14px;
    }
    
    .level-title {
        padding: 12px;
        font-size: 13px;
    }
    
    .option-content {
        padding: 8px 10px;
    }
    
    .option-text {
        font-size: 12px;
    }
    
    .level-2-option {
        margin-left: 8px;
    }
    
    .level-3-option {
        margin-left: 16px;
    }
    
    .microcategory-children {
        padding-left: 24px;
    }
    
    .subcategory-parent,
    .microcategory-grandparent,
    .microcategory-parent-header {
        font-size: 11px;
        padding: 6px 10px;
    }
}
