/* ===== VARIABLES CSS (DESIGN SYSTEM) =====*/
/* Palette de couleurs, espacements, rayons de bordure et transitions globales */
:root {
    /* Gradient de couleurs principal pour l'interface */
    --primary: #6366f1;
    --secondary: #a855f7;
    --third: #c084fc;
    --accent: #22d3ee;
    
    /* Couleurs de base */
    --bg: #0f172a;
    
    /* Variables de style glassmorphism (effet vitre frosted) */
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --border: 1px solid var(--glass-border);

    /* Couleurs du texte */
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    
    /* Superposition sombre pour les éléments */
    --surface-dark: rgba(0, 0, 0, 0.2);
    
    /* Espacements standardisés */
    --space: 15px;
    --tiny-space: 10px;
    
    /* Rayons de bordure pour différentes profondeurs */
    --box-radius: 12px;
    --radius-md: 16px;
    
    /* Transition globale par défaut */
    --transition-fast: 0.3s;
    
    /* Polices de caractères */
    --font-family-normal: 'Inter', Arial, sans-serif;
    --font-family-select: 'Inter', sans-serif;
    --font-family-code: 'Fira Code', monospace;
}

/* ===== RÉINITIALISATION DES STYLES PAR DÉFAUT =====*/
/* Reset CSS : éliminer les marges et remplissage par défaut du navigateur */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
    font-weight: normal;
    font-size: medium;
}

/* ===== STYLES GLOBAUX DE BASE =====*/
/* Corps de la page : Police, arrière plan, couleur du texte et propriétés de mise en page */
body {
    font-family: var(--font-family-normal);
    background: radial-gradient(circle at top left, #1e1b4b, #0f172a);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: hidden;
    animation: start_logo_body 10s linear forwards;
}

@keyframes start_logo_body {
    100% {
        overflow-y: visible;
    }
}

/* ===== UTILITAIRES =====*/
/* Classe pour masquer des éléments dynamiquement */
.display_none {
    display: none !important;
}

/* ===== ARRIÈRE PLAN ANIMÉ =====*/
/* Élément blob : cercle flou et animé en arrière plan pour créer un effet ambiant */
#blob {
    position: fixed;
    width: 500px;
    height: 500px;
    background: var(--primary);
    filter: blur(120px);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.15;
    animation: move 20s infinite alternate;
}

/* Animation du blob : déplacement continu pour un effet dynamique */
@keyframes move {
    from {
        transform: translate(-10%, -10%);
    }
    to {
        transform: translate(20%, 20%);
    }
}

/* ===== BARRE DE NAVIGATION (NAV) =====*/
/* Barre sticky avec effet glassmorphism : positionnement, arrière plan et disposition flexbox */
nav {
    position: sticky;
    top: 0;
    padding: 10px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    border-bottom: var(--border);
    border-radius: 9999px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

/* Conteneur interne de la nav avec logo et titre */
nav div {
    display: flex;
    align-items: center;
}

/* Titre principal de la nav avec dégradé de couleur */
nav h1 {
    margin-left: 5px;
    font-weight: 800;
    font-size: 1.25rem;
    background: linear-gradient(to right, var(--accent), var(--secondary));
    background-clip: text;
    color: transparent;
}

/* Affichage des valeurs avec police monospace */
#display_values {
    font-family: var(--font-family-code);
}

/* Bouton de paramètres masqué sur desktop, visible en responsive */
#nav_settings, #nav_close_settings {
    display: none;
}

/* Curseur pointeur pour les éléments cliquables */
nav h1, nav svg {
    cursor: pointer;
}

/* Description de la nav avec opacité réduite */
nav p {
    font-size: 0.9rem;
    opacity: 0.5;
}

/* ===== MISE EN PAGE PRINCIPALE =====*/
/* Conteneur principal : disposition en grille avec deux colonnes (toolbox et contenu) */
#container {
    width: 100%;
    margin-top: 20px;
    padding: 0 var(--space);
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: var(--space);
}

/* Conteneurs principaux : arrière plan glassmorphism, bordures et ombres */
#toolbox, #content {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: var(--border);
    border-radius: 24px;
    padding: var(--space);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
#content>h2 {
    margin-bottom: var(--space);
}

#toolbox_titles {
    display: flex;
    justify-content: space-around;
    margin-bottom: calc(var(--space) / 2);
}
#toolbox_titles>div {
    cursor: pointer;
    padding-bottom: calc(var(--space) / 2);
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}
#toolbox_titles>div:nth-last-child(1) {
    border-left: 1px solid var(--glass-border);
}

/* Responsive : sur petit écran, passer à une grille simple avec toolbox en sidebar mobile */
@media (max-width: 900px) {
    #container {
        grid-template-columns: 1fr;
    }

    /* Transformer la toolbox en drawer fixes sur mobile */
    #toolbox {
        position: fixed;
        z-index: 100;
        width: calc(100% - 30px);
        transform: translateX(-100vw);
        transition: transform 0.5s linear;
        height: 87vh;
        overflow: overlay;
    }

    /* Afficher la toolbox quand menu est ouvert */
    #toolbox.container_visible {
        transform: translateX(0);
    }

    /* Afficher le bouton settings en responsive */
    #nav_settings, #nav_close_settings {
        display: block;
    }
}


/* ===== TITRES ET TEXTE =====*/
/* Titres de niveau 2 : marge et poids de police */
h2 {
    font-weight: 700;
    font-size: 1.2rem;
}

