/* =====================================================
   CRE - Centre de Recherche en Environnement
   Design fidèle à www.cre.dz
   Couleur principale : #135603 (vert CRE)
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700&family=Roboto+Slab:wght@400;700&display=swap');

/* ============================================================
   1. RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background-color: #f4f4f4;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Open Sans', Arial, sans-serif;
    font-weight: 700;
}

a { color: #135603; }
a:hover { color: #0a3a01; text-decoration: none; }

img { max-width: 100%; height: auto; }

/* ============================================================
   2. TOPBAR (language switcher)
   ============================================================ */
.container-topbar {
    background-color: #f8f8f8;
    border-bottom: 1px solid #e8e8e8;
    font-size: 12px;
    padding: 4px 0;
    text-align: right;
    width: 100%;
}

.container-topbar > div,
.container-topbar .moduletable {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 0 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== Sélecteur de langue natif Joomla (mod_languages) ===== */
.container-topbar .mod-languages {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin: 0;
}

.container-topbar .mod-languages ul,
.container-topbar .mod-languages ul.lang-inline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.container-topbar .mod-languages ul li {
    display: inline-flex;
    margin: 0;
}

.container-topbar .mod-languages ul li a {
    display: inline-block;
    color: #135603;
    background: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-decoration: none;
    padding: 3px 8px;
    border: 1px solid rgba(19, 86, 3, 0.35);
    border-radius: 3px;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.container-topbar .mod-languages ul li a:hover,
.container-topbar .mod-languages ul li a:focus-visible {
    background: rgba(19, 86, 3, 0.12);
    color: #0a3a01;
    border-color: #135603;
}

.container-topbar .mod-languages ul li.lang-active a {
    background: #135603;
    color: #ffffff !important;
    border-color: #135603;
    cursor: default;
}

/* En arabe (dir="rtl"), garder AR / FR / EN dans le même ordre et à droite */
[dir="rtl"] .container-topbar,
[dir="rtl"] .container-topbar .mod-languages {
    direction: ltr;
}

/* ===== Boutons de langue AR / FR / EN (style cre.dz) ===== */
/* Displayed inline in the top row of the header, right-aligned */
.cre-lang-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
}

.lang-btn {
    color: #aaa;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    padding: 3px 8px;
    border-radius: 3px;
    border: 1px solid transparent;
    letter-spacing: 0.5px;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    line-height: 1.4;
    cursor: pointer;
}

.lang-btn:hover {
    background: rgba(19, 86, 3, 0.15);
    color: #c8e6a0;
    border-color: rgba(19, 86, 3, 0.3);
    text-decoration: none;
}

.lang-btn.lang-active {
    background: #135603;
    color: #fff !important;
    border-color: #135603;
}

.lang-btn.lang-active:hover {
    background: #0a3a01;
    border-color: #0a3a01;
}

/* ============================================================
   3. HEADER — fond blanc, logo + menu sur une ligne
   ============================================================ */
.container-header {
    background-color: #ffffff !important;
    background-image: none !important;
    padding: 0 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    position: sticky !important;
    top: 0;
    z-index: 1050;
    width: 100% !important;
    transition: box-shadow 0.3s ease;
}

/* Enhanced sticky shadow on scroll - added via JS but also default */
.container-header.scrolled {
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* Wrapper interne — this targets the inner div children but we use section 4b for the real layout */
.container-header > div:not(.container-topbar):not(.container-nav) {
    display: flex;
    align-items: center;
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Logo */
.navbar-brand {
    padding: 5px 0;
    margin: 0;
    display: flex;
    align-items: center;
}

.navbar-brand .brand-logo img,
.navbar-brand img {
    max-height: 55px;
    width: auto;
}

.navbar-brand .brand-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

/* Site title as text logo fallback */
.navbar-brand span {
    display: none;
}

/* ============================================================
   4. NAVIGATION — style cre.dz (horizontal, fond vert)
      with HOVER DROPDOWNS (not click only)
   ============================================================ */
.container-header .container-nav {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.container-header .navbar,
.container-header .mod-menu {
    width: 100%;
}

.container-header .grid-child:first-of-type {
    flex-shrink: 0;
}

/* Navbar nav */
.container-header ul.mod-menu,
.container-header nav > ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 2px;
}

.container-header .mod-menu .nav-item > a,
.container-header .mod-menu .nav-item > button,
.container-header .mod-menu .metismenu-item > a,
.container-header .mod-menu .metismenu-item > button,
.container-header nav > ul > li > a {
    display: block;
    color: #333333 !important;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 6px;
    text-decoration: none;
    text-transform: none;
    white-space: nowrap;
    border-bottom: none;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    background: transparent !important;
    border: none;
    cursor: pointer;
    line-height: 1.4;
}

.container-header .mod-menu .nav-item > a:hover,
.container-header .mod-menu .nav-item > button:hover,
.container-header .mod-menu .metismenu-item > a:hover,
.container-header .mod-menu .metismenu-item > button:hover {
    color: #135603 !important;
    background: #f4f4f4 !important;
}

.container-header .mod-menu .nav-item.active > a,
.container-header .mod-menu .nav-item.current > a,
.container-header .mod-menu .metismenu-item.active > a,
.container-header .metismenu-item.current > a {
    color: #ffffff !important;
    background: #135603 !important;
}

/* ===== HOVER-BASED DROPDOWN MENUS ===== */
/* Make parent items position relative for dropdown positioning */
.container-header .nav-item.parent,
.container-header .nav-item.deeper,
.container-header .metismenu-item.parent,
.container-header .metismenu-item.deeper,
.container-header li.parent,
.container-header li.deeper {
    position: relative;
}

/* The mm-toggler buttons in metismenu - hide on desktop */
.container-header .mm-toggler {
    display: none !important;
}

/* Override MetisMenu / default collapse behavior - show dropdown on hover via CSS */
.container-header .mm-collapse,
.container-header ul.mm-collapse,
.container-header .mod-menu__sub {
    display: none;
    position: absolute !important;
    top: 100%;
    left: 0;
    min-width: 240px;
    background-color: #ffffff !important;
    border: none;
    border-top: 3px solid #135603;
    border-radius: 0 0 6px 6px;
    padding: 6px 0;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    margin-top: 0 !important;
    z-index: 1060;
    list-style: none;
    overflow: visible !important;
    height: auto !important;
}

/* Show dropdown on hover (Cassiopeia native .mod-menu__sub + others) */
.container-header li.parent:hover > .mm-collapse,
.container-header li.deeper:hover > .mm-collapse,
.container-header .metismenu-item.parent:hover > .mm-collapse,
.container-header .mm-collapse.mm-show,
.container-header .mm-collapse.show,
.container-header .nav-item.parent:hover > .mod-menu__sub,
.container-header .nav-item.deeper:hover > .mod-menu__sub {
    display: block !important;
    height: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Same for standard Bootstrap dropdowns */
.container-header .dropdown-menu {
    background-color: #ffffff !important;
    border: none;
    border-top: 3px solid #135603;
    border-radius: 0 0 6px 6px;
    min-width: 240px;
    padding: 6px 0;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25) !important;
    margin-top: 0 !important;
}

/* Show Bootstrap dropdown on hover too */
.container-header .nav-item.dropdown:hover > .dropdown-menu,
.container-header .nav-item:hover > .dropdown-menu,
.container-header li.dropdown:hover > .dropdown-menu,
.container-header li.parent:hover > .dropdown-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Dropdown items styling */
.container-header .mm-collapse > li > a,
.container-header .mm-collapse .metismenu-item > a,
.container-header .dropdown-item,
.container-header .dropdown-menu a,
.container-header .mod-menu__sub > li > a {
    color: #333 !important;
    padding: 10px 18px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    display: block !important;
    border-left: 3px solid transparent !important;
    transition: all 0.2s !important;
    background-color: transparent !important;
    white-space: normal !important;
    line-height: 1.4 !important;
}

.container-header .mm-collapse > li > a:hover,
.container-header .mm-collapse .metismenu-item > a:hover,
.container-header .dropdown-item:hover,
.container-header .dropdown-menu a:hover,
.container-header .mod-menu__sub > li > a:hover {
    color: #ffffff !important;
    background-color: #135603 !important;
    border-left-color: #c8e6a0 !important;
    padding-left: 22px !important;
}

/* Sub-sub menus (level 3) */
.container-header .mm-collapse .mm-collapse,
.container-header .dropdown-menu .dropdown-menu {
    top: 0;
    left: 100%;
    border-top: none;
    border-left: 3px solid #135603;
}

/* Burger mobile */
.container-header .navbar-toggler,
.container-header [data-bs-toggle="collapse"] {
    border-color: rgba(255,255,255,0.5);
    color: #fff;
}

/* ============================================================
   4b. HEADER: Flex layout for topbar and logo+menu
   ============================================================ */

/* The <header> itself is a flex container with wrapping so topbar takes full width,
   then logo and nav share the second row */
.container-header {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    padding: 0 !important;
}

/* Topbar spans the full width as first row */
.container-topbar {
    width: 100% !important;
    flex: 0 0 100% !important;
    border-bottom: 1px solid #eee;
}

/* Logo — stays on the left of the second row */
.container-header > .grid-child:not(.container-nav) {
    margin-left: max(15px, calc((100vw - 1500px) / 2)) !important;
    margin-right: 10px !important;
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    width: auto !important;
    flex: 0 0 auto !important;
}

/* Nav — fills the rest of the second row */
.container-header > .container-nav {
    flex: 1 1 0% !important;
    margin-right: max(15px, calc((100vw - 1500px) / 2)) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    min-width: 0 !important;
}

.container-header .container-search {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.container-header form.form-search {
    display: flex;
    align-items: center;
    position: relative;
    width: 40px !important;
    height: 40px !important;
}


/* Base state: looks like a button with an icon */
.container-header form.form-search input,
.container-header form.form-search .js-finder-search-query {
    position: absolute !important;
    right: 0 !important;
    top: 0 !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    color: transparent !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    padding: 8px 16px 8px 36px !important;
    width: 40px !important;
    height: 40px !important;
    outline: none !important;
    cursor: pointer !important;
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), background 0.4s, border-color 0.4s !important;
    box-shadow: none !important;
}

.container-header form.form-search input::placeholder,
.container-header form.form-search .js-finder-search-query::placeholder { 
    color: transparent !important; 
}

/* Adding magnifying glass icon via CSS pseudo-element */
.container-header form.form-search::before {
    content: '\f002'; /* FontAwesome search icon */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #135603;
    pointer-events: none;
    font-size: 15px;
    z-index: 2;
    transition: left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), color 0.4s ease;
}

/* Hover state: slight highlight */
.container-header form.form-search input:hover,
.container-header form.form-search .js-finder-search-query:hover {
    background: rgba(19, 86, 3, 0.05) !important;
}

/* Focus state: expands into a full input field */
.container-header form.form-search input:focus,
.container-header form.form-search .js-finder-search-query:focus {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #135603 !important;
    border: 1px solid #c8e6a0 !important;
    border-radius: 30px !important;
    width: 240px !important;
    cursor: text !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
}

.container-header form.form-search input:focus::placeholder,
.container-header form.form-search .js-finder-search-query:focus::placeholder { 
    color: #888 !important; 
}

.container-header form.form-search:focus-within::before {
    color: #135603;
    left: -187px; /* Move icon 200px to the left to match input expansion */
}

/* Hide default search button to rely on enter key or pseudo icon */
.container-header form.form-search button {
    display: none !important;
}

/* ============================================================
   5. BANNER / SLIDER — largeur limitée comme cre.dz
   ============================================================ */

/* Container banner: sous le header, pas de padding en haut */
.container-banner {
    background: transparent !important;
    background-color: transparent !important;
    margin-top: 0 !important;
    padding: 15px 20px !important;
    max-width: 1100px; /* decreased width */
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box;
}

/* Le carousel hero lui-même — box centrée avec bordure */
#cre-hero-slider {
    overflow: hidden;
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

/* Images du slider */
#cre-hero-slider .carousel-item img {
    width: 100%;
    height: 65vh; /* increased height */
    min-height: 500px;
    max-height: 650px;
    object-fit: cover;
    display: block;
    border-radius: 0;
}

/* Carousel controls dans le hero */
#cre-hero-slider .carousel-control-prev,
#cre-hero-slider .carousel-control-next {
    width: 38px;
    height: 38px;
    background-color: rgba(19, 86, 3, 0.85);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    opacity: 1;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
}

