/* CSS spécifique au blog HEVX */

/* Variables CSS pour cohérence */
:root {
    --primary-color: #6600ff;
    --text-dark: #4a4a4a;
    --text-medium: #666;
    --text-light: #888;
    --border-color: #e0e0e0;
    --hover-color: #f5f5f5;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

/* Styles généraux du blog */
.blog-sidebar {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    border-radius: 8px;
}

.blog-sidebar::-webkit-scrollbar {
    width: 6px;
}

.blog-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.blog-sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

/* CORRECTION CRITIQUE : Réactiver le scroll pour les pages de blog */
body.blog-page {
    overflow: auto !important;
    height: auto !important;
}

html.blog-page {
    overflow: auto !important;
    height: auto !important;
}

/* Réinitialiser les styles pour les pages blog */
.blog-page #map {
    display: none !important;
}

/* Filtres */
.filter-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.filter-item:hover {
    background-color: var(--hover-color);
    padding-left: 5px;
}

.filter-item:last-child {
    border-bottom: none;
}

.filter-item input[type="radio"],
.filter-item input[type="checkbox"] {
    margin-right: 8px;
    accent-color: var(--primary-color);
}

.tag-filter {
    display: inline-block;
    background-color: #f8f9fa;
    color: var(--text-medium);
    padding: 4px 8px;
    margin: 2px;
    border-radius: 12px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.tag-filter:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

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

.tag-count {
    background-color: rgba(255,255,255,0.3);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.8em;
    margin-left: 5px;
}

/* Cards d'articles */
.article-card {
    border-radius: 12px;
    transition: all 0.3s ease;
    overflow: hidden;
    border: 1px solid var(--border-color);
    height: 100%;
    display: flex;
    flex-direction: column;
}

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

.article-card img {
    transition: transform 0.3s ease;
}

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

.article-card .w3-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.article-card h3 {
    color: var(--text-dark);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 10px;
    flex-grow: 1;
}

.article-card h3 a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

.article-card h3 a:hover {
    color: var(--primary-color);
}

.article-meta {
    display: flex;
    align-items: center;
    font-size: 0.85em;
    color: var(--text-light);
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.article-meta span {
    margin-right: 15px;
    display: flex;
    align-items: center;
}

.article-meta .read-time::before {
    content: "📖";
    margin-right: 5px;
}

.article-meta .views::before {
    content: "👁";
    margin-right: 5px;
}

/* Featured article */
.featured-article {
    background: linear-gradient(135deg, var(--primary-color), #8a2be2);
    color: white;
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.featured-article::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="80" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="60" cy="30" r="1.5" fill="rgba(255,255,255,0.1)"/></svg>');
    pointer-events: none;
}

.featured-article h2 {
    font-size: 2.2em;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.featured-article p {
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.featured-article .w3-button {
    background-color: white;
    color: var(--primary-color);
    font-weight: 600;
    border-radius: 25px;
    padding: 12px 30px;
    position: relative;
    z-index: 1;
}

/* Page d'article */
.blog-article {
    font-family: Georgia, 'Times New Roman', serif;
}

.blog-article h1 {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.article-content h2,
.article-content h3,
.article-content h4 {
    color: var(--text-dark);
    margin-top: 30px;
    margin-bottom: 15px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.article-content h2 {
    font-size: 1.8em;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

.article-content h3 {
    font-size: 1.5em;
}

.article-content h4 {
    font-size: 1.3em;
}

.article-content p {
    margin-bottom: 20px;
    text-align: justify;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: var(--shadow);
}

.article-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 20px 0;
    font-style: italic;
    color: var(--text-medium);
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-radius: 0 8px 8px 0;
}

.article-content code {
    background-color: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.article-content pre {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

.article-content ul,
.article-content ol {
    margin-bottom: 20px;
    padding-left: 30px;
}

.article-content li {
    margin-bottom: 8px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
}

.pagination button {
    border: 1px solid var(--border-color);
    background-color: white;
    color: var(--text-dark);
    transition: all 0.2s ease;
}

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

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive design */
@media (max-width: 768px) {
    .blog-sidebar {
        position: static;
        margin-bottom: 30px;
    }
    
    .featured-article {
        padding: 20px;
        text-align: center;
    }
    
    .featured-article h2 {
        font-size: 1.8em;
    }
    
    .article-card {
        margin-bottom: 20px;
    }
    
    .article-content {
        font-size: 1em;
    }
    
    .blog-article {
        padding: 20px 10px;
    }
}

@media (max-width: 480px) {
    .featured-article h2 {
        font-size: 1.5em;
    }
    
    .article-content h2 {
        font-size: 1.5em;
    }
    
    .article-content h3 {
        font-size: 1.3em;
    }
    
    .tag-filter {
        font-size: 0.8em;
        padding: 3px 6px;
    }
}

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

.article-card {
    animation: fadeInUp 0.6s ease forwards;
}

.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; }

/* États de chargement */
.loading-skeleton {
    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; }
}

/* Search highlighting */
.search-highlight {
    background-color: yellow;
    padding: 1px 3px;
    border-radius: 2px;
}

/* Improved focus states */
input:focus,
select:focus,
button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Smooth transitions */
* {
    transition: box-shadow 0.2s ease, transform 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

/* Styles pour contenu HTML intégré */
.html-content {
    max-width: 100%;
    overflow-wrap: break-word;
}

.html-content img {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: block;
}

.html-content h1, 
.html-content h2, 
.html-content h3,
.html-content h4,
.html-content h5,
.html-content h6 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--text-dark, #333);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.html-content h1 {
    font-size: 2.2em;
    border-bottom: 2px solid var(--primary-color, #6600ff);
    padding-bottom: 10px;
}

.html-content h2 {
    font-size: 1.8em;
}

.html-content h3 {
    font-size: 1.5em;
}

.html-content p {
    margin-bottom: 20px;
    line-height: 1.6;
    text-align: justify;
}

.html-content ul,
.html-content ol {
    margin-bottom: 20px;
    padding-left: 30px;
}

.html-content li {
    margin-bottom: 8px;
}

.html-content blockquote {
    border-left: 4px solid var(--primary-color, #6600ff);
    padding-left: 20px;
    margin: 20px 0;
    font-style: italic;
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-radius: 0 8px 8px 0;
}

.html-content code {
    background-color: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.html-content pre {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid #e9ecef;
}

.html-content a {
    color: var(--primary-color, #6600ff);
    text-decoration: none;
}

.html-content a:hover {
    text-decoration: underline;
}

/* Responsive pour les images */
@media (max-width: 768px) {
    .html-content img {
        margin: 15px 0;
    }
    
    .html-content h1 {
        font-size: 1.8em;
    }
    
    .html-content h2 {
        font-size: 1.5em;
    }
    
    .html-content h3 {
        font-size: 1.3em;
    }
}