/**
 * Styles spécifiques à l'en-tête de l'application.
 *
 * Ce fichier contient les règles CSS pour la barre de navigation latérale (desktop)
 * et la barre de navigation inférieure (mobile/tabbar). Il gère les logos, les liens
 * de navigation, les icônes, les menus déroulants de profil, et les animations.
 */

/* ==========================================================================
   1. Styles de l'en-tête principal (Desktop)
   ========================================================================== */

header{
    width: 15dvw;
    height: 100dvh;
    position: relative;
}

/* Cas d'un header alternatif minimaliste (ex: page de connexion) */
.header_greenBarOnly{
    width: 0;
    height: 0;
}

/* Styles spécifiques aux liens de navigation dans le header */
a.nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3em;
    font-family: Segoe, Helvetica, Arial, sans-serif;
    user-select: none;
    text-align: center;
    width: 100%;
    color: #efefef;
}

a.nav svg {
    font-size: 120%;
}

a.nav:hover{
    color: #0B70B6;
}

/* Barre latérale verte (menu principal) */
.greenBar{
    background-color: #2AAF52;
    height: 100dvh;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
    overflow-y: scroll;
    overflow-x: hidden;
}

/* Cache la scrollbar spécifiquement pour .greenBar */
.greenBar::-webkit-scrollbar {
    display: none;
}

/* Logo dans l'en-tête */
.logo{
    width: 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.5dvh;
}

.logo img{
    width: 100%;
    height: auto;
}

/* Barre de liens sociaux (si présente) */
.social-bar {
    display: flex;
    width: 100%;
    gap: 0.625rem !important; /* 10px */
    flex-direction: row !important;
    flex-wrap: wrap;
}

.social-item{
    padding: 0 !important;
}