#cre-hero-slider .carousel-control-prev:hover,
#cre-hero-slider .carousel-control-next:hover {
    background-color: rgba(19, 86, 3, 1);
}

/* Indicateurs du hero */
#cre-hero-slider .carousel-indicators {
    margin-bottom: 1.5rem;
}

#cre-hero-slider .carousel-indicators button {
    width: 10px !important;
    height: 10px !important;
    border-radius: 50% !important;
    border: none !important;
    margin: 0 5px;
    background-color: rgba(255,255,255,0.7) !important;
    transition: background 0.2s;
}

#cre-hero-slider .carousel-indicators button.active {
    background-color: #fff !important;
    opacity: 1 !important;
}

/* ===== Autres carousels (container-banner .carousel hors hero) ===== */
.container-banner .carousel:not(#cre-hero-slider),
.container-banner .carousel-inner:not(#cre-hero-slider .carousel-inner) {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    background-color: transparent !important;
}

.container-banner .carousel:not(#cre-hero-slider) {
    border-radius: 0;
}

.container-banner .carousel-inner:not(#cre-hero-slider .carousel-inner) {
    max-height: 420px;
    overflow: hidden;
}

.container-banner .carousel-item img,
.container-banner .carousel-item .carousel-img {
    width: 100%;
    height: 420px;
    object-fit: cover;
    display: block;
}

/* Caption du slider */
.container-banner .carousel-caption {
    background: linear-gradient(transparent, rgba(0,0,0,0.65));
    padding: 30px 20px 20px;
    text-align: left;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 0;
}

.container-banner .carousel-caption h5 {
    font-size: 22px;
    font-weight: 700;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.8);
    color: #fff;
    margin-bottom: 5px;
}

