/* Styles CSS pour le header et la barre de recherche Ecosia */

/* La barre de dégradé en haut */
.top-gradient-bar {
    width: 100%;
    height: 8px;
    background: linear-gradient(to right, #006b75 0%, #753a31 40%, #e87b24 75%, #d32f2f 100%);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10000;
}

body {
    margin: 0px;
    padding-top: 8px;
    /* Ajoute un espace pour la barre de dégradé en haut */
}

/* Badge utilisateur */
#user-zone {
    grid-column: 4 / 10;
    align-self: center;
    justify-self: center;
    transform: scale(1.1);
}

html {
    font-family: 'FamiliarPro-Black', helvetica, sans-serif;
    text-decoration: none;
}

header {
    position: fixed;
    z-index: 999;
    width: 100%;
    max-height: calc(18% + 50px);
    top: 8px;
    background-color: #fff;
    -moz-box-shadow: 0px 3px 5px -1px #323232;
    -webkit-box-shadow: 0px 3px 5px -1px #323232;
    -o-box-shadow: 0px 3px 5px -1px #323232;
    box-shadow: 0px 3px 5px -1px #323232;
}

/* Barre de recherche Ecosia */
.ecosia-search-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 145px auto 15px auto;
    width: 100%;
    max-width: 650px;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Style de l'image logo Ecosia */
.ecosia-logo-img {
    width: 100%;
    max-width: 200px;
    height: auto;
    margin-bottom: 20px;
    display: block;
    filter: drop-shadow(0px 4px 6px rgba(0, 0, 0, 0.1));
}

.ecosia-form {
    display: flex;
    width: 100%;
    background: #fff;
    border-radius: 40px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 2px solid #e2e8f0;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Effet quand on clique dans la barre */
.ecosia-form:focus-within {
    box-shadow: 0 6px 20px rgba(0, 128, 9, 0.2);
    border-color: #008009;
}

.ecosia-form input {
    flex-grow: 1;
    border: none;
    padding: 16px 25px;
    font-size: 18px;
    outline: none;
    background: transparent;
    color: #333;
}

/* Bouton loupe Ecosia  */
.ecosia-form button {
    background: transparent;
    border: none;
    padding: 0 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

/* On cible spécifiquement l'image (loupe.avif) à l'intérieur du bouton */
.ecosia-form button img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    filter: hue-rotate(135deg) saturate(1.2); /* Teinte verte (Rouge en Vert) */
    transition: transform 0.2s ease, filter 0.2s ease; /* Ajout d'une transition pour les filtres aussi */
}

/* Effet au survol de la souris */
.ecosia-form button:hover img {
    transform: scale(1.15);
    filter: hue-rotate(135deg) saturate(1.5) brightness(0.9);
}

/* Grilles et cartes (adapté de homepage.css pour être unifié avec header.css) */

/* On force toutes les grilles possibles à obéir à la règle des 6 colonnes */
.apps-grid,
.cards-container,
.services-grid,
.tools-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    /* 6 colonnes */
    gap: 15px;
    max-width: 1350px;
    margin: 0 auto !important;
    padding: 0 20px;
}

/* Style de base commun à toutes les cartes (réduction de taille et centrage) */
.apps-grid>*,
.cards-container>*,
.services-grid>*,
.tools-grid>* {
    min-width: 0;
    padding: 10px 5px !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Taille des images dans les cartes */
.apps-grid img,
.cards-container img {
    max-height: 55px !important;
    width: auto;
    margin-bottom: 8px;
}

/* Taille de police dans les cartes */
.apps-grid a,
.apps-grid span,
.apps-grid div,
.cards-container a,
.cards-container span {
    font-size: 11px !important;
    line-height: 1.2;
    word-wrap: break-word;
}

/* Effet de survol commun */
.apps-grid>*:hover,
.cards-container>*:hover,
.services-grid>*:hover,
.tools-grid>*:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.barre-brisach {
    position: relative;
    height: 5px;
    width: 100%;
    overflow: hidden;
}

.barre-brisach .barre-brisach-center {
    background-image: url(../images/quadri.avif);
    background-repeat: no-repeat;
    background-color: transparent;
    background-position: center top;
    width: 100%;
    position: absolute;
    top: 0px;
    z-index: 2;
    height: 100%;
}

.nav {
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 10px;
    padding-top: 5px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
    grid-template-rows: 100%;
    align-items: center;
}

#logo {
    grid-column: 1/4;
    grid-row: 1;
}

#trombinoscope_elus {
    grid-column: 10;
    grid-row: 1;
}

#trombinoscope_elus .header_titles {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    font-size: calc(1vw + 1vh);
}

#organigramme {
    grid-column: 11;
    grid-row: 1;
}

#trombinoscope {
    grid-column: 12;
    grid-row: 1;
}

#pratiques {
    grid-column: 13;
    grid-row: 1;
}

#aide {
    grid-column: 14;
    grid-row: 1;
}

#cirtel {
    margin: 10px;
    grid-column: 16/19;
    grid-row: 1;
}

#logo img {
    max-width: 100%;
}

.logos {
    max-width: 100%;
    max-height: 100%;
    border-radius: 50px;
}

.cirtellogo {
    max-width: 100%;
}

/*toggle section*/

.toggle-section-button {
    margin-left: -28px;
    display: inline-block;
    width: 28px;
    height: 28px;
    font-size: 1.5rem;
    vertical-align: middle;
}

.toggle-section-button::before {
    content: "";
    display: inline-block;
    background: url("../images/toggle_button.avif") no-repeat center center;
    background-size: 100% 100%;
    width: 32px;
    height: 32px;
}

.toggle-section-button.not-selected {
    transition: transform 0.25s;
    transform: rotate(-0.25turn);
}

.toggle-section-button.selected {
    transition: transform 0.25s;
}

