/**
 * Styles pour le bloc "New Pokemon"
 */

.pokehub-new-pokemon-evolutions-block-wrapper {
    margin: 2rem 0;
}

.pokehub-evolution-line {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    position: relative;
}

.pokehub-evolution-pokemon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.32rem;
    width: 176px;
    min-width: 176px;
    max-width: 176px;
    aspect-ratio: 1 / 1;
    padding: 0.82rem 0.86rem 1.28rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.pokehub-evolution-pokemon::after {
    content: '';
    display: block;
    width: 100%;
    height: 0.24rem;
    flex-shrink: 0;
}

.pokehub-evolution-pokemon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.pokehub-evolution-pokemon-types {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    width: 100%;
    margin-bottom: 0.2rem;
    list-style: none;
}

.pokehub-evolution-pokemon-types .pokehub-type-pill {
    --pokehub-type-pill-color: #6b7280;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0;
    max-width: 100%;
    padding: 0.2rem 0.35rem;
    border-radius: 999px;
    background: var(--pokehub-type-pill-color);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    outline: none;
}

/*
 * Renfort (mobile / thèmes / Elementor) : règles du type .entry-content span { background: none }
 * annulent la pastille alors que le libellé peut rester visible → impression de « texte brut » sans rond ni icône.
 */
.pokehub-new-pokemon-evolutions-block-wrapper .pokehub-evolution-pokemon-types > .pokehub-type-pill {
    display: inline-flex !important;
    background: var(--pokehub-type-pill-color, #6b7280) !important;
    background-color: var(--pokehub-type-pill-color, #6b7280) !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff;
    border-radius: 999px !important;
}

.pokehub-new-pokemon-evolutions-block-wrapper .pokehub-evolution-pokemon-types .pokehub-type-pill .pokehub-type-pill-icon {
    display: inline-flex !important;
}

/* Pastille ronde repliée ; 0fr→1fr + max-width (pas d’animation de hauteur = évite le “rebond” à la fermeture) */
.pokehub-evolution-pokemon-types .pokehub-type-pill--evolution-slider {
    box-sizing: border-box;
    --pokehub-type-pill-diameter: 1.5rem;
    --pokehub-type-open-ms: 0.32s;
    /* Courbe type Material : accélération/décélération douce, sans overshoot */
    --pokehub-type-open-ease: cubic-bezier(0.4, 0, 0.2, 1);
    min-width: var(--pokehub-type-pill-diameter);
    max-width: var(--pokehub-type-pill-diameter);
    height: var(--pokehub-type-pill-diameter);
    min-height: var(--pokehub-type-pill-diameter);
    padding: 0;
    /* Toujours flex-start : colonne icône fixe (diamètre) + texte à droite → pas de saut à l’ouverture */
    justify-content: flex-start;
    align-items: center;
    border-radius: 999px;
    overflow: hidden;
    font-size: 0.58rem;
    line-height: 1;
    transition:
        max-width var(--pokehub-type-open-ms) var(--pokehub-type-open-ease),
        padding var(--pokehub-type-open-ms) var(--pokehub-type-open-ease);
}

.pokehub-evolution-pokemon-types .pokehub-type-pill:focus-visible {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 0 0 2px #fff, 0 0 0 4px var(--pokehub-type-pill-color, #6b7280);
}

/* État ouvert (focus clavier) : même hauteur que replié → capsule sur une ligne */
.pokehub-evolution-pokemon-types .pokehub-type-pill--evolution-slider:focus-visible {
    max-width: 6.75rem;
    height: var(--pokehub-type-pill-diameter);
    min-height: var(--pokehub-type-pill-diameter);
    /* Marge uniquement à droite : l’icône garde la même position qu’en replié */
    padding: 0 0.36rem 0 0;
}

/* Piste texte : largeur 0 en replié (sinon le min-content du libellé décale l’icône du centre du rond) */
.pokehub-evolution-pokemon-types .pokehub-type-pill--evolution-slider .pokehub-type-pill-label-track {
    display: grid;
    grid-template-columns: 0fr;
    flex: 0 0 0;
    min-width: 0;
    max-width: 0;
    width: 0;
    margin-left: 0;
    overflow: hidden;
    align-items: center;
    transition:
        grid-template-columns var(--pokehub-type-open-ms) var(--pokehub-type-open-ease),
        max-width var(--pokehub-type-open-ms) var(--pokehub-type-open-ease),
        flex-basis var(--pokehub-type-open-ms) var(--pokehub-type-open-ease),
        margin-left var(--pokehub-type-open-ms) var(--pokehub-type-open-ease);
}

/* Rapproche le texte du glyphe : la colonne icône est au diamètre, le SVG est plus petit et centré */
.pokehub-evolution-pokemon-types .pokehub-type-pill--evolution-slider:focus-visible .pokehub-type-pill-label-track {
    flex: 1 1 auto;
    width: auto;
    max-width: 6rem;
    margin-left: -0.2rem;
    grid-template-columns: 1fr;
}

.pokehub-evolution-pokemon-types .pokehub-type-pill .pokehub-type-pill-icon {
    flex-shrink: 0;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

.pokehub-evolution-pokemon-types .pokehub-type-pill--evolution-slider > .pokehub-type-pill-icon {
    box-sizing: border-box;
    flex: 0 0 var(--pokehub-type-pill-diameter);
    width: var(--pokehub-type-pill-diameter);
    min-width: var(--pokehub-type-pill-diameter);
    max-width: var(--pokehub-type-pill-diameter);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    line-height: 0;
    align-self: center;
}

.pokehub-evolution-pokemon-types .pokehub-type-pill .pokehub-type-pill-icon svg {
    width: 14px;
    height: 14px;
}

.pokehub-evolution-pokemon-types .pokehub-type-pill--evolution-slider .pokehub-type-pill-icon svg {
    width: 12px;
    height: 12px;
}

.pokehub-evolution-pokemon-types .pokehub-type-pill--evolution-slider .pokehub-type-pill-label {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    min-width: 0;
    padding-left: 0.04rem;
    opacity: 0;
    transform: translate3d(-0.06rem, 0, 0);
    transition:
        opacity var(--pokehub-type-open-ms) var(--pokehub-type-open-ease),
        transform var(--pokehub-type-open-ms) var(--pokehub-type-open-ease);
}

.pokehub-evolution-pokemon-types .pokehub-type-pill--evolution-slider:focus-visible .pokehub-type-pill-label {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

@media (hover: hover) and (pointer: fine) {
    .pokehub-evolution-pokemon-types .pokehub-type-pill--evolution-slider:hover {
        max-width: 6.75rem;
        height: var(--pokehub-type-pill-diameter);
        min-height: var(--pokehub-type-pill-diameter);
        padding: 0 0.36rem 0 0;
    }

    .pokehub-evolution-pokemon-types .pokehub-type-pill--evolution-slider:hover .pokehub-type-pill-label-track {
        flex: 1 1 auto;
        width: auto;
        max-width: 6rem;
        margin-left: -0.2rem;
        grid-template-columns: 1fr;
    }

    .pokehub-evolution-pokemon-types .pokehub-type-pill--evolution-slider:hover .pokehub-type-pill-label {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/*
 * Tactile : pas de survol fiable — sans règle dédiée, la pastille reste repliée (icône seule)
 * et le libellé peut sembler absent ou mal intégré. On affiche toujours la capsule complète.
 */
@media (hover: none), (pointer: coarse) {
    .pokehub-evolution-pokemon-types .pokehub-type-pill--evolution-slider {
        max-width: min(7.5rem, 100%);
        width: max-content;
        height: auto;
        min-height: var(--pokehub-type-pill-diameter);
        padding: 0.18rem 0.42rem 0.18rem 0.12rem;
    }

    .pokehub-evolution-pokemon-types .pokehub-type-pill--evolution-slider .pokehub-type-pill-label-track {
        flex: 1 1 auto;
        width: auto;
        max-width: 6.25rem;
        min-width: 0;
        margin-left: -0.12rem;
        grid-template-columns: 1fr;
    }

    .pokehub-evolution-pokemon-types .pokehub-type-pill--evolution-slider .pokehub-type-pill-label {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.pokehub-evolution-pokemon-image {
    width: 88px;
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
    flex-shrink: 0;
    align-self: center;
}

.pokehub-evolution-pokemon-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.pokehub-evolution-pokemon-name {
    font-weight: 600;
    font-size: 0.82rem;
    text-align: center;
    color: #333;
    word-break: break-word;
    width: 100%;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    margin-top: auto;
    margin-bottom: 0;
    min-height: calc(1.2em * 2 + 0.18rem);
    padding-bottom: 0.22rem;
}

.pokehub-evolution-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    min-width: 80px;
    max-width: 80px;
    color: #666;
    position: relative;
    flex-shrink: 0;
}

.pokehub-evolution-arrow svg {
    width: 40px;
    height: 20px;
    flex-shrink: 0;
}

.pokehub-evolution-conditions {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    text-align: center;
    color: #555;
    max-width: 150px;
    line-height: 1.3;
    padding: 0.25rem 0.5rem;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #ddd;
    white-space: normal;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.pokehub-evolution-conditions-text {
    display: block;
    font-size: inherit;
    line-height: 1.35;
    color: inherit;
}

/* Responsive */
@media (max-width: 768px) {
    .pokehub-evolution-line {
        flex-direction: column;
        align-items: center;
    }
    
    .pokehub-evolution-arrow {
        transform: rotate(90deg);
        margin: 0.5rem 0;
    }
    
    .pokehub-evolution-arrow svg {
        width: 20px;
        height: 40px;
    }
    
    .pokehub-evolution-conditions {
        transform: rotate(-90deg);
        max-width: 200px;
    }
}

/* Style pour les nœuds d'évolution */
.pokehub-evolution-node {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    position: relative;
    flex-shrink: 0;
}

/* Si le nœud a des branches, on garde la ligne horizontale mais on prépare l'espace pour les branches */
.pokehub-evolution-node.has-branches {
    flex-direction: column;
    align-items: center;
    position: relative;
    flex-wrap: nowrap;
    width: 100%;
}

/* Style pour les branches d'évolution (si plusieurs évolutions depuis un même Pokémon) */
.pokehub-evolution-branches {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 2rem;
    position: relative;
    margin-left: 0;
    margin-top: 0;
    padding-top: 3rem;
    padding-left: 0;
    width: 100%;
    min-height: 250px;
}

/* Ligne verticale qui descend depuis le Pokémon de base (centrée) */
.pokehub-evolution-branches::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 2.5rem;
    background: #ddd;
    z-index: 0;
    transform: translateX(-50%);
}

.pokehub-evolution-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    position: relative;
    flex: 0 0 auto;
    width: 140px;
    min-width: 140px;
    max-width: 140px;
    padding-top: 4rem;
}

/* Ligne diagonale depuis le point central vers la condition d'évolution */
.pokehub-evolution-branch::before {
    content: '';
    position: absolute;
    width: 2px;
    background: #ddd;
    z-index: 0;
}

/* Ligne verticale depuis la condition vers le Pokémon évolué */
.pokehub-evolution-branch::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 2rem;
    background: #ddd;
    z-index: 0;
    transform: translateX(-50%);
}

/* Flèche diagonale vers la gauche pour la première branche - part depuis le centre du conteneur */
.pokehub-evolution-branch.branch-first::before {
    left: calc(50% - 70px);
    top: -4rem;
    height: 4rem;
    transform: rotate(-45deg);
    transform-origin: top left;
}

/* Flèche diagonale vers la droite pour la dernière branche - part depuis le centre du conteneur */
.pokehub-evolution-branch.branch-last::before {
    left: calc(50% + 70px);
    top: -4rem;
    height: 4rem;
    transform: rotate(45deg);
    transform-origin: top right;
}

/* Flèche horizontale pour les branches du milieu */
.pokehub-evolution-branch.branch-middle::before {
    left: 50%;
    top: -3.5rem;
    height: 3.5rem;
    transform: translateX(-50%);
}

/* Conditions d'évolution pour les branches - positionnées au bout de la ligne diagonale */
.pokehub-evolution-branch-conditions {
    position: absolute;
    left: 50%;
    top: -1.5rem;
    transform: translateX(-50%);
    width: auto;
    min-width: 100px;
    max-width: 140px;
    font-size: 0.75rem;
    text-align: center;
    color: #555;
    white-space: normal;
    padding: 0.5rem 0.75rem;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #ddd;
    z-index: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

/* Ajuster la position des conditions selon la branche - au bout de la ligne diagonale */
.pokehub-evolution-branch.branch-first .pokehub-evolution-branch-conditions {
    left: 0;
    top: -1.5rem;
    transform: translateX(-50%);
}

.pokehub-evolution-branch.branch-last .pokehub-evolution-branch-conditions {
    left: 100%;
    top: -1.5rem;
    transform: translateX(-50%);
}

/* Flèche SVG pour les branches (remplace les lignes CSS) */
.pokehub-evolution-branch .pokehub-evolution-arrow {
    position: relative;
    margin-top: 0.5rem;
}

.pokehub-evolution-branch .pokehub-evolution-arrow svg {
    transform: rotate(0deg);
}