.container-banner .carousel-caption p {
    font-size: 14px;
    color: rgba(255,255,255,0.85);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
}

/* Contrôles des carousels secondaires */
.container-banner .carousel-control-prev,
.container-banner .carousel-control-next {
    width: 44px;
    height: 44px;
    background: rgba(19, 86, 3, 0.75);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    opacity: 1;
}

.container-banner .carousel-control-prev { left: 20px; }
.container-banner .carousel-control-next { right: 20px; }

[dir="rtl"] .container-banner .carousel-control-prev { left: auto; right: 20px; }
[dir="rtl"] .container-banner .carousel-control-next { right: auto; left: 20px; }

.container-banner .carousel-control-prev:hover,
.container-banner .carousel-control-next:hover {
    background: rgba(19, 86, 3, 1);
}

.container-banner .carousel-indicators {
    margin-bottom: 10px;
}

.container-banner .carousel-indicators button {
    width: 10px !important;
    height: 10px !important;
    border-radius: 50% !important;
    background-color: rgba(255,255,255,0.6) !important;
    border: none !important;
    margin: 0 4px;
}

.container-banner .carousel-indicators button.active {
    background-color: #c8e6a0 !important;
}

/* Module custom dans banner */
.container-banner .mod_custom,
.container-banner .custom {
    width: 100%;
}

