/**
 * Styles pour la page Blog - Design Original Complet
 * DTAH Construires Theme
 */

/* Variables du thème */
:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --success: #10b981;
    --success-dark: #059669;
    --info: #06b6d4;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-light: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --radius: 0.5rem;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --max-width: 1400px;
}

/* Reset et base */
.blog-page {
    background: var(--bg-light);
    min-height: 100vh;
}

.blog-page .container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Hero Section Blog */
.hero-blog {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: white;
    padding: 1rem 1rem 1rem;
    text-align: center;
}

.hero-blog h1 {
    font-size: 3rem;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.hero-blog p {
    font-size: 1.25rem;
    opacity: 0.95;
    max-width: 800px;
    margin: 0 auto;
}

/* Barre de recherche */
.search-bar {
    background: white;
    border-radius: 50px;
    padding: 0.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    max-width: 600px;
    margin: -0.5rem auto 0.5rem;
    position: relative;
    z-index: 10;
}

.search-input {
    flex: 1;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    outline: none;
    background: transparent;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.search-btn svg {
    width: 20px;
    height: 20px;
}

/* Layout Blog sans Sidebar - Pleine largeur */
.blog-wrapper {
    display: block;
    padding: 0.5rem 0;
    max-width: 1400px;
    margin: 0 auto;
}

.blog-main {
    width: 100%;
    max-width: 100%;
}

/* Filtres de catégories */
.categories-filter {
    background: white;
    padding: 0.5rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow);
}

.categories-filter h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.categories-list {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.category-tag {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border);
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
}

.category-tag:hover,
.category-tag.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.category-tag .count {
    opacity: 0.7;
    font-size: 0.85em;
    margin-left: 4px;
}

/* Article en vedette - Plus grand sans sidebar */
.featured-article {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin-bottom: 0.5rem;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    max-height: 200px;
}

.featured-image {
    height: 280px; /* Réduit */
    background: linear-gradient(135deg, var(--primary), var(--info));
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.15);
    font-size: 3rem;
    position: relative;
    overflow: hidden;
    flex: 0 0 35%;
}

.featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-content {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

.featured-badge {
    display: inline-block;
    background: var(--warning);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.featured-title {
    font-size: 1.3rem; /* Réduit */
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    text-decoration: none;
    display: block;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.featured-excerpt {
    color: var(--text-secondary);
    font-size: 0.85rem; /* Réduit */
    line-height: 1.5;
    margin-bottom: 1rem;
    max-width: 90%;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.featured-meta {
    display: flex;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    flex-wrap: wrap;
}

/* Grille d'articles - 4 articles par ligne sur écrans normaux */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* Forcer 4 colonnes sur tous les écrans de bureau */
@media (min-width: 1024px) {
    .articles-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Sur tablettes : 3 colonnes */
@media (min-width: 768px) and (max-width: 1023px) {
    .articles-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Sur tablettes : 2 colonnes */
@media (min-width: 540px) and (max-width: 767px) {
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

/* Sur mobiles : 1 colonne */
@media (max-width: 539px) {
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
}

.article-card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 320px;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.article-image {
    height: 180px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.15);
    font-size: 4rem;
    position: relative;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-category {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary);
    padding: 0.2rem 0.6rem;
    border-radius: 15px;
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    backdrop-filter: blur(5px);
    z-index: 1; /* S'assurer que le badge est au-dessus */
}

.article-content {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.1rem;
}

.article-title {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    text-decoration: none;
    display: block;
    font-weight: 600;
    line-height: 1.3;
    /* Limiter à 2 lignes */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.article-excerpt {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    flex: 1;
    /* Limiter à 3 lignes */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: auto;
}

/* Auteur supprimé - style retiré */

/* Pagination améliorée */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.pagination a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination .page-current {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Loader */
.loading {
    text-align: center;
    padding: 3rem;
    font-size: 1.25rem;
    color: var(--text-secondary);
}

/* Message aucun article */
.no-articles {
    text-align: center;
    padding: 3rem;
    background: var(--bg-light);
    border-radius: var(--radius);
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

.read-more {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.3s ease;
}

.read-more:hover {
    gap: 0.5rem;
    text-decoration: underline;
}

/* Sidebar - Barre latérale */
.blog-sidebar {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.sidebar-widget {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-widget:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.sidebar-widget h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.sidebar-search {
    position: relative;
}

.sidebar-search input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
}

.sidebar-search button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
}

/* Articles récents sidebar */
.recent-posts {
    list-style: none;
    padding: 0;
}

.recent-post {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.recent-post:last-child {
    border-bottom: none;
}

.recent-post-thumb {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.recent-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recent-post-info {
    flex: 1;
}

.recent-post-title {
    font-size: 0.9rem;
    line-height: 1.3;
    margin-bottom: 0.25rem;
}

.recent-post-title a {
    color: var(--text-primary);
    text-decoration: none;
}

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

.recent-post-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Catégories sidebar */
.categories-widget {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--bg-light);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s;
}

.category-link:hover {
    background: var(--primary);
    color: white;
    transform: translateX(5px);
}

.category-count {
    background: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

.category-link:hover .category-count {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 3rem 0;
}

.pagination a,
.pagination span {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.pagination a:hover,
.pagination .current {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Responsive */
@media (max-width: 1200px) {
    .hero-blog h1 {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .hero-blog {
        padding: 3rem 1rem;
    }
    
    .hero-blog h1 {
        font-size: 2rem;
    }
    
    .hero-blog p {
        font-size: 1.1rem;
    }
    
    .search-bar {
        flex-direction: column;
        border-radius: var(--radius);
        max-width: 100%;
    }
    
    .search-btn {
        width: 100%;
        justify-content: center;
    }
    
    .featured-image {
        height: 250px;
    }
    
    .featured-title {
        font-size: 1.5rem;
    }
    
    .categories-list {
        justify-content: center;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.article-card {
    animation: fadeIn 0.6s ease;
    animation-fill-mode: both;
}

.article-card:nth-child(1) { animation-delay: 0.1s; }
.article-card:nth-child(2) { animation-delay: 0.2s; }
.article-card:nth-child(3) { animation-delay: 0.3s; }
.article-card:nth-child(4) { animation-delay: 0.4s; }
.article-card:nth-child(5) { animation-delay: 0.5s; }
.article-card:nth-child(6) { animation-delay: 0.6s; }
.article-card:nth-child(7) { animation-delay: 0.7s; }
.article-card:nth-child(8) { animation-delay: 0.8s; }
.article-card:nth-child(9) { animation-delay: 0.9s; }
/* ======================================
   BARRE DE RECHERCHE BLOG
   ====================================== */
.blog-search-section {
    margin: 2rem auto;
    padding: 0 1rem;
    max-width: 1400px;
}

.blog-search-form {
    max-width: 800px;
    margin: 0 auto;
}

.search-wrapper {
    display: flex;
    background: white;
    border-radius: 50px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.search-wrapper:focus-within {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}

.blog-search-input {
    flex: 1;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border: none;
    outline: none;
    background: transparent;
    color: #333;
}

.blog-search-input::placeholder {
    color: #94a3b8;
}

.blog-search-btn {
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.blog-search-btn:hover {
    background: linear-gradient(135deg, #1e40af, #1e3a8a);
}

.blog-search-btn span {
    display: inline-block;
    transition: transform 0.3s ease;
}

.blog-search-btn:hover span {
    transform: translateX(3px);
}

/* Responsive */
@media (max-width: 768px) {
    .blog-search-section {
        margin: 1rem 0;
    }
    
    .search-wrapper {
        border-radius: 30px;
    }
    
    .blog-search-input {
        padding: 0.8rem 1rem;
        font-size: 1rem;
    }
    
    .blog-search-btn {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
}