/* Affichage des valeurs dans le titre principal */
#display_values {
    font-weight: 700;
    font-size: 1.2rem;
}

/* ===== FORMULAIRES DE LA TOOLBOX =====*/
/* Bloc de formulaire : marge inférieure pour espacement */
.toolbox_bloc {
    margin-bottom: 1.5rem;
}

/* Titre des formulaires : small caps et couleur muted */
#toolbox h3 {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Champs de saisie et sélecteurs : style glassmorphism */
input, select {
    width: 100%;
    background: var(--surface-dark);
    border: var(--border);
    padding: 0.8rem;
    border-radius: var(--box-radius);
    color: white;
    font-family: var(--font-family-code);
    outline: none;
    transition: var(--transition-fast);
}

/* Effet de focus sur les champs */
input:focus, select:focus {
    border-color: var(--accent);
}

/* Boutons des formulaires avec gradient */
button {
    width: 100%;
    padding: 1rem;
    border-radius: var(--box-radius);
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    margin-top: var(--tiny-space);
}

/* Effet hover sur les boutons : translation et ombre */
button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

/* Espacement des sélecteurs dans les formulaires */
form>select {
    margin-top: 7px;
}

/* Changement du style par défaut des sélecteurs */
select, ::picker(select) {
    appearance: base-select;
}

select {
    width: 100%;
    background: var(--surface-dark);
    border: var(--border);
    padding: 0.8rem 1rem;
    border-radius: var(--box-radius);
    color: var(--text);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-family-select);
}

select:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

select::picker-icon {
    color: var(--accent);
    width: 12px;
    margin-left: auto;
    transition: transform var(--transition-fast) ease;
}

select:open::picker-icon {
    transform: rotate(180deg);
}

::picker(select) {
    background: var(--bg);
    border: var(--border);
    border-radius: var(--radius-md);
    padding: 8px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    margin-top: 8px;
}

option {
    padding: 10px 15px;
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
}

option:hover, option:focus {
    background: rgba(34, 211, 238, 0.1);
    color: var(--accent);
}

option:checked {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent);
    font-weight: bold;
}

option::checkmark {
    color: var(--accent);
}

/* SVG - Arbre : Taille et retrait des actions de sélection utilisateur */
#tree_container {
    position: relative;
    height: 425px;
    width: 100%;
}
#tree_container:fullscreen {
    background: radial-gradient(circle at top left, #1e1b4b, #0f172a);
}
#tree {
    width: 100%;
    user-select: none;
    touch-action: none;
    overflow: hidden;
    height: 425px;
}
#tree_container:fullscreen #tree {
    height: 100vh;
}
#tree_buttons {
    display: flex;
    flex-direction: column;
    position: absolute;
    right: 0;
    top: 0;
}
#tree_container:fullscreen #tree_buttons {
    top: 5px;
    right: 5px;
}
#tree_buttons>svg {
    cursor: pointer;
    margin-bottom: 5px;
}
#tree_container:fullscreen #enter_full_screen {
    display: none;
}
#exit_full_screen {
    display: none;
}
#tree_container:fullscreen #exit_full_screen {
    display: block;
}

/* Arbre - Liens entre les nœuds : Couleur et taille */
.svg_link {
    stroke: #f1f5f9;
    stroke-width: 2;
    opacity: 0.2;
}

/* Abre - Nœuds : Couleur, police, taille et épaisseur */
.node_text {
    fill: #f1f5f9;
    font-family: 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: bold;
    text-anchor: middle;
}
.tree_node {
    r: 22;
    fill: var(--bg);
    stroke: var(--accent);
    stroke-width: 3;
}
.tree_node_searched {
    stroke: var(--secondary);
}

/* Conteneur des statistiques : Affichage en grille, espacement et marge haute */
#stats_container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space);
    margin-top: var(--space);
}

/* Cartes de statistiques : Arrière plan, espacement intérieur, bordures et arrondis */
#stats_container>div {
    background: rgba(255,255,255,0.02);
    padding: var(--tiny-space);
    border-radius: var(--radius-md);
    border: var(--border);
}

/* Titres des statistiques : Taille, couleur et transformation en majuscules */
#stats_container h3 {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Valeurs des statistiques : Taille, épaisseur et couleur */
#stats_container p {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
}

/* Bloc du parcours : Marges, espacement intérieur, arrière plan, bordure et police */
#browse_container {
    margin-top: var(--space);
    padding: var(--tiny-space);
    background: #00000044;
    border-radius: var(--box-radius);
    font-family: var(--font-family-code);
    font-size: 0.85rem;
    border-left: 4px solid var(--secondary);
}

/* Mise en évidence du type de parcours : Texte en gras */
strong, #display_browse_type {
    font-weight: bold;
}

/* Liste du parcours affiché : Couleur d'accent */
#display_browse_list {
    color: var(--accent);
}

/* Bas de page : Marges, taille et positionnement */
footer {
    margin-top: var(--tiny-space);
    padding-right: var(--tiny-space);
    width: 100%;
    text-align: right;
}

#start_logo {
    z-index: 10000;
    height: 100vh;
    width: 100%;
    position: fixed;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top left, #1e1b4b, #0f172a);
    animation: start_logo 5s linear forwards;
}

@keyframes start_logo {
    100% {
        display: none;
    }
}

#start_logo>svg {
    width: 60vw;
    height: 60vh;
}

#start_logo>h1 {
    font-weight: 800;
    font-size: 7vw;
    background: linear-gradient(to right, var(--accent), var(--secondary));
    background-clip: text;
    color: transparent;
}