.container-banner .panel-content {
    padding: 0;
}

/* ============================================================
   6. TOP-A — News ticker "Dernières Nouvelles" style cre.dz
   ============================================================ */
.container-top-a {
    background: #fff;
    border-top: 3px solid #135603;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 !important;
    width: 100%;
    max-width: 100%;
}

.container-top-a .grid-child {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Titre "Flash d'information" → style ticker */
.container-top-a .card {
    border: none !important;
    border-radius: 0;
    background: transparent;
    box-shadow: none !important;
    padding: 0;
}

.container-top-a .card-header,
.container-top-a h3.card-title,
.container-top-a .moduletable > h3,
.container-top-a .module-title {
    display: inline-block;
    background: #135603;
    color: #fff !important;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 16px;
    margin: 0;
    border-radius: 0;
    white-space: nowrap;
    vertical-align: middle;
}

/* News items horizontal list */
.container-top-a .mod-articles-news {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    overflow: hidden;
}

.container-top-a .mod-articles-news__item,
.container-top-a .com-content-article__intro,
.container-top-a ul li {
    border: none !important;
    padding: 8px 15px;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.container-top-a .mod-articles-news__item a {
    color: #333;
    text-decoration: none;
    font-size: 13px;
}

.container-top-a .mod-articles-news__item a:hover { color: #135603; }

/* ============================================================
   7. TOP-B — Corps principal avec sidebar layout
   ============================================================ */
.container-top-b {
    background: #f4f4f4;
    padding: 20px 0;
}

.container-top-b .card {
    border: none !important;
    background: transparent;
    box-shadow: none !important;
    padding: 0;
}

/* ============================================================
   8. LAYOUT PRINCIPAL — grille + sidebar comme cre.dz
   ============================================================ */
.site-grid {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    max-width: 100%;
    overflow: hidden;
}

/* Quand sidebar-right est présente */
.site-grid.has-sidebar-right {
    grid-template-columns: 1fr 300px;
}

/* Container-component (article principal) */
.grid-child.container-component {
    background: #fff;
    padding: 20px;
}

/* ============================================================
   9. SECTION TITLES (style cre.dz — vert avec underline)
   ============================================================ */
.cre-section-heading,
.animate-fadeInUp h3,
.animate-fadeInUp h1,
.mod-articles-category-title-wrap h3,
h3.section-title {
    color: #135603;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    position: relative;
    padding-bottom: 12px;
    margin-bottom: 25px;
}

.animate-fadeInUp h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: #135603;
    border-radius: 2px;
}

/* ============================================================
   10. GRILLE DIVISIONS DE RECHERCHE — style cre.dz (4 cards)
   ============================================================ */
.mod-articlescategory .row,
.mod-articlescategory .grid-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    padding: 0 5px;
}

.mod-articlescategory .card,
.research-card {
    border: 1px solid #e0e0e0 !important;
    border-radius: 5px;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
    background: #fff;
}

.mod-articlescategory .card:hover,
.research-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
}

.mod-articlescategory .card-img-top,
.research-card img {
    height: 180px;
    object-fit: cover;
    width: 100%;
    transition: transform 0.3s ease;
}

.mod-articlescategory .card:hover .card-img-top {
    transform: scale(1.05);
}

/* Overlay "VIEW POST" on hover */
.mod-articlescategory .card-img-top-wrap {
    position: relative;
    overflow: hidden;
}

.mod-articlescategory .card-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.4;
}