.toggle-section-button:hover {
    cursor: pointer;
}

.section-unselected :not(.toggle-exception) {
    display: none;
    height: 0;
}

/* Amélioration de la lisibilité des titres dans les cartes (adapté de homepage.css) */

/* La grille */
.container {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 40px !important;
    /* Plus d'espace entre les cartes */
    max-width: 1000px !important;
    /* Limite la largeur totale de la grille */
    margin: 0 auto !important;
    /* Centre la grille sur la page */
    padding: 0 20px !important;
    /* Marge de sécurité sur les bords */
}

/* Le lien <a> devient lui-même la carte blanche */
.container>a {
    text-decoration: none !important;
    color: inherit !important;
    background-color: #fff !important;
    /* Le fond blanc est sur le lien */
    border-radius: 12px !important;
    /* Bords arrondis */
    padding: 15px 10px !important;
    /* Réduit l'espace vide à l'intérieur */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    /* Petite ombre de base */

    display: flex !important;
    /* Transforme le lien en conteneur flexible */
    flex-direction: column;
    /* Aligne les éléments verticalement */
    align-items: center;
    /* Centre horizontalement les éléments à l'intérieur du lien */
    justify-content: center;
    /* Centre verticalement les éléments à l'intérieur du lien */
    height: 100%;
    /* Assure que le lien prend toute la hauteur de la carte */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* Transition pour les effets de survol */
}

/* L'effet de survol s'applique au lien */
.container>a:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12) !important;
}

/* Désactivation de la div .app pour qu'elle ne gêne pas la structure */
.container .app {
    display: contents !important;
}

/* Ajustement des icônes */
.container .applogo img {
    height: 50px !important;
    /* Hauteur fixe pour harmoniser toutes les icônes */
    width: auto !important;
    /* Largeur automatique pour éviter la déformation */
    object-fit: contain;
    /* Empêche l'icône de se déformer */
    margin-bottom: 10px !important;
}

/* Ajustement des textes */
.container .apptexte h3,
.container .apptexte h4 {
    font-size: 12px !important;
    /* Taille de police plus petite pour les titres */
    margin: 0 !important;
    /* Supprime les marges par défaut */
    line-height: 1.2 !important;
    /* Réduit l'espacement entre les lignes */
    text-align: center;
    word-wrap: break-word;
}

/* Protection pour les petits écrans */
@media (max-width: 950px) {
    .container {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (max-width: 650px) {
    .container {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/*quand l'écran est trop petit on change le grid */
@media (max-width: 850px) {

    #user-zone {
        display: none !important;
    }

    .nav {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
        grid-template-rows: 100%;
        align-items: center;
    }

    #pratiques {
        grid-column: 4;
        grid-row: 1;
    }

    #aide {
        grid-column: 5;
        grid-row: 1;
    }

    #cirtel {
        margin: 10px;
        grid-column: 9/12;
        grid-row: 1;
    }

    #logo {
        grid-column: 1/4;
        grid-row: 1;
    }

    /* Ajustement des grilles sur tablette : toutes passent en mode adaptatif */
    .apps-grid,
    .cards-container,
    .services-grid,
    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 15px;
        padding: 0 15px;
    }
}

/* Header et barre de recherche : adaptations pour les mobiles (adapté de homepage.css pour être unifié avec header.css) */
@media (max-width: 900px) {
    header {
        max-height: none !important;
        height: auto !important;
        top: 8px !important;
        position: fixed !important;
    }

    .nav {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: auto auto !important;
        gap: 15px 0px !important;
        padding: 10px !important;
        align-items: center !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Ligne 1 : Logo (Gauche) et 4 Icônes (Droite) */
    #logo {
        grid-column: 1 !important;
        grid-row: 1 !important;
        justify-self: start !important;
        display: flex !important;
    }

    #organigramme, #trombinoscope, #pratiques, #aide {
        grid-row: 1 !important;
        grid-column: 2 !important;
        display: flex !important;
        justify-self: end !important;
    }

    /* Décalage manuel pour simuler un groupe à droite dans la cellule GRID */
    #organigramme { margin-right: 105px !important; }
    #trombinoscope { margin-right: 70px !important; }
    #pratiques { margin-right: 35px !important; }
    #aide { margin-right: 0 !important; }

    /* Ligne 2 : Badge Utilisateur (Gauche) et Logo CIRTEL (Droite) */
    #user-zone {
        grid-column: 1 !important;
        grid-row: 2 !important;
        justify-self: start !important;
        display: flex !important;
        visibility: visible !important;
        position: relative !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: scale(0.85) !important;
        transform-origin: left center;
        box-sizing: border-box !important;
        min-width: 0 !important; /* Permet au texte de ne pas forcer la largeur */
    }

    #cirtel {
        grid-column: 2 !important;
        grid-row: 2 !important;
        justify-self: end !important;
        display: flex !important;
        margin: 0 !important;
    }

    /* Taille des icônes de navigation */
    .logos, #aide img, #pratiques img, #trombinoscope img, #organigramme img {
        width: 30px !important;
        height: 30px !important;
        object-fit: contain !important;
        margin: 0 !important;
        transform: none !important;
        border-radius: 50px !important;
    }

    /* Logo CIRTEL */
    .cirtellogo {
        width: 70px !important;
        height: auto !important;
        margin: 0 !important;
    }

    /* Logo CCARB principal */
    #logo img {
        max-height: 35px !important;
        width: auto !important;
    }

    /* Loupe Ecosia */
    .ecosia-form button {
        padding: 0 15px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .ecosia-form button img {
        width: 25px !important;
        height: 25px !important;
        object-fit: contain !important;
        filter: hue-rotate(135deg) saturate(1.2) !important;
        margin: 0 !important;
    }
}
