/* Layout général */
.aflph-app {
    display: flex;
    /*min-height: 100vh;*/
    /*background: #f9f3f8;*/
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Sidebar */
.aflph-sidebar {
    position: fixed;          /* FIXE à l'écran */
    top: 0;
    left: 0;
    width: 220px;
    height: 92vh;            /* toute la hauteur de la fenêtre */

    background: linear-gradient(180deg, #c70095 0%, #7d005c 100%);
    color: #ffffff;

    display: flex;
    flex-direction: column;

    padding: 6vh 12px 2vh;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.12);
    z-index: 1000;            /* pour passer devant le contenu si besoin */
}

/* Marque */
.aflph-sidebar__brand {
    /* display: flex;*/
    align-items: center;
    margin-bottom: 24px;
    padding: 8px 10px;
    gap: 10px;
}

.aflph-sidebar__logo {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    margin: 0 auto 10px;
}
.aflph-sidebar__logo img {width: 90px; height: auto;}

.aflph-sidebar__brand-text {
    display: flex;
    flex-direction: column;
}

.aflph-sidebar__brand-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    text-align: center;
}

.aflph-sidebar__brand-sub {
    font-size: 11px;
    opacity: 0.8;
    text-align: center;
    color: #fff;
}

/* Nav */
.aflph-sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 24px;
}

.aflph-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    color: #e3f5ff;
    opacity: 0.85;
    transition: background 0.15s ease, opacity 0.15s ease, transform 0.05s ease;
}

.aflph-nav-item__icon {
    width: 22px;
    display: flex;
    justify-content: center;
}

.aflph-nav-item__label {
    flex: 1;
}

/* État actif */
.aflph-nav-item.is-active {
    background: rgba(255, 255, 255, 0.16);
    opacity: 1;
}

.aflph-nav-item:hover {
    background: rgba(255, 255, 255, 0.10);
    opacity: 1;
    transform: translateX(1px);
}

/* Version compacte */
.aflph-nav-item--small {
    font-size: 12px;
    margin-top: 4px;
}

/* Footer sidebar (user + paramètres) */
.aflph-sidebar__footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.aflph-sidebar__user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    border: none;
    background: rgba(255, 255, 255, 0.10);
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.aflph-sidebar__user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.aflph-sidebar__user-infos {
    display: flex;
    flex-direction: column;
}

.aflph-sidebar__user-name {
    font-size: 12px;
    font-weight: 500;
    color: #fff;
}

.aflph-sidebar__user-role {
    font-size: 11px;
    opacity: 0.8;
    color: #fff;
}

/* Zone principale */
.aflph-main {
    flex: 1;
    padding: 0;
    margin-left: 244px;
}

/* Tu peux ajuster ça si ton tableau a déjà sa largeur max */
.aflph-main > *:first-child {
    max-width: 100%;
}

@media (max-width: 900px) {
    .aflph-app {
        flex-direction: column;
    }
    .aflph-sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        padding: 8px 12px;
        position: static;
    }
    .aflph-sidebar__nav {
        flex-direction: row;
        overflow-x: auto;
    }
    .aflph-main {
        padding: 16px;
    }
}

