/* ============================================
   CATEGORY PAGE MODERN - LE BULLETIN ÉCONOMIQUE
   Design Premium avec animations et micro-interactions
   Version 3.1 - FIX LARGEUR COMPLÈTE
   ============================================ */

/* --- RESETS CRITIQUES PRIORITAIRES --- */
/* Neutraliser TOUS les styles GeneratePress qui limitent la largeur */
.category-page-modern,
.category-page-modern * {
    box-sizing: border-box;
}

.category-page-modern {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden;
}

/* Forcer le body à ne pas limiter la largeur sur les pages catégories */
body.category {
    max-width: 100% !important;
}

body.category #page,
body.category .site {
    max-width: 100% !important;
}

body.category #content {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* --- FIXES CRITIQUES GENERATEPRESS --- */
/* Forcer la largeur complète et désactiver les limites du thème parent */
.category-page-modern {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

/* Neutraliser les conteneurs GeneratePress qui limitent la largeur */
.category-page-modern .container,
.category-page-modern .grid-container {
    max-width: 1400px !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
}

/* Fix pour les sections pleine largeur */
.category-hero,
.category-controls {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.category-hero .container,
.category-controls .container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding-left: 40px;
    padding-right: 40px;
}

/* --- HERO SECTION --- */
.category-hero {
    position: relative;
    padding: 120px 0 160px;
    color: white;
    overflow: hidden;
    min-height: 60vh;
    display: flex;
    align-items: center;
}

/* Pattern de fond animé */
.hero-pattern {
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255,255,255,0.05) 0%, transparent 50%);
    animation: patternMove 20s ease-in-out infinite alternate;
}

@keyframes patternMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(30px, -30px); }
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.category-breadcrumb {
    font-size: 0.9rem;
    margin-bottom: 25px;
    opacity: 0.9;
    animation: fadeInDown 0.6s ease-out;
}

.category-breadcrumb a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.category-breadcrumb a:hover {
    opacity: 0.7;
}

.category-breadcrumb .separator {
    margin: 0 10px;
    opacity: 0.5;
}

.category-badge-hero {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    animation: fadeInDown 0.6s ease-out 0.1s both;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin: 0 0 30px 0;
    animation: fadeInUp 0.8s ease-out 0.2s both;
    text-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.hero-description {
    font-size: 1.3rem;
    line-height: 1.6;
    opacity: 0.95;
    margin-bottom: 50px;
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

.hero-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin-bottom: 40px;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: white;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: rgba(255,255,255,0.3);
}

.hero-newsletter {
    animation: fadeInUp 0.8s ease-out 0.5s both;
}

.inline-newsletter-form {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.2);
}

.inline-newsletter-form input {
    flex: 1;
    padding: 15px 25px;
    border: none;
    background: transparent;
    color: white;
    font-size: 1rem;
}

.inline-newsletter-form input::placeholder {
    color: rgba(255,255,255,0.7);
}