.social-item a {
    display: block;
    width: 1.75rem; /* 28px */
    height: 1.75rem; /* 28px */
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Conteneur général des éléments de l'en-tête */
.containerAll{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    flex-basis: 50%;
    flex-grow: 1;
    width: 100%;
    gap: 1dvh;
}

/* Barre d'outils (groupe de liens de navigation) */
.toolbar{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5dvh;
    width: 100%;
}

.toolbar > .nav {
    padding: 0 1dvw;
}

/* Section de recherche dans le header */
.search{
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 2%;
    width: 100%;
}

.search form{
    width: 80%;
}

.search form input{
    width: 100%;
    padding: 0.3125rem; /* 5px */
    border: 1px solid #333;
    border-radius: 0.3125rem; /* 5px */
}

/* Bouton d'ajout de post */
.add_post {
    display: block;
    width: min-content;
}

.plus {
    width: 3em;
    cursor: pointer;
    height: 3em;
    background: #0B70B6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.plus__line {
    width: 0.25rem; /* 4px */
    height: 1.5em;
    background: #000;
    border-radius: 0.625rem; /* 10px */
    position: absolute;
}
.plus__line--h {
    transform: rotate(90deg);
}
.plus__line--v {
    /* Styles déjà sur .plus */
}

/* Liste de navigation dans la greenBar */
.greenBar ul {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1dvh;
    width: 100%;
    padding: 0;
}

.greenBar ul li {
    padding: 0 1em;
    text-align: center;
    list-style-type: none;
}

/* Styles pour le header minimaliste .greenBarOnly */
.greenBarOnly{
    background-color: #2AAF52;
    position: fixed;
    height: 3.125rem; /* 50px */
    width: 100%;
    display: flex;
    align-items: center;
    z-index: 1;
}

.greenBarOnly a{
    position: relative;
    left:18%;
    color: #ffffff;
}

/* Style pour un lien "home" spécifique au header */
.home{
    color: #ffffff;
    font-size: 2rem; /* 32px */
    user-select: none;
}

/* Styles pour le bouton de profil et son menu déroulant */
.buttonProfil{
    cursor: pointer;
    width: 100%;
    padding:  1.0625rem; /* 17px */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem; /* 10px */
}

.buttonProfil p{
    color: #ffffff;
    font-size: 1rem; /* 16px */
    user-select: none;
}

.buttonProfil:hover{
    background-color: #0B70B6;
}

.down-arrow{
    position:relative;
    top: 0.125rem; /* 2px */
    height:0.625rem; /* 10px */
}
.down-arrow:before,
.down-arrow:after{
    position:absolute;
    display:inline-block;
    content:"";
    border:0.3125rem solid transparent; /* 5px */
}
.buttonProfil .down-arrow:before{
    left:0;
    border-left-color:#ffffff;
}
.buttonProfil .down-arrow:after{
    left:-0.1875rem; /* -3px */
    border-left-color:#2aaf5200;
}

.buttonProfil.active{
    background-color: #0B70B6;
}

.buttonProfil.active .down-arrow{
    top: 0;
}

.buttonProfil.active .down-arrow:before{
    border-left-color: #ffffff00;
    right:0;
    border-right-color:#ffffff;
}
.buttonProfil.active .down-arrow:after{
    border-left-color: #ffffff00;
    right:-0.1875rem; /* -3px */
    border-right-color:#2aaf5200;
}

.clicker{
    text-align: center;
}

.containerProfil{
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
}

.profilMenu{
    display: none;
}

.profilMenu.active{
    display: flex;
    flex-direction: column;
    position: absolute;
    right: 0;
    bottom: 0;
    transform: translateX(100%);
    background-color: #efefef;
    border-radius: 0.3125rem; /* 5px */
    border: 1px solid #333;
    z-index: 99999999999;
    animation: fadeInSlide 0.3s forwards;
}

@keyframes fadeInSlide {
    0% {
        opacity: 0;
        transform: translateX(80%);
    }
    100% {
        opacity: 1;
        transform: translateX(100%);
    }
}

.profilMenu.active a{
    color: #333333;
    padding: 0.25rem 1.25rem; /* 4px 20px */
    margin: 0.3125rem 0; /* 5px */
    font-size: 0.875rem; /* 14px */
    user-select: none;
    text-decoration: none;
}

.profilMenu.active a:hover{
    background-color: #0B70B6;
    color: #efefef;
}

.barSeparation{
    background-color: #616161;
    height: 1px;
    width: 100%;
    margin: 0.3125rem 0; /* 5px */
}

/* ==========================================================================
   2. Styles de l'en-tête mobile (Tabbar)
   ========================================================================== */

.tabbar{ display: none }
.logo_phone{ display: none }
.add_post_phone{ display: none }

@media (max-width: 80rem) and (pointer: coarse) { /* 1280px */
    header{ display: none }

    main {
        margin-bottom: 3.75rem; /* 60px */
    }

    .tabbar {
        display: block;
        border-radius: 0.375rem; /* 6px */
        width: 100dvw;
        background: #fff;
        padding: 0 0.25rem; /* 4px */
        box-shadow: 0 4px 12px -1px rgba(18, 22, 33, 0.08);
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 1000;
    }
    .tabbar a{
        color: #333333;
    }

    .tabbar ul {
        margin: 0;
        padding: 0;
        list-style: none;
        display: flex;
        position: relative;
        z-index: 1;
    }
    .tabbar ul li {
        position: relative;
        flex-grow: 1;
    }
    .tabbar ul li .tabbar_link{
        cursor: pointer;
        position: relative;
        display: flex;
        z-index: 1;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        height: 3.75rem; /* 60px */
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
        text-decoration: none;
    }

    .tabbar ul li .tabbar_link .svg,
    .tabbar ul li .tabbar_link span,
    .tabbar ul li .tabbar_link svg {
        width: 1.25rem; /* 20px */
        height: 1.25rem; /* 20px */
        display: block;
        -webkit-backface-visibility: hidden;
    }

    .tabbar ul li .tabbar_link .svg {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -84%);
    }

    .tabbar ul li .tabbar_link div span {
        width: 1.25rem; /* 20px */
        transform-origin: 50% 50%;
        position: absolute;
        overflow: hidden;
        z-index: 1;
        background: #fff;
        transform: scale(0.94);
        animation: down 0.3s linear forwards;
    }
    .tabbar ul li .tabbar_link div span svg {
        position: absolute;
        left: 0;
        bottom: 0;
    }
    .tabbar ul li .tabbar_link div span:first-child {
        height: 1.25rem; /* 20px */
    }
    .tabbar ul li .tabbar_link div span:first-child svg {
        transition: fill 0.3s ease, stroke 0.3s ease;
        fill: #99A3BA;
        stroke: #99A3BA;
    }
    .tabbar ul li .tabbar_link div span:last-child {
        height: 0;
        z-index: 5;
        transition: height 0.25s ease;
    }
    .tabbar ul li .tabbar_link div span:last-child svg {
        fill: #2AAF52;
        stroke: #2AAF52;
    }

    .tabbar ul li .tabbar_link strong {
        font-size: 0.625rem; /* 10px */
        font-weight: 600;
        margin-top: 1.75rem; /* 28px */
        color: #99A3BA;
        transition: all 0.3s ease;
        position: absolute;
        bottom: 0.3125rem; /* 5px */
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        text-align: center;
    }

    .tabbar ul li .tabbar_link:hover div span:first-child svg {
        fill: #2AAF52;
        stroke: #2AAF52;
    }

    .tabbar ul li.active .tabbar_link {
        z-index: 5;
    }
    .tabbar ul li.active .tabbar_link div span {
        animation: high 0.35s linear forwards 0.05s;
    }
    .tabbar ul li.active .tabbar_link div span:last-child {
        height: 1.25rem; /* 20px */
        transition: height 0.3s ease 0.25s;
    }
    .tabbar ul li.active .tabbar_link strong {
        opacity: 0;
        transform: scale(0.6);
    }

    .tabbar em {
        --offset: 0;
        border-radius: 50%;
        display: block;
        width: 0.375rem; /* 6px */
        height: 0.375rem; /* 6px */
        position: absolute;
        bottom: 0.8125rem; /* 13px */
        left: 0.25rem; /* 4px */
        z-index: 4;
        transition: transform 0.4s ease;
        background: #23C4F8;
        transform: translateX(var(--offset));
    }

    .no-transition {
        transition: none !important;
    }

    /* Keyframes pour les animations de la tabbar */
    @keyframes high {
        0% { transform: rotate(0deg) scale(0.94); }
        33% { transform: rotate(8deg); }
        66% { transform: rotate(8deg) translateY(-1px); }
        100% { transform: rotate(0deg) scale(1) translateY(-1px); }
    }
    @-webkit-keyframes high {
        0% { transform: rotate(0deg) scale(0.94); }
        33% { transform: rotate(8deg); }
        66% { transform: rotate(8deg) translateY(-1px); }
        100% { transform: rotate(0deg) scale(1) translateY(-1px); }
    }

    @keyframes down {
        0% { transform: rotate(0deg) scale(1) translateY(-1px); }
        33% { transform: rotate(8deg); }
        66% { transform: rotate(8deg) translateY(0); }
        100% { transform: rotate(0deg) scale(0.94) translateY(0); }
    }
    @-webkit-keyframes down {
        0% { transform: rotate(0deg) scale(1) translateY(-1px); }
        33% { transform: rotate(8deg); }
        66% { transform: rotate(8deg) translateY(0); }
        100% { transform: rotate(0deg) scale(0.94) translateY(0); }
    }

    .add_post_phone{
        display: block;
    }
}
