/* ============================================
   BLOG STYLES ENHANCED - Corporación Safari
   Fully responsive to light/dark theme
   ============================================ */

/* ============================================
   BUSCADOR MEJORADO
   ============================================ */

.blog-search-container {
    position: relative;
    margin-bottom: 2rem;
    width: 100%;
}

.blog-search-container input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid hsl(var(--border));
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.blog-search-container input:focus {
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 4px rgba(94, 44, 165, 0.1), 0 4px 16px rgba(0, 0, 0, 0.1);
    outline: none;
    transform: translateY(-2px);
}

.blog-search-container input::placeholder {
    color: hsl(var(--muted-foreground));
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.search-suggestions.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    animation: slideDown 0.2s ease;
}

.search-suggestion-item {
    padding: 14px 16px;
    border-bottom: 1px solid hsl(var(--border));
    cursor: pointer;
    transition: all 0.2s;
    display: block;
}

.search-suggestion-item:last-child {
    border-bottom: none;
}

.search-suggestion-item:hover {
    background: hsl(var(--muted));
    padding-left: 20px;
}

.search-suggestion-item strong {
    color: hsl(var(--primary));
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.search-suggestion-item p {
    font-size: 0.85rem;
    color: hsl(var(--muted-foreground));
    margin: 0;
}

/* ============================================
   FILTROS SIDEBAR
   ============================================ */

.blog-filters-sidebar {
    background: hsl(var(--background));
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid hsl(var(--border));
    position: fixed;
    top: 100px;
    right: 20px;
    width: 280px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 50;
}

.filters-close-btn {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: hsl(var(--foreground));
}

.filters-toggle-btn {
    display: none;
    padding: 10px 16px;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}

.filters-toggle-btn:hover {
    background: hsl(var(--primary) / 0.9);
}

.blog-filters-sidebar h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: hsl(var(--primary));
    margin-bottom: 1.5rem;
}

.filter-group {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid hsl(var(--border));
}

.filter-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-group h4 {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    color: hsl(var(--primary));
    margin-bottom: 0.75rem;
    letter-spacing: 0.5px;
}

.filter-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: hsl(var(--foreground));
    transition: all 0.2s;
}

.filter-group label:hover {
    color: hsl(var(--primary));
    padding-left: 4px;
}

.filter-group input[type="checkbox"] {
    margin-right: 0.75rem;
    cursor: pointer;
    accent-color: hsl(var(--primary));
    width: 18px;
    height: 18px;
    border-radius: 4px;
}

#clear-filters {
    font-size: 0.85rem;
    background: hsl(var(--background));
    color: hsl(var(--primary));
    border-color: hsl(var(--primary));
}

#clear-filters:hover {
    background: hsl(var(--primary) / 0.1);
}

/* ============================================
   TARJETAS DE ARTÍCULOS MEJORADAS
   ============================================ */

.article-card {
    background: hsl(var(--background));
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid hsl(var(--border));
}

.article-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    border-color: hsl(var(--primary));
}

.article-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    overflow: hidden;
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--secondary)));
}

.article-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.article-card:hover .article-image-wrapper img {
    transform: scale(1.08);
}

.category-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 14px;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(94, 44, 165, 0.3);
}

.reading-time {
    position: absolute;
    bottom: 12px;
    left: 12px;
    padding: 6px 14px;
    background: hsl(var(--background) / 0.95);
    color: hsl(var(--foreground));
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.article-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.article-content h3 {
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    color: hsl(var(--foreground));
    transition: color 0.2s;
}

.article-card:hover .article-content h3 {
    color: hsl(var(--primary));
}

.article-content .excerpt {
    font-size: 0.9rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.6;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid hsl(var(--border));
}

.article-meta .author {
    font-weight: 500;
    color: hsl(var(--primary));
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    background: hsl(var(--muted));
    color: hsl(var(--primary));
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.tag:hover {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.read-more {
    display: inline-flex;
    align-items: center;
    color: hsl(var(--primary));
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s;
    gap: 0;
    position: relative;
    overflow: hidden;
}

.read-more:hover {
    gap: 0.5rem;
    transform: translateX(2px);
}

/* ============================================
   ARTÍCULOS DESTACADOS
   ============================================ */

.featured-articles {
    margin-bottom: 3rem;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

/* ============================================
   TRENDING
   ============================================ */

.trending-articles {
    background: hsl(var(--background));
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid hsl(var(--border));
}

.trending-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.trending-list li {
    padding: 1.25rem 0;
    border-bottom: 1px solid hsl(var(--border));
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s;
}

.trending-list li:last-child {
    border-bottom: none;
}

.trending-list li:hover {
    padding-left: 0.5rem;
}

.trending-list li::before {
    content: attr(data-rank);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--secondary)));
    color: hsl(var(--primary-foreground));
    border-radius: 50%;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(94, 44, 165, 0.3);
}

.trending-list a {
    color: hsl(var(--foreground));
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    flex-grow: 1;
}

.trending-list a:hover {
    color: hsl(var(--primary));
}

.trending-list .text-xs {
    font-size: 0.75rem;
    white-space: nowrap;
    color: hsl(var(--muted-foreground));
}

/* ============================================
   NEWSLETTER CTA
   ============================================ */

.newsletter-cta {
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--secondary)));
    color: hsl(var(--primary-foreground));
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(94, 44, 165, 0.2);
}

.newsletter-cta h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.newsletter-cta p {
    font-size: 0.9rem;
    opacity: 0.95;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.newsletter-cta input {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
}

.newsletter-cta input::placeholder {
    color: hsl(var(--muted-foreground));
}

.newsletter-cta button {
    width: 100%;
    padding: 12px 16px;
    background: hsl(var(--primary-foreground));
    color: hsl(var(--primary));
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.newsletter-cta button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ============================================
   PAGINACIÓN
   ============================================ */

#pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.pagination-btn:hover {
    border-color: hsl(var(--primary));
    color: hsl(var(--primary));
    background: hsl(var(--primary) / 0.1);
}

.pagination-btn.active {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

/* ============================================
   ANIMACIONES
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
    .blog-filters-sidebar {
        position: fixed;
        top: 80px;
        right: 10px;
        width: 260px;
    }
}

@media (max-width: 768px) {
    .blog-filters-sidebar {
        display: none;
    }
    
    .filters-toggle-btn {
        display: block;
    }
    
    .filter-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .filter-group h4 {
        grid-column: 1 / -1;
    }
    
    .featured-grid {
        grid-template-columns: 1fr;
    }
    
    .article-content {
        padding: 1.25rem;
    }
    
    .article-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .trending-list li {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .trending-list .text-xs {
        align-self: flex-end;
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    .blog-search-container input {
        padding: 12px 14px;
        font-size: 16px;
    }
    
    .category-badge {
        padding: 4px 10px;
        font-size: 0.7rem;
    }
    
    .article-content h3 {
        font-size: 1rem;
    }
    
    .article-tags {
        gap: 0.25rem;
    }
    
    .tag {
        padding: 3px 10px;
        font-size: 0.7rem;
    }
}