.inline-newsletter-form button {
    padding: 15px 30px;
    border: none;
    background: white;
    color: var(--cat-primary, #0A2463);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.inline-newsletter-form button:hover {
    transform: scale(1.05);
}

/* Vagues décoratives */
.hero-waves {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.hero-waves svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 80px;
    color: var(--be-bg-body, #ffffff);
}

/* --- BARRE DE CONTRÔLES --- */
.category-controls {
    padding: 30px 0;
    background: var(--be-bg-surface, #f8fafc);
    border-bottom: 1px solid var(--be-border, #e2e8f0);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.controls-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 2px solid transparent;
    background: white;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--be-text-main, #1e293b);
}

.filter-btn:hover {
    background: var(--be-bg-secondary, #f1f5f9);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--cat-primary, #0A2463);
    color: white;
    border-color: var(--cat-primary, #0A2463);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.filter-icon {
    font-size: 1.1rem;
}

.sort-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--be-text-muted, #64748b);
}

.sort-select {
    padding: 10px 15px;
    border: 2px solid var(--be-border, #e2e8f0);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.sort-select:hover,
.sort-select:focus {
    border-color: var(--cat-primary, #0A2463);
    outline: none;
}

.view-toggle {
    display: flex;
    gap: 5px;
    background: white;
    border-radius: 8px;
    padding: 5px;
    border: 2px solid var(--be-border, #e2e8f0);
}

.view-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--be-text-muted, #64748b);
}

.view-btn:hover {
    background: var(--be-bg-secondary, #f1f5f9);
    color: var(--be-text-main, #1e293b);
}

.view-btn.active {
    background: var(--cat-primary, #0A2463);
    color: white;
}

/* --- LAYOUT PRINCIPAL --- */
.category-content {
    padding: 60px 0;
    background: var(--be-bg-body, #ffffff);
    width: 100%;
}

.content-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 50px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Fix anti-collapse sur desktop */
@media (min-width: 1025px) {
    .content-layout {
        grid-template-columns: minmax(0, 1fr) 350px !important;
    }
}

/* --- GRILLE D'ARTICLES --- */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    animation: fadeIn 0.6s ease-out;
    width: 100%;
}

/* Fix pour éviter le débordement */
.articles-main {
    min-width: 0;
    width: 100%;
}

/* Vue liste */
.articles-grid.view-list {
    grid-template-columns: 1fr;
}

.articles-grid.view-list .article-card-modern {
    display: flex;
    flex-direction: row;
    height: auto;
}

.articles-grid.view-list .card-image-wrapper {
    width: 280px;
    height: 200px;
    flex-shrink: 0;
}

.articles-grid.view-list .card-body {
    flex: 1;
}

/* --- CARTE ARTICLE MODERNE --- */
.article-card-modern {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--be-border, #e2e8f0);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.article-card-modern:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    border-color: var(--cat-accent, #3E92CC);
}

.card-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--be-bg-secondary, #f1f5f9);
}

.card-image-link {
    display: block;
    width: 100%;
    height: 100%;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.article-card-modern:hover .card-image {
    transform: scale(1.08);
}

.card-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    opacity: 0.3;
}

.card-overlay {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 2;
}

.card-category {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 20px;
}

.card-badge-premium {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #D4AF37 0%, #FFD700 100%);
    color: #0A2463;
    font-size: 0.75rem;
    font-weight: 800;
    border-radius: 20px;
    z-index: 2;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.card-badge-format {
    position: absolute;
    bottom: 15px;
    right: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.9);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 20px;
    z-index: 2;
}

.card-body {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
}

.card-meta-top {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--be-text-muted, #64748b);
}

.card-meta-top span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.3;
}

.card-title a {
    color: var(--be-text-main, #1e293b);
    text-decoration: none;
    transition: color 0.3s;
}

.card-title a:hover {
    color: var(--cat-primary, #0A2463);
}

.card-excerpt {
    color: var(--be-text-muted, #64748b);
    line-height: 1.6;
    flex: 1;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--be-border, #e2e8f0);
}

.card-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.author-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--be-text-main, #1e293b);
}

.card-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--be-bg-secondary, #f1f5f9);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--be-text-muted, #64748b);
}

.action-btn:hover {
    background: var(--cat-primary, #0A2463);
    color: white;
    transform: scale(1.1);
}

.card-read-indicator {
    position: absolute;
    top: -10px;
    right: -10px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: #10b981;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

/* --- LOADING & PAGINATION --- */
.loading-indicator {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid var(--be-border, #e2e8f0);
    border-top-color: var(--cat-primary, #0A2463);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.category-pagination {
    margin-top: 60px;
    text-align: center;
}

.pagination-modern {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.pagination-modern a,
.pagination-modern span {
    padding: 10px 18px;
    background: white;
    border: 2px solid var(--be-border, #e2e8f0);
    border-radius: 8px;
    color: var(--be-text-main, #1e293b);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.pagination-modern a:hover,
.pagination-modern .current {
    background: var(--cat-primary, #0A2463);
    color: white;
    border-color: var(--cat-primary, #0A2463);
    transform: translateY(-2px);
}

.btn-load-more {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 40px;
    background: var(--cat-primary, #0A2463);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin: 40px auto 0;
}

.btn-load-more:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.btn-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-load-more.loading .btn-loader {
    display: block;
}

.btn-load-more.loading .btn-text {
    opacity: 0.7;
}

/* --- SIDEBAR --- */
.category-sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.sidebar-widget {
    background: white;
    border: 1px solid var(--be-border, #e2e8f0);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.widget-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--be-text-main, #1e293b);
}

.title-icon {
    font-size: 1.3rem;
}

.widget-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--be-text-muted, #64748b);
}

.widget-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--be-border, #e2e8f0);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--be-text-main, #1e293b);
}

.trending-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.trending-item {
    display: flex;
    gap: 15px;
    padding: 12px;
    background: var(--be-bg-secondary, #f1f5f9);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s;
}

.trending-item:hover {
    background: var(--cat-primary, #0A2463);
    color: white;
    transform: translateX(5px);
}

.trending-rank {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cat-primary, #0A2463);
    color: white;
    font-weight: 800;
    border-radius: 8px;
    flex-shrink: 0;
}

.trending-item:hover .trending-rank {
    background: white;
    color: var(--cat-primary, #0A2463);
}

.trending-content h4 {
    margin: 0 0 5px 0;
    font-size: 0.95rem;
    line-height: 1.3;
    color: var(--be-text-main, #1e293b);
}

.trending-item:hover .trending-content h4 {
    color: white;
}

.trending-meta {
    font-size: 0.8rem;
    color: var(--be-text-muted, #64748b);
}

.trending-item:hover .trending-meta {
    color: rgba(255,255,255,0.8);
}

.tag-cloud-modern {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item {
    padding: 6px 14px;
    background: var(--be-bg-secondary, #f1f5f9);
    color: var(--be-text-main, #1e293b);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
}

.tag-item:hover {
    background: var(--cat-primary, #0A2463);
    color: white;
    transform: translateY(-2px);
}

.newsletter-form-sidebar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.newsletter-form-sidebar input {
    padding: 12px;
    border: 2px solid var(--be-border, #e2e8f0);
    border-radius: 8px;
    font-size: 0.95rem;
}

.newsletter-form-sidebar button {
    padding: 12px;
    background: var(--cat-primary, #0A2463);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.newsletter-form-sidebar button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.form-note {
    font-size: 0.75rem;
    color: var(--be-text-muted, #64748b);
    text-align: center;
    margin-top: 8px;
}

.widget-ad .ad-placeholder {
    width: 100%;
    height: 250px;
    background: var(--be-bg-secondary, #f1f5f9);
    border: 2px dashed var(--be-border, #e2e8f0);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* --- ANIMATIONS --- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- RESPONSIVE --- */

/* Desktop large */
@media (min-width: 1400px) {
    .category-hero .container,
    .category-controls .container {
        max-width: 1600px;
    }
    
    .content-layout {
        max-width: 1600px;
    }
}

/* Desktop standard */
@media (min-width: 1025px) and (max-width: 1399px) {
    .content-layout {
        grid-template-columns: minmax(0, 1fr) 320px !important;
        gap: 40px;
    }
    
    .category-sidebar {
        width: 320px;
    }
}

/* Tablet et petit desktop */
@media (max-width: 1024px) {
    .content-layout {
        grid-template-columns: 1fr;
    }
    
    .category-sidebar {
        order: 2;
        max-width: 100%;
    }
    
    .articles-main {
        order: 1;
    }
}

@media (max-width: 768px) {
    .category-hero {
        padding: 80px 0 120px;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .stat-divider {
        display: none;
    }
    
    .controls-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        justify-content: center;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .articles-grid.view-list .article-card-modern {
        flex-direction: column;
    }
    
    .articles-grid.view-list .card-image-wrapper {
        width: 100%;
        height: 200px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .filter-btn {
        font-size: 0.85rem;
        padding: 8px 15px;
    }
    
    .category-hero .container,
    .category-controls .container,
    .content-layout {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* --- DARK MODE SUPPORT --- */
[data-theme="dark"] .article-card-modern,
[data-theme="dark"] .sidebar-widget {
    background: var(--be-bg-surface, #1e293b);
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .card-title a {
    color: var(--be-text-main, #f1f5f9);
}

[data-theme="dark"] .filter-btn {
    background: var(--be-bg-surface, #1e293b);
    color: var(--be-text-main, #f1f5f9);
}
