/*
Theme Name: sahafapro-fr
Theme URI: https://agadir24.info
Description: Thème enfant optimisé pour la réactivité mobile, le mode sombre et la compatibilité AMP (version française)
Author: agadir24.info
Author URI: https://agadir24.info
Template: sahafapro
Version: 1.1.0
Text Domain: sahafapro-fr
*/

/* ========== Variables globales ========== */
:root {
    /* Couleurs principales */
    --primary-color: #02356b;
    --secondary-color: #e1e3e6;
    --accent-color: #f39c12;
    --text-color: #1a1a1a;
    --light-text: #6c757d;
    --bg-color: #ffffff;
    --border-color: #e0e0e0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    
    /* Mode sombre */
    --dark-text: #f0f0f0;
    --dark-light-text: #b0b0b0;
    --dark-bg: #1a1a1a;
    --dark-border: #333;
    --dark-shadow: 0 1px 3px rgba(0,0,0,0.3);
    
    /* Dimensions */
    --container-width: 1140px;
    --mobile-padding: 15px;
}

/* ========== Base ========== */
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    direction: ltr;
    text-align: left;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Corriger le sens du texte dans le contenu des articles */
.entry-content,
.entry-content p,
.entry-content li,
.post-meta,
.comments-area,
.related-posts-section,
.sidebar,
.heading-primary,
.heading-centered {
    direction: ltr;
    text-align: left;
}

/* ========== Mode sombre ========== */
@media (prefers-color-scheme: dark) {
    body:not(.light-mode) {
        --text-color: var(--dark-text);
        --light-text: var(--dark-light-text);
        --bg-color: var(--dark-bg);
        --border-color: var(--dark-border);
        --shadow-sm: var(--dark-shadow);
    }
}

/* ========== Mise en page globale ========== */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 30px;
    box-sizing: border-box;
}

/* ========== Optimisations mobile ========== */
@media (max-width: 768px) {
    :root {
        --mobile-padding: 10px;
    }
    
    .container {
        padding: 0 var(--mobile-padding);
    }
    
    .mobile-hidden {
        display: none !important;
    }
    
    /* Masquer certains éléments sur mobile (si souhaité) */
    .posts-slider,
    .home-slider,
    .slider,
    .slider-wrapper,
    .slider-container,
    .heading-primary,
    #latest-news-list,
    .heading-centered {
        display: none !important;
    }
}

/* Mise en forme des annonces AMP */
amp-ad {
    display: block !important;
    margin: 24px auto !important;
    max-width: 100% !important;
    text-align: center !important;
}

body > amp-ad[sticky] {
    display: none !important;
}

/* ========== Images ========== */
img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.entry-content img,
.site-content img {
    margin: 1em 0;
}

/* ========== Header et logo ========== */
.site-header {
    background: var(--bg-color);
    padding: 15px 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo img {
    max-height: 60px;
    width: auto;
    transition: opacity 0.3s ease;
}

.site-logo img:hover {
    opacity: 0.9;
}

/* ========== Métadonnées des articles ========== */
.post-meta {
    font-size: 0.9em;
    color: var(--light-text);
    margin: 1em 0;
}

.post-meta .post-author,
.post-meta .post-date {
    display: block;
}

.post-meta .post-date {
    margin-top: 0.5em;
}

/* ========== AMP ========== */
amp-ad {
    display: block;
    margin: 1.5em auto;
    max-width: 100%;
    text-align: center;
}

/* ========== Pagination numérique ========== */
.numeric-pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5em;
    margin: 2em 0;
}

.numeric-pagination a,
.numeric-pagination span {
    padding: 0.5em 0.8em;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    transition: all 0.3s ease;
}

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

.numeric-pagination a:hover {
    background: var(--light-text);
    color: var(--bg-color);
}

/* ========== Vidéos et sidebar ========== */
.video-posts-grid {
    display: grid;
    gap: 1em;
}

.video-post-item {
    background: var(--bg-color);
    border-radius: 0.5em;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease;
}

.video-post-item:hover {
    transform: translateY(-3px);
}

.post-meta .right-col {
    display: block !important;
}

/* ========== Footer ========== */
.footer-logo {
    text-align: center;
    margin: 2em 0;
}

.footer-logo img {
    display: inline-block;
    max-height: 60px;
    height: auto;
    width: auto;
}

@media (max-width: 768px) {
    .footer-logo img {
        max-height: 40px;
    }
}

/* Masquer définitivement le switch de version mobile AMP */
#amp-mobile-version-switcher {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0 !important;
}

/* ========== Performance ========== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========== Annonces AMP (réglages taille) ========== */
@media (max-width: 768px) {
    .ad-container amp-ad {
        height: 250px !important;
    }
    .ad-container.ad-square amp-ad {
        width: 300px !important;
        height: 300px !important;
    }
}

@media (min-width: 769px) {
    .ad-container amp-ad {
        height: 90px !important;
    }
    .ad-container.ad-square amp-ad {
        width: 300px !important;
        height: 250px !important;
    }
}

/* Placeholder des annonces pour minimiser le CLS */
.ads-placeholder{min-height:250px;display:block;margin:12px auto}

/* Assurer la visibilité du logo */
.custom-logo{max-height:80px;height:auto}
.site-branding img.custom-logo{display:inline-block}
