/* ============================================
   CARNET MALGACHE - Layout Grille Type L'Écho du Sud
   Template Joomla 6 - Soa i Madagasikara
   Layout: Cards en grille avec images ratio 16:9
   ============================================ */

/* Container principal - Large pour grille 3 colonnes */
/* Cible tous les sélecteurs possibles pour le blog */
.category-carnet-malgache,
.blog-carnet-malgache,
.carnet-malgache,
body.blog-carnet-malgache,
body[class*="carnet-malgache"],
.view-category.category-carnet-malgache,
.com-content.view-category {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Isolation des articles - Évite les imbrications */
.blog-carnet-malgache .item,
.category-carnet-malgache .item {
    isolation: isolate;
    contain: layout;
}

/* MODULE RECHERCHE - Style Blog Carnet */
.blog-carnet-malgache .blog-featured-search,
.blog-carnet-malgache .search-module,
.blog-carnet-malgache .mod-search {
    max-width: 600px;
    margin: 0 auto 40px auto;
    background: white;
    padding: 20px 30px;
    border-radius: 50px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

.blog-carnet-malgache .mod-search .form-inline {
    display: flex;
    gap: 10px;
    align-items: center;
}

.blog-carnet-malgache .mod-search input[type="search"],
.blog-carnet-malgache .mod-search input[type="text"] {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.blog-carnet-malgache .mod-search input[type="search"]:focus,
.blog-carnet-malgache .mod-search input[type="text"]:focus {
    outline: none;
    border-color: var(--madagascar-green);
    box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.1);
}

.blog-carnet-malgache .mod-search button[type="submit"],
.blog-carnet-malgache .mod-search .btn {
    background: var(--madagascar-green);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.blog-carnet-malgache .mod-search button[type="submit"]:hover,
.blog-carnet-malgache .mod-search .btn:hover {
    background: #00a075;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 184, 148, 0.3);
}

/* Titre de la page blog */
.category-carnet-malgache .page-title,
.blog-carnet-malgache .page-title {
    font-size: 2.5em;
    color: #2d3436;
    margin-bottom: 40px;
    text-align: center;
    font-weight: bold;
}

/* Articles en vue détaillée (page article individuel) */
.category-carnet-malgache .item-page,
.carnet-malgache .item-page {
    max-width: 900px;
    margin: 0 auto;
    background: #ffffff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    line-height: 1.8;
}

/* ============================================
   HIÉRARCHIE DES TITRES (H1, H2, H3)
   ============================================ */

/* H1 - Titre principal de l'article */
.category-carnet-malgache h1,
.blog-carnet-malgache h1,
.carnet-malgache h1,
.category-carnet-malgache .page-header,
.blog-carnet-malgache .page-header {
    font-size: 2.2em;
    color: #2d3436;
    margin: 0 0 25px 0;
    font-weight: bold;
    line-height: 1.3;
    border-bottom: 3px solid var(--madagascar-green);
    padding-bottom: 15px;
}

/* H2 - Sections principales */
.category-carnet-malgache h2,
.blog-carnet-malgache h2,
.carnet-malgache h2 {
    font-size: 1.6em;
    color: #2d3436;
    margin: 35px 0 20px 0;
    font-weight: bold;
    line-height: 1.4;
    border-left: 4px solid var(--madagascar-green);
    padding-left: 15px;
}

/* H3 - Sous-sections */
.category-carnet-malgache h3,
.blog-carnet-malgache h3,
.carnet-malgache h3 {
    font-size: 1.3em;
    color: #636e72;
    margin: 25px 0 15px 0;
    font-weight: 600;
    line-height: 1.4;
}

/* H4, H5, H6 - Sous-titres mineurs */
.category-carnet-malgache h4,
.blog-carnet-malgache h4,
.carnet-malgache h4 {
    font-size: 1.1em;
    color: #636e72;
    margin: 20px 0 10px 0;
    font-weight: 600;
    font-style: italic;
}

/* ============================================
   IMAGE D'INTRODUCTION
   ============================================ */

/* Image principale */
.category-carnet-malgache img,
.blog-carnet-malgache img,
.carnet-malgache img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 25px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Image de l'article dans la liste blog */
.category-carnet-malgache .item img,
.blog-carnet-malgache .item img {
    margin-bottom: 20px;
}

/* ============================================
   TEXTE ET PARAGRAPHES
   ============================================ */

/* Paragraphes */
.category-carnet-malgache p,
.blog-carnet-malgache p,
.carnet-malgache p {
    margin: 15px 0;
    color: #2d3436;
    font-size: 1.05em;
    line-height: 1.8;
}

/* Texte en gras */
.category-carnet-malgache strong,
.blog-carnet-malgache strong,
.carnet-malgache strong {
    color: var(--madagascar-green);
    font-weight: bold;
}

/* Texte en italique */
.category-carnet-malgache em,
.blog-carnet-malgache em,
.carnet-malgache em {
    font-style: italic;
    color: #636e72;
}

/* ============================================
   LISTES
   ============================================ */

/* Listes à puces */
.category-carnet-malgache ul,
.blog-carnet-malgache ul,
.carnet-malgache ul {
    margin: 20px 0;
    padding-left: 30px;
}

.category-carnet-malgache ul li,
.blog-carnet-malgache ul li,
.carnet-malgache ul li {
    margin: 10px 0;
    padding-left: 10px;
    color: #2d3436;
}

.category-carnet-malgache ul li::marker,
.blog-carnet-malgache ul li::marker,
.carnet-malgache ul li::marker {
    color: var(--madagascar-green);
    font-weight: bold;
}

/* Listes numérotées */
.category-carnet-malgache ol,
.blog-carnet-malgache ol,
.carnet-malgache ol {
    margin: 20px 0;
    padding-left: 30px;
}

.category-carnet-malgache ol li,
.blog-carnet-malgache ol li,
.carnet-malgache ol li {
    margin: 10px 0;
    padding-left: 10px;
    color: #2d3436;
}

.category-carnet-malgache ol li::marker,
.blog-carnet-malgache ol li::marker,
.carnet-malgache ol li::marker {
    color: var(--madagascar-green);
    font-weight: bold;
}

/* ============================================
   ÉLÉMENTS SPÉCIAUX
   ============================================ */

/* Citations */
.category-carnet-malgache blockquote,
.blog-carnet-malgache blockquote,
.carnet-malgache blockquote {
    margin: 30px 0;
    padding: 20px 25px;
    background: #f8f9fa;
    border-left: 4px solid var(--madagascar-green);
    font-style: italic;
    color: #636e72;
    border-radius: 4px;
}

/* Liens */
.category-carnet-malgache a,
.blog-carnet-malgache a,
.carnet-malgache a {
    color: var(--madagascar-green);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.category-carnet-malgache a:hover,
.blog-carnet-malgache a:hover,
.carnet-malgache a:hover {
    color: #00d2a0;
    text-decoration: underline;
}

/* Code / Texte préformaté */
.category-carnet-malgache code,
.blog-carnet-malgache code,
.carnet-malgache code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: var(--madagascar-red);
    font-size: 0.9em;
}

.category-carnet-malgache pre,
.blog-carnet-malgache pre,
.carnet-malgache pre {
    background: #2d3436;
    color: #ffffff;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 25px 0;
}

/* Séparateur horizontal */
.category-carnet-malgache hr,
.blog-carnet-malgache hr,
.carnet-malgache hr {
    border: none;
    border-top: 2px solid #e8e8e8;
    margin: 40px 0;
}

/* ============================================
   MÉTADONNÉES DE L'ARTICLE
   ============================================ */

/* Catégorie, date, auteur */
.category-carnet-malgache .article-info,
.blog-carnet-malgache .article-info,
.carnet-malgache .article-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e8e8e8;
    font-size: 0.95em;
    color: #636e72;
}

.category-carnet-malgache .article-info dd,
.blog-carnet-malgache .article-info dd,
.carnet-malgache .article-info dd {
    margin: 0;
}

/* Badge catégorie */
.category-carnet-malgache .item-category,
.blog-carnet-malgache .item-category,
.carnet-malgache .item-category {
    background: linear-gradient(135deg, var(--madagascar-green), #00d2a0);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 15px;
}

/* Tags / Hashtags */
.category-carnet-malgache .tags,
.blog-carnet-malgache .tags,
.carnet-malgache .tags {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e8e8e8;
}

.category-carnet-malgache .tags a,
.blog-carnet-malgache .tags a,
.carnet-malgache .tags a {
    display: inline-block;
    background: linear-gradient(135deg, var(--madagascar-green), #00d2a0);
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    margin-right: 8px;
    margin-bottom: 8px;
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none !important;
    transition: transform 0.2s ease;
}

.category-carnet-malgache .tags a:hover,
.blog-carnet-malgache .tags a:hover,
.carnet-malgache .tags a:hover {
    transform: translateY(-2px);
}

/* ============================================
   AFFICHAGE LISTE BLOG - GRILLE TYPE L'ÉCHO DU SUD
   Layout : Grille 3 colonnes avec cards
   ============================================ */

/* Container des articles - Sélecteurs multiples pour compatibilité maximale */
.blog-carnet-malgache .items-leading,
.blog-carnet-malgache .items-row,
.category-carnet-malgache .items-leading,
.category-carnet-malgache .items-row,
body.blog-carnet-malgache .items-leading,
body.blog-carnet-malgache .items-row,
body[class*="carnet-malgache"] .items-leading,
body[class*="carnet-malgache"] .items-row,
.com-content.view-category .items-leading,
.view-category .items-leading,
.blog-carnet-malgache .items-leading > div,
.category-carnet-malgache .items-leading > div {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 30px !important;
    margin-bottom: 40px !important;
}

/* Force les divs wrapper à être en grille aussi */
.blog-carnet-malgache .row,
.category-carnet-malgache .row,
.blog-carnet-malgache div[class*="leading"],
.category-carnet-malgache div[class*="leading"] {
    display: contents !important;
}

/* Article card - Design L'Écho du Sud */
.blog-carnet-malgache .item,
.category-carnet-malgache .item,
body.blog-carnet-malgache .item,
body[class*="carnet-malgache"] .item,
.com-content.view-category .item,
.view-category .item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.blog-carnet-malgache .item:hover,
.category-carnet-malgache .item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

/* MASQUER TOUT CE QUI N'EST PAS NÉCESSAIRE */
.blog-carnet-malgache .item dl.article-info,
.category-carnet-malgache .item dl.article-info,
.blog-carnet-malgache dl.article-info,
.category-carnet-malgache dl.article-info,
.blog-carnet-malgache .muted,
.category-carnet-malgache .muted,
.blog-carnet-malgache .item-category,
.category-carnet-malgache .item-category,
.blog-carnet-malgache .page-header dd,
.category-carnet-malgache .page-header dd {
    display: none !important;
}

/* Container image - Ratio 16:9 fixe */
.blog-carnet-malgache .item .item-image,
.category-carnet-malgache .item .item-image,
.blog-carnet-malgache .item figure,
.category-carnet-malgache .item figure {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* Ratio 16:9 */
    overflow: hidden;
    margin: 0;
    background: #f1f3f5;
}

/* Image - Cover pour remplir le container */
.blog-carnet-malgache .item img,
.category-carnet-malgache .item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transition: transform 0.3s ease;
}

.blog-carnet-malgache .item:hover img,
.category-carnet-malgache .item:hover img {
    transform: scale(1.05);
}

/* Container contenu - Sous l'image */
.blog-carnet-malgache .item .item-content,
.category-carnet-malgache .item .item-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Titre de l'article */
.blog-carnet-malgache .item h2,
.category-carnet-malgache .item h2,
.blog-carnet-malgache .item .page-header,
.category-carnet-malgache .item .page-header {
    margin: 0 0 12px 0;
    padding: 0;
    border: none;
    font-size: 1.2em;
    line-height: 1.4;
}

.blog-carnet-malgache .item h2 a,
.category-carnet-malgache .item h2 a,
.blog-carnet-malgache .item .page-header a,
.category-carnet-malgache .item .page-header a {
    color: #2d3436;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limite à 2 lignes */
    line-clamp: 2; /* Standard property for compatibility */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-carnet-malgache .item h2 a:hover,
.category-carnet-malgache .item h2 a:hover,
.blog-carnet-malgache .item .page-header a:hover,
.category-carnet-malgache .item .page-header a:hover {
    color: var(--madagascar-green);
}

/* Date de publication - Style minimal */
.blog-carnet-malgache .item time,
.category-carnet-malgache .item time,
.blog-carnet-malgache .item .published,
.category-carnet-malgache .item .published {
    display: block !important;
    color: #868e96;
    font-size: 0.85em;
    margin: 0;
    font-weight: 400;
}

.blog-carnet-malgache .item time::before,
.category-carnet-malgache .item time::before {
    content: "📅 ";
    margin-right: 4px;
}

/* Extrait du texte - Tronqué automatiquement */
.blog-carnet-malgache .item p,
.category-carnet-malgache .item p {
    color: #495057;
    font-size: 0.95em;
    line-height: 1.6;
    margin: 12px 0 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 4; /* Limite à 4 lignes */
    line-clamp: 4; /* Standard property for compatibility */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Bouton "Lire la suite" - Masqué (optionnel) */
.blog-carnet-malgache .item .readmore,
.category-carnet-malgache .item .readmore,
.blog-carnet-malgache .item .btn-readmore,
.category-carnet-malgache .item .btn-readmore {
    display: none; /* Masqué pour design épuré */
}

/* OU si vous voulez garder le bouton, décommentez :
.blog-carnet-malgache .item .readmore,
.category-carnet-malgache .item .readmore {
    display: inline-block;
    margin-top: auto;
    padding-top: 15px;
    color: var(--madagascar-green);
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s ease;
}

.blog-carnet-malgache .item .readmore:hover,
.category-carnet-malgache .item .readmore:hover {
    color: #00d2a0;
}
*/

/* ============================================
   RESPONSIVE MOBILE & TABLETTE
   ============================================ */

/* Tablette - 2 colonnes */
@media (max-width: 1024px) {
    .blog-carnet-malgache .items-leading,
    .blog-carnet-malgache .items-row,
    .category-carnet-malgache .items-leading,
    .category-carnet-malgache .items-row,
    body.blog-carnet-malgache .items-leading,
    body.blog-carnet-malgache .items-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 25px !important;
    }
}

/* Mobile - 1 colonne */
@media (max-width: 768px) {
    /* Container plus étroit sur mobile */
    .category-carnet-malgache,
    .blog-carnet-malgache,
    .carnet-malgache {
        padding: 20px 10px !important;
        max-width: 100% !important;
    }

    /* Grille 1 colonne sur mobile */
    .blog-carnet-malgache .items-leading,
    .blog-carnet-malgache .items-row,
    .category-carnet-malgache .items-leading,
    .category-carnet-malgache .items-row,
    body.blog-carnet-malgache .items-leading,
    body.blog-carnet-malgache .items-row,
    body[class*="carnet-malgache"] .items-leading,
    body[class*="carnet-malgache"] .items-row {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 0 !important;
    }

    /* Cards articles optimisées pour mobile */
    .blog-carnet-malgache .item,
    .category-carnet-malgache .item {
        margin: 0 !important;
        width: 100% !important;
    }

    /* Titre de page plus petit */
    .category-carnet-malgache .page-title,
    .blog-carnet-malgache .page-title {
        font-size: 1.8em !important;
        margin-bottom: 25px !important;
        padding: 0 10px;
    }

    /* Titre article plus petit */
    .blog-carnet-malgache .item h2,
    .category-carnet-malgache .item h2,
    .blog-carnet-malgache .item .page-header,
    .category-carnet-malgache .item .page-header {
        font-size: 1.1em !important;
        line-height: 1.3 !important;
    }

    /* Contenu avec moins de padding */
    .blog-carnet-malgache .item .item-content,
    .category-carnet-malgache .item .item-content {
        padding: 15px !important;
    }

    /* Images ratio maintenu */
    .blog-carnet-malgache .item .item-image,
    .category-carnet-malgache .item .item-image,
    .blog-carnet-malgache .item figure,
    .category-carnet-malgache .item figure {
        padding-top: 56.25% !important; /* Maintien ratio 16:9 */
    }

    /* Article individuel */
    .category-carnet-malgache .item-page,
    .carnet-malgache .item-page {
        padding: 20px;
    }

    /* Titres dans les articles */
    .category-carnet-malgache h1,
    .blog-carnet-malgache h1,
    .carnet-malgache h1 {
        font-size: 1.6em;
    }

    .category-carnet-malgache h2,
    .blog-carnet-malgache h2,
    .carnet-malgache h2 {
        font-size: 1.3em;
    }

    .category-carnet-malgache h3,
    .blog-carnet-malgache h3,
    .carnet-malgache h3 {
        font-size: 1.1em;
    }

    /* Images pleine largeur dans les articles */
    .category-carnet-malgache img,
    .blog-carnet-malgache img,
    .carnet-malgache img {
        margin: 15px 0;
    }

    /* Métadonnées en colonne */
    .category-carnet-malgache .article-info,
    .blog-carnet-malgache .article-info,
    .carnet-malgache .article-info {
        flex-direction: column;
        gap: 10px;
    }
}

/* ============================================
   PAGINATION
   ============================================ */

.blog-carnet-malgache .pagination {
    margin: 40px 0;
    display: flex !important;
    justify-content: center;
    align-items: center;
    flex-direction: row !important;
}

.blog-carnet-malgache .pagination ul {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 4px;
    padding: 0;
    list-style: none;
    align-items: center;
    margin: 0;
}

/* Style des boutons de pagination */
.blog-carnet-malgache .pagination li {
    display: inline-block !important;
    float: none !important;
}

.blog-carnet-malgache .pagination li a,
.blog-carnet-malgache .pagination li span {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: white !important;
    border: 1px solid #ddd !important;
    color: #333 !important;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

/* Hover sur les liens */
.blog-carnet-malgache .pagination li a:hover {
    background: #f5f5f5 !important;
    border-color: var(--madagascar-green) !important;
    color: var(--madagascar-green) !important;
}

/* Page active */
.blog-carnet-malgache .pagination li.active span {
    background: var(--madagascar-green) !important;
    border-color: var(--madagascar-green) !important;
    color: white !important;
    font-weight: 600;
}

/* Éléments désactivés - AVEC TEXTE VISIBLE */
.blog-carnet-malgache .pagination li.disabled span,
.blog-carnet-malgache .pagination li.disabled a {
    background: #f5f5f5 !important;
    border-color: #e0e0e0 !important;
    color: #999 !important;
    cursor: not-allowed;
}

/* Masquer les icônes Joomla invisibles et les remplacer par du texte */
.blog-carnet-malgache .pagination span[class*="icon-"],
.blog-carnet-malgache .pagination .icon-angle-double-left,
.blog-carnet-malgache .pagination .icon-angle-left,
.blog-carnet-malgache .pagination .icon-angle-right,
.blog-carnet-malgache .pagination .icon-angle-double-right {
    display: none !important;
}

/* Ajouter du texte visible avec ::after sur les liens/spans de pagination */
/* Bouton "Début" - Premier item avec double-left */
.blog-carnet-malgache .pagination li:first-child a::after,
.blog-carnet-malgache .pagination li:first-child span::after {
    content: "« Début";
    display: inline;
}

/* Bouton "Précédent" - Deuxième item avec angle-left */
.blog-carnet-malgache .pagination li:nth-child(2) a::after,
.blog-carnet-malgache .pagination li:nth-child(2) span::after {
    content: "‹ Préc";
    display: inline;
}

/* Bouton "Suivant" - Avant-dernier item avec angle-right */
.blog-carnet-malgache .pagination li:nth-last-child(2) a::after,
.blog-carnet-malgache .pagination li:nth-last-child(2) span::after {
    content: "Suiv ›";
    display: inline;
}

/* Bouton "Fin" - Dernier item avec double-right */
.blog-carnet-malgache .pagination li:last-child a::after,
.blog-carnet-malgache .pagination li:last-child span::after {
    content: "Fin »";
    display: inline;
}

/* Compteur de résultats */
.blog-carnet-malgache .counter {
    margin-top: 15px;
    color: #666;
    font-size: 0.9rem;
}

/* ============================================
   MASQUER NAVIGATION ENTRE ARTICLES
   ============================================ */
   
/* Masquer la navigation "Article précédent / Article suivant" */
.blog-carnet-malgache .item-page-navigation,
.blog-carnet-malgache .pager,
.blog-carnet-malgache .page-links,
.blog-carnet-malgache nav[aria-label*="Article"],
.blog-carnet-malgache .pagination-list,
.blog-carnet-malgache .com-content-article__navigation,
.blog-carnet-malgache ul.pager,
.blog-carnet-malgache .pager-links,
nav.pagination.mt-3,
.com-content-category-blog nav.pagination + * {
    display: none !important;
}