/* Reset des ul de menu */
.aflph-nav,
.aflph-nav-footer {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Éléments de menu principal */
.aflph-nav > li > a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    color: #ffe6f7;
    opacity: 0.85;
    transition: background 0.15s ease, opacity 0.15s ease, transform 0.05s ease;
}
.aflph-nav > li > a > span{color: #ffe6f7;}
/* .aflph-nav > li > a.icon_fa::before {padding-right: 8px; display: inline-block; font-style: normal; font-variant: normal; text-rendering: auto; -webkit-font-smoothing: antialiased; font-family: "Font Awesome 5 Free"; font-weight: 900;}*/
.aflph-nav > li > a::before , .aflph-nav-footer > li > a::before, .aflph-flyout-title > a::before {
    font-family: "Font Awesome 5 Free";
    font-weight: 900; /* Solid */
    display: inline-block;
    width: 22px;
    margin-right: 8px;
    text-align: center;
    font-size: 15px;
}

/* Active (= page actuelle) */
.aflph-nav > li.current-menu-item > a,
.aflph-nav > li.current-page-ancestor > a {
    background: rgba(255, 255, 255, 0.20);
    opacity: 1;
}

.aflph-nav > li > a:hover {
    background: rgba(255, 255, 255, 0.12);
    opacity: 1;
    transform: translateX(1px);
}

/* Menu footer, plus compact */
.aflph-nav-footer > li > a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: #ffe6f7;
    opacity: 0.85;
    text-decoration: none;
}
.aflph-nav-footer > li > a > span {color: #ffe6f7;}

/* Dashboard */
.aflph-nav > li.icon-dashboard > a::before, .aflph-flyout-title.icon-dashboard > a::before {
    content: "\f015"; /* fa-house */
}

/* Projets */
.aflph-nav > li.icon-prod > a::before, .aflph-flyout-title.icon-prod > a::before {
    content: "\f828"; /* fa-bars-progress */
}

/* Devis */
.aflph-nav > li.icon-devis > a::before, .aflph-flyout-title.icon-devis > a::before {
    content: "\f570"; /* fa-file-invoice */
}

/* Clients */
.aflph-nav > li.icon-clients > a::before, .aflph-flyout-title.icon-clients > a::before {
    content: "\f0c0"; /* fa-users */
}

/* Paramètres */
.aflph-nav > li.icon-settings > a::before, .aflph-flyout-title.icon-settings > a::before {
    content: "\f013"; /* fa-gear */
}
/* Déconnexion */
.aflph-nav-footer > li.icon-logout > a::before, .aflph-flyout-title.icon-logout > a::before {
    content: "\f2f5"; /* fa-right-from-bracket */
}

/* ********************** */
/* Réduction largeur menu */

.aflph-sidebar__brand {
    /*display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px; */
    position: relative;
}

.aflph-sidebar__toggle {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: none;
    background:#fff; /* background: rgba(255, 255, 255, 0.14); */
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: -24px;
    top: 36px;
    cursor: pointer;
    padding: 0;
    box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.42);
}
.aflph-sidebar__toggle:hover {background:#c70095;}
.aflph-sidebar__toggle:focus{outline-style: none;}
.aflph-app.aflph-collapsed .aflph-sidebar__toggle {right:-20px;}

.aflph-sidebar__toggle-icon {
    width: 10px;
    height: 10px;
    border-right: 2px solid #c70095;
    border-bottom: 2px solid #c70095;
    transform: rotate(135deg); /* chevron vers la gauche */
    transition: transform 0.3s ease;
    margin-left:5px;
    margin-right:0px;
}
.aflph-app.aflph-collapsed .aflph-sidebar__toggle-icon{margin-left:0; margin-right:5px;}
.aflph-sidebar__toggle:hover .aflph-sidebar__toggle-icon{border-color:#fff;}

/* Quand le menu est réduit, on inverse le chevron */
.aflph-app.aflph-collapsed .aflph-sidebar__toggle-icon {
    transform: rotate(-45deg); /* chevron vers la droite */
}

/* Mode réduit */
.aflph-app.aflph-collapsed .aflph-sidebar {
    width: 64px;
    padding: 6vh 8px 2vh;
}

.aflph-app.aflph-collapsed .aflph-main {
    margin-left: 80px;
}

/* On masque les textes, on garde les icônes */
.aflph-app.aflph-collapsed .aflph-sidebar__brand-text,
.aflph-app.aflph-collapsed .aflph-nav > li > a span,
.aflph-app.aflph-collapsed .aflph-sidebar__user-infos,
.aflph-app.aflph-collapsed .aflph-nav-footer > li > a span {
    display: none;
}

/* On centre les icônes dans la colonne */
.aflph-app.aflph-collapsed .aflph-nav > li > a,
.aflph-app.aflph-collapsed .aflph-nav-footer > li > a {
    justify-content: center;
    margin:0;
}
.aflph-app.aflph-collapsed .aflph-nav > li > a::before, .aflph-app.aflph-collapsed .aflph-nav-footer > li > a::before{margin-right: 0;}

/* Avatar et logo légèrement réduits */
.aflph-app.aflph-collapsed .aflph-sidebar__logo {
    margin: 0 auto;
    width: auto;
    height: auto;
}
.aflph-app.aflph-collapsed .aflph-sidebar__logo img {max-width: 100%; height: auto;}

.aflph-app.aflph-collapsed .aflph-sidebar__user {
    justify-content: center;
    padding-inline: 0;
}


/* Container des sous-menus */
.aflph-nav li.menu-item-has-children > .sub-menu {
    margin-top: 4px;
    margin-left: 24px;
    margin-bottom: 4px;
    padding-left: 10px;
    list-style: none;
    border-left: 1px solid rgba(255, 255, 255, 0.18);
}

/* Liens de sous-menu */
.aflph-nav .sub-menu > li > a {
    font-size: 12px;
    padding: 4px 0;
    color: #ffe6f7;
    opacity: 0.8;
    position: relative;
    text-decoration: none;
    display: block;
}
.aflph-nav .sub-menu > li > a > span {color: #ffe6f7;}

/* Petit bullet au lieu des grosses icônes principales */
.aflph-nav .sub-menu > li > a::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
}

/* Hover sous-menu */
.aflph-nav .sub-menu > li > a:hover {
    opacity: 1;
}

/* Menu réduit : on cache toute la liste des sous-menus */
.aflph-app.aflph-collapsed .aflph-nav li.menu-item-has-children > .sub-menu {
    display: none;
}

/* Sous-menu actif (page courante) */
.aflph-nav .sub-menu > li.current-menu-item > a,
.aflph-nav .sub-menu > li.current_page_item > a {
    color: #ffffff;
    font-weight: 600;
    opacity: 1;
}

/* Bullet du sous-menu actif */
.aflph-nav .sub-menu > li.current-menu-item > a::before,
.aflph-nav .sub-menu > li.current_page_item > a::before {
    background: #ffffff;
}

/* Le parent d'un sous-menu actif est marqué comme "ancestor" par WP */
.aflph-nav li.menu-item-has-children.current-menu-ancestor > a,
.aflph-nav li.menu-item-has-children.current_page_ancestor > a {
    background: rgba(255, 255, 255, 0.20);  /* même style que tes onglets actifs */
    opacity: 1;
}

/* Le span doit être positionné pour accueillir un ::after */
.aflph-nav .sub-menu > li > a .aflph-menu-label {
    position: relative;
    display: inline-block;
}

/* Triangle pour le sous-menu actif */
.aflph-nav .sub-menu > li.current-menu-item > a .aflph-menu-label::after,
.aflph-nav .sub-menu > li.current_page_item > a .aflph-menu-label::after {
    content: "";
    position: absolute;
    top: 50%;
    transform: translateY(-50%);

    /* Collé juste après le texte */
    left: 100%;
    margin-left: 8px; /* distance texte ↔ flèche */

    /* Triangle */
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 6px solid #ffffff;
}

/* Désactiver le tooltip en mode normal */
.aflph-app:not(.aflph-collapsed) .aflph-nav a,
.aflph-app:not(.aflph-collapsed) .aflph-nav-footer a {
    pointer-events: auto;
    position: relative;
}

/* Technique : on masque le title via un pseudo-élément transparent */
.aflph-app:not(.aflph-collapsed) .aflph-nav a[title]::after,
.aflph-app:not(.aflph-collapsed) .aflph-nav-footer a[title]::after {
    content: "";
    position: absolute;
    inset: 0;
}

/* SOUS-MENU EN FLYOUT EN MENU REDUIT */
/* Masquer les sous-menus dans la sidebar réduite */
.aflph-app.aflph-collapsed .aflph-nav li.menu-item-has-children > .sub-menu {
    display: none;
}

/* V3  */
/* --- Structure du flyout --- */
.aflph-flyout {
    margin-top: 0;
    position: fixed;
    left: 80px; /* aligné avec menu réduit */
    background: #ffffff;
    color: #333;
    min-width: 200px;
    padding: 0;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 6px 20px rgba(0,0,0,0.20);
    z-index: 2000;
    display: none;
}

/* --- Titre du flyout (parent cliquable) --- */
.aflph-flyout-title {
    font-size: 14px;
    font-weight: 700;
    padding: 0;
    margin: 0;
    background: #f6d8ee; /* rose clair */
    border-radius: 0 8px 0 0;
}

.aflph-flyout-title a {
    display: block;
    padding: 8px 10px;
    color: #c70095; /* violet ACLPH */
    text-decoration: none;
}

/* --- Container des sous-menus --- */
.aflph-flyout ul {
    list-style: none;
    margin: 4px 0 4px 24px;
    padding: 0px 0 0px 10px; /* indentation générale */
    border-left: 2px solid rgba(199,0,149,0.20); /* trait vertical */
}

/* --- Liens de sous-menu --- */
.aflph-flyout ul li {
    margin: 6px 0;
}

.aflph-flyout ul li a {
    display: block;
    padding: 4px 0;
    font-size: 13px;
    color: #444;
    text-decoration: none;
    position: relative;
}

/* --- Petit bullet avant chaque sous-menu (comme en mode normal) --- */
.aflph-flyout ul li a::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(199,0,149,0.6);
}

/* --- Hover des sous menus --- */
.aflph-flyout ul li a:hover {
    color: #c70095;
}

/* --- Sous-menu actif avec triangle (version flyout) --- */
.aflph-flyout ul li.current-menu-item > a,
.aflph-flyout ul li.current_page_item > a {
    color: #c70095;
    font-weight: 600;
}

.aflph-flyout ul li.current-menu-item > a::after,
.aflph-flyout ul li.current_page_item > a::after {
    content: "";
    display: inline-block;
    margin-left: 8px;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 6px solid #c70095;
}