.mod-articlescategory .card-title a {
    color: #135603;
    text-decoration: none;
}

.mod-articlescategory .card-title a:hover { color: #0a3a01; }

.mod-articlescategory .card-text {
    font-size: 12px;
    color: #666;
    line-height: 1.6;
}

.mod-articlescategory .card-body {
    padding: 12px;
}

.mod-articlescategory small.text-muted,
.mod-articlescategory .card-date {
    font-size: 11px;
    color: #888;
    display: block;
    margin-bottom: 5px;
}

.mod-articlescategory .btn,
.mod-articlescategory a.readmore {
    display: inline-block;
    font-size: 12px;
    padding: 5px 14px;
    color: #135603;
    border: 1px solid #135603;
    border-radius: 3px;
    text-decoration: none;
    transition: all 0.2s;
    margin-top: 8px;
}

.mod-articlescategory .btn:hover,
.mod-articlescategory a.readmore:hover {
    background: #135603;
    color: #fff;
}

/* ============================================================
   11. CAROUSEL / SLIDER D'ACTUALITÉS (position top-b, bottom-b)
   ============================================================ */

/* Miniature + description style carouselck de cre.dz */
.cre-news-ticker {
    background: #fff;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 4px;
}

.carousel .card {
    border: 1px solid #e5e5e5 !important;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07) !important;
}

.carousel .card-title a {
    color: #135603;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.carousel .card-title a:hover { color: #0a3a01; }

.carousel-control-prev,
.carousel-control-next {
    width: 36px;
    height: 36px;
    background: #135603;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    opacity: 1;
    filter: none !important;
}

.carousel-control-prev { left: -18px; }
.carousel-control-next { right: -18px; }

[dir="rtl"] .carousel-control-prev { left: auto; right: -18px; }
[dir="rtl"] .carousel-control-next { right: auto; left: -18px; }

.carousel-control-prev:hover,
.carousel-control-next:hover { background: #0a3a01; }

.carousel-indicators button {
    background-color: #aaa !important;
    border-radius: 50% !important;
    width: 8px !important;
    height: 8px !important;
    border: none !important;
}

.carousel-indicators button.active { background-color: #135603 !important; }

/* ============================================================
   12. SIDEBAR DROITE — style cre.dz
   ============================================================ */
.container-sidebar-right {
    width: 280px;
    min-width: 260px;
    max-width: 300px;
    padding-left: 15px;
}

.container-sidebar-right .card,
.sidebar-right .card {
    border: 1px solid #ddd !important;
    border-radius: 4px;
    margin-bottom: 15px;
    overflow: hidden;
    box-shadow: none !important;
    background: #fff;
}

.container-sidebar-right .card-header,
.sidebar-right .card-header,
.container-sidebar-right .module-title,
.container-sidebar-right h3 {
    background-color: #135603 !important;
    color: #fff !important;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 14px;
    margin: 0;
    border-radius: 0;
    border: none;
}

.container-sidebar-right .card-body,
.sidebar-right .card-body {
    padding: 12px;
}

/* Liens utiles */
.container-sidebar-right ul,
.sidebar-right ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.container-sidebar-right ul li,
.sidebar-right ul li {
    border-bottom: 1px solid #f0f0f0;
    padding: 6px 0;
    font-size: 13px;
}

.container-sidebar-right ul li:last-child { border-bottom: none; }

.container-sidebar-right ul li::before {
    content: '› ';
    color: #135603;
    font-weight: 700;
    margin-right: 4px;
}

.container-sidebar-right ul li a,
.sidebar-right ul li a {
    color: #444;
    text-decoration: none;
    font-size: 12px;
    transition: color 0.2s;
}

.container-sidebar-right ul li a:hover { color: #135603; }

/* Accordion "Valeurs" dans la sidebar */
.container-sidebar-right .accordion-button {
    background: #135603 !important;
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 12px;
    border: none;
}

.container-sidebar-right .accordion-button::after {
    filter: invert(1);
}

.container-sidebar-right .accordion-item {
    border: 1px solid #135603 !important;
    margin-bottom: 4px;
}

.container-sidebar-right .accordion-body {
    font-size: 12px;
    color: #444;
    padding: 10px 12px;
    background: #fff;
}

/* ============================================================
   13. BOTTOM-A / BOTTOM-B (sections supplémentaires)
   ============================================================ */
.container-bottom-a,
.container-bottom-b {
    background: #f9f9f9;
    padding: 20px 0;
    border-top: 1px solid #e8e8e8;
}

.container-bottom-a .card,
.container-bottom-b .card {
    border: none !important;
    background: transparent;
    box-shadow: none !important;
}

/* ============================================================
   14. FOOTER — vert foncé comme cre.dz
   ============================================================ */
.container-footer {
    background-color: #0f4002 !important;
    color: #cde5b8 !important;
    padding: 35px 0 0 0;
    margin-top: 0;
}

.container-footer .grid-child {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.container-footer a {
    color: #9fcf78 !important;
    text-decoration: none;
    transition: color 0.2s;
}

.container-footer a:hover { color: #ffffff !important; }

/* Footer headings */
.footer-heading,
.container-footer h3,
.container-footer h4 {
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(200, 230, 160, 0.4);
}

/* Footer contact list */
.footer-contact-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-contact-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #bdd9a0;
    line-height: 1.5;
}

.footer-contact-list li i {
    color: #c8e6a0;
    font-size: 14px;
    margin-top: 2px;
    flex-shrink: 0;
    width: 16px;
}

/* Footer links */
.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 6px;
    padding-left: 12px;
    position: relative;
    font-size: 13px;
}

.footer-links li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: #c8e6a0;
    font-size: 15px;
    line-height: 1;
}

.footer-links li a {
    color: #9fcf78 !important;
    font-size: 13px;
    transition: color 0.2s, padding-left 0.2s;
}

.footer-links li a:hover {
    color: #fff !important;
    padding-left: 3px;
}

/* Social icons */
.footer-social-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 15px;
    color: #fff !important;
    transition: transform 0.25s, box-shadow 0.25s;
    text-decoration: none !important;
}

.social-icon.facebook  { background: #1877F2; }
.social-icon.youtube   { background: #FF0000; }
.social-icon.linkedin  { background: #0077B5; }
.social-icon.twitter   { background: #1DA1F2; }
.social-icon.instagram { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.social-icon.google-scholar { background: #4285F4; }

.social-icon:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
    color: #fff !important;
}

/* Footer bottom bar */
.footer-divider { border-color: rgba(255,255,255,0.12); margin: 25px 0 12px; }

.footer-copyright {
    color: #88bb65;
    font-size: 12px;
    padding-bottom: 18px;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 12px;
}

/* ============================================================
   15. ARTICLES / CONTENT
   ============================================================ */
.container-component {
    background: #fff;
}

.com-content-article {
    box-shadow: none;
}

/* Cache les infos d'article inutiles */
/*.com-content-article__info-block,
.article-info,
.com-content-article .article-info,*/
.createdby,
.tags,
.hits/*,
dl.article-info*/ { display: none !important; }

.pager { display: none !important; }

/* Breadcrumbs */
.container-component .breadcrumb {
    background: transparent;
    padding: 8px 0;
    font-size: 12px;
    color: #888;
}

/* ============================================================
   16. MOD_ARTICLES_NEWS — style ticker horizontal
   ============================================================ */
.mod-articles-news {
    background: #fff;
}

.mod-articles-news__item {
    border-bottom: 1px solid #eee;
    padding: 10px 0;
    font-size: 13px;
}

.mod-articles-news__item:last-child { border-bottom: none; }

.mod-articles-news__item a {
    color: #333;
    text-decoration: none;
    font-weight: 600;
}

.mod-articles-news__item a:hover { color: #135603; }

/* ============================================================
   17. SECTION WRAPPERS (module custom "cre-section")
   ============================================================ */
.cre-section {
    padding: 20px 0;
    width: 100%;
}

/* ============================================================
   18. ÉVÉNEMENTS & ACTUALITÉS — sections vides avec titre
   ============================================================ */
/* Style pour les titres H2/H3 quand aucun article n'est listé */
.container-component h2,
.grid-child.container-component h2 {
    color: #135603;
    font-size: 24px;
    font-weight: 700;
    padding-bottom: 10px;
    margin-bottom: 20px;
    border-bottom: 3px solid #135603;
    position: relative;
}

/* ============================================================
   19. UTILITIES
   ============================================================ */
.text-cre { color: #135603 !important; }
.bg-cre   { background-color: #135603 !important; }
.border-cre { border-color: #135603 !important; }

.btn-cre {
    background: #135603;
    color: #fff;
    border: 1px solid #135603;
    border-radius: 3px;
    padding: 6px 16px;
    font-size: 13px;
    transition: background 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-cre:hover {
    background: #0a3a01;
    color: #fff;
}

/* ============================================================
   20. SHORTCODE STYLES — dropcap, box, tabs, drawer, accordion
   ============================================================ */

/* DROPCAP */
.cre-dropcap {
    float: left;
    font-size: 3.5em;
    line-height: 0.85;
    font-weight: 700;
    color: #135603;
    margin-right: 8px;
    margin-top: 4px;
    font-family: 'Roboto Slab', Georgia, serif;
    text-shadow: 1px 1px 0 rgba(19, 86, 3, 0.15);
}

/* BOX */
.cre-box {
    border: 1px solid #ddd;
    border-radius: 6px;
    margin: 20px 0;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.cre-box-title {
    background: linear-gradient(135deg, #135603, #1a7a04);
    color: #fff;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
}

.cre-box-content {
    padding: 15px 18px;
    font-size: 13px;
    line-height: 1.7;
    color: #444;
}

/* TABS */
.cre-tabs {
    border-bottom: 2px solid #135603;
    margin-bottom: 0;
}

.cre-tabs .nav-link {
    color: #555;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    border-bottom: none;
    padding: 8px 16px;
    margin-bottom: -2px;
    border-radius: 4px 4px 0 0;
    transition: all 0.2s;
    background: transparent;
}

.cre-tabs .nav-link:hover {
    color: #135603;
    background: rgba(19,86,3,0.05);
    border-color: #e0e0e0 #e0e0e0 transparent;
}

.cre-tabs .nav-link.active {
    color: #fff;
    background: #135603;
    border-color: #135603;
}

.cre-tab-content {
    padding: 18px;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    background: #fff;
    font-size: 13px;
    line-height: 1.7;
}

/* DRAWER */
.cre-drawer {
    margin: 15px 0;
}

.cre-drawer-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #135603;
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.cre-drawer-toggle:hover {
    background: #0a3a01;
}

.cre-drawer-toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.cre-drawer-toggle i {
    transition: transform 0.3s;
    font-size: 11px;
}

.cre-drawer-content {
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    background: #fafafa;
    font-size: 13px;
    line-height: 1.7;
}

/* ACCORDION from articles (CRE-specific green) */
.cre-accordion .accordion-item {
    border: 1px solid #135603 !important;
    margin-bottom: 4px;
    border-radius: 4px;
    overflow: hidden;
}

.cre-accordion .accordion-button {
    background: linear-gradient(135deg, #135603, #1a7a04) !important;
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    padding: 12px 15px;
    border: none;
    box-shadow: none !important;
}

.cre-accordion .accordion-button:not(.collapsed) {
    background: #135603 !important;
    color: #fff !important;
}

.cre-accordion .accordion-button::after {
    filter: invert(1);
}

.cre-accordion .accordion-body {
    font-size: 13px;
    color: #444;
    padding: 15px;
    line-height: 1.7;
    background: #fff;
}

/* ============================================================
   21. RESPONSIVE
   ============================================================ */
@media (max-width: 991px) {
    .container-header > div {
        flex-wrap: wrap;
    }

    .container-header .container-nav {
        width: 100%;
    }

    .container-banner .carousel-inner { max-height: 280px; }
    .container-banner .carousel-item img { height: 280px; }

    .container-sidebar-right {
        width: 100%;
        max-width: 100%;
        padding-left: 0;
        border-top: 2px solid #135603;
        margin-top: 15px;
    }

    /* On mobile, show mm-toggler and hide hover behavior */
    .container-header .mod-menu .mm-toggler {
        display: inline-block !important;
    }

    .container-header .mod-menu .mm-collapse,
    .container-header .mod-menu ul.mm-collapse {
        position: relative !important;
        top: auto;
        left: auto;
        box-shadow: none;
        border: none;
        border-top: 1px solid rgba(255,255,255,0.1);
        background-color: rgba(0,0,0,0.15) !important;
        min-width: auto;
        border-radius: 0;
    }

    .container-header .mod-menu li.parent:hover > .mm-collapse,
    .container-header .mod-menu li.deeper:hover > .mm-collapse {
        display: none !important;
    }

    .container-header .mod-menu .mm-collapse.mm-show {
        display: block !important;
    }

    .container-header .mod-menu .mm-collapse > li > a,
    .container-header .mod-menu .mm-collapse .metismenu-item > a {
        color: #fff !important;
        padding-left: 25px;
    }

    .container-header .mod-menu .mm-collapse > li > a:hover,
    .container-header .mod-menu .mm-collapse .metismenu-item > a:hover {
        background: rgba(255,255,255,0.1) !important;
        color: #c8e6a0 !important;
    }
}

@media (max-width: 767px) {
    .container-banner .carousel-inner { max-height: 200px; }
    .container-banner .carousel-item img { height: 200px; }
    .container-banner .carousel-caption h5 { font-size: 16px; }

    .mod-articlescategory .col-md-3,
    .mod-articlescategory .col-sm-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .carousel-control-prev { left: 5px; }
    .carousel-control-next { right: 5px; }

    [dir="rtl"] .carousel-control-prev { left: auto; right: 5px; }
    [dir="rtl"] .carousel-control-next { right: auto; left: 5px; }

    .container-header .mod-menu .nav-item > a,
    .container-header .mod-menu .metismenu-item > a {
        padding: 12px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .mod-articlescategory .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ============================================================
   22. TWEAKS POUR CASSIOPEIA SPÉCIFIQUE
   ============================================================ */

/* Remove default cassiopeia borders */
.container-top-a.grid-child,
.container-top-b.grid-child {
    width: 100%;
    max-width: 100%;
    padding: 0;
}

/* Full width banner override */
.container-banner.full-width {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

/* Remove card style from module wrappers in top-a */
.container-top-a .moduletable {
    border: none;
    box-shadow: none;
    background: transparent;
}

/* Default module wrappers */
.moduletable {
    margin-bottom: 15px;
}

/* Position du module "Divisions de recherche" custom HTML */
.container-top-b .mod_custom {
    background: #fff;
    padding: 20px;
    border-radius: 4px;
}

/* Site grid full container */
.container-header.full-width,
.container-banner.full-width,
.container-footer.full-width {
    max-width: 100% !important;
}

/* Inner wrapper */
.container-header > .grid-child,
.site-grid > .grid-child.container-top-a,
.site-grid > .grid-child.container-top-b {
    padding: 0 15px;
}

/* Cassiopeia "grid-child" max width center */
.site-grid > div.grid-child:not(.full-width):not(.container-banner) {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    padding: 10px 15px;
}

/* ============================================================
   23. MODULE TITLES — uniformiser le style
   ============================================================ */
.card > .card-header:first-child,
.moduletable > .card > .card-header {
    background: #135603 !important;
    color: #fff !important;
    font-size: 14px;
    font-weight: 700;
    border: none;
    border-radius: 0 !important;
    padding: 10px 15px;
}

/* Remove unwanted Cassiopeia card styling from non-sidebar modules */
.container-top-a > .card,
.container-top-b > .card,
.container-bottom-a > .card,
.container-bottom-b > .card {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border-radius: 0 !important;
}

.container-top-a > .card > .card-header,
.container-top-b > .card > .card-header,
.container-bottom-a > .card > .card-header {
    background: transparent !important;
    color: #333 !important;
    border: none;
    padding: 0;
}

/* ============================================================
   24. ANNONCE / ACTUALITÉS SECTION TITLES
   ============================================================ */
.section-divider {
    text-align: center;
    padding: 15px 0 5px;
}

.section-divider h2, .section-divider h3 {
    display: inline-block;
    background: #135603;
    color: #fff;
    padding: 6px 20px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 2px;
    margin-bottom: 0;
}

/* ============================================================
   25. HERO SLIDER MODULE CUSTOM — si pas de mod_articles_category
   ============================================================ */
.cre-hero-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #1a1a1a;
    max-height: 420px;
}

.cre-hero-slider .slide {
    width: 100%;
    height: 420px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

.cre-hero-slider .slide-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 40px 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.65));
    color: #fff;
}

.cre-hero-slider .slide-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.8);
}

.cre-hero-slider .slide-subtitle {
    font-size: 15px;
    color: rgba(255,255,255,0.85);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
}

/* ============================================================
   26. ARTICLE CONTENT — polished typography for client presentation
   ============================================================ */
.com-content-article .article-content,
.com-content-article__body {
    font-size: 14px;
    line-height: 1.8;
    color: #333;
}

.com-content-article__body h1,
.com-content-article__body h2,
.com-content-article__body h3,
.com-content-article__body h4 {
    color: #135603;
    margin-top: 25px;
    margin-bottom: 12px;
}

.com-content-article__body h1 { font-size: 28px; border-bottom: 3px solid #135603; padding-bottom: 8px; }
.com-content-article__body h2 { font-size: 22px; border-bottom: 2px solid #c8e6a0; padding-bottom: 6px; }
.com-content-article__body h3 { font-size: 18px; }
.com-content-article__body h4 { font-size: 16px; }

.com-content-article__body ul,
.com-content-article__body ol {
    padding-left: 20px;
    margin-bottom: 15px;
}

.com-content-article__body ul li,
.com-content-article__body ol li {
    margin-bottom: 6px;
    line-height: 1.7;
}

.com-content-article__body a {
    color: #135603;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.com-content-article__body a:hover {
    color: #0a3a01;
}

/* ============================================================
   27. ANIMATIONS — subtle entrance effects
   ============================================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease-out both;
}

/* ============================================================
   28. BACK-TO-TOP BUTTON (Cassiopeia default + custom style)
   ============================================================ */
#back-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 42px;
    height: 42px;
    background: #135603;
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
    box-shadow: 0 3px 12px rgba(0,0,0,0.3);
    z-index: 999;
}

#back-top.visible {
    opacity: 1;
    visibility: visible;
}

#back-top:hover {
    background: #0a3a01;
    transform: translateY(-3px);
}

/* ============================================================
   29. PRINT STYLES
   ============================================================ */
@media print {
    .container-header,
    .container-footer,
    .container-sidebar-right,
    #back-top {
        display: none !important;
    }
    body { background: #fff; }
    .container-component { box-shadow: none; }
}
