/* Filtres et tri des profils de personnage, communs à la page Cartes de profil et au mode « profils » du catalogue
 * (onglets de version, barre de filtres, caractéristiques avec icônes, boutons de tri). */

/* ===== Switch officiel / équilibré ===== */

.profil-version-switch {
    display: flex;
    gap: 6px;
    width: min(100%, 600px);
    margin: 0 auto 16px;
    background: linear-gradient(180deg, var(--brun-cuir) 0%, var(--brun-nuit) 100%);
    border: 1px solid var(--or-terne);
    border-radius: 12px;
    padding: 6px;
    box-shadow:
        0 4px 0 rgba(75, 48, 30, 0.16),
        0 8px 18px rgba(75, 48, 30, 0.14);
}

.profil-version-tab {
    flex: 1 1 0;
    font-family: 'Grandstander', cursive;
    font-size: 16px;
    font-weight: 700;
    padding: 11px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--or-clair);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

.profil-version-statuses {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.profil-version-status {
    padding: 2px 6px;
    border: 1px solid currentColor;
    border-radius: 4px;
    font-family: 'Nunito', sans-serif;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
}

.profil-version-status--wip {
    color: #ffd980;
    background: rgba(120, 75, 20, 0.45);
}

.profil-version-status--beta {
    color: #b8e7ff;
    background: rgba(21, 75, 105, 0.45);
}

.profil-version-tab:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.12);
}

.profil-version-tab.is-active {
    background: var(--or);
    border-color: var(--or-clair);
    color: var(--brun-nuit);
    box-shadow:
        0 3px 0 var(--or-terne),
        0 5px 10px rgba(0, 0, 0, 0.22);
    transform: translateY(-1px);
}

.profil-version-tab:focus-visible {
    outline: 3px solid var(--or-clair);
    outline-offset: 2px;
}

/* ===== Filtres ===== */

.profil-filter-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr)) 150px 150px minmax(180px, 1fr) 38px;
    align-items: end;
    gap: 10px;
    width: 100%;
    margin: 0 0 24px;
    padding: 18px 20px;
    background: linear-gradient(180deg, var(--brun-cuir) 0%, var(--brun-nuit) 100%);
    border: 1px solid var(--or-terne);
    border-radius: 10px;
}

.profil-filter-bar .filter-field {
    min-width: 0;
    gap: 5px;
}

.profil-filter-bar .filter-field--range {
    max-width: 150px;
}

.profil-filter-bar .filter-field label {
    font-family: 'Grandstander', cursive;
    font-size: 11px;
    color: var(--or-clair);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profil-filter-bar .filter-field select,
.profil-filter-bar .filter-field input {
    width: 100%;
    min-width: 0;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    padding: 9px 12px;
    border-radius: 6px;
    border: 1px solid var(--or-terne);
    background: var(--beige);
    color: var(--encre);
}

.profil-filter-bar .filter-field select:focus,
.profil-filter-bar .filter-field input:focus {
    outline: none;
    border-color: var(--or-clair);
    box-shadow: 0 0 0 2px rgba(255, 215, 128, 0.2);
}

.profil-filter-bar .filter-field--range .filter-range {
    min-width: 0;
}

.profil-filter-bar .filter-field--range .filter-range input {
    flex: 1 1 0;
    width: auto;
}

@media (max-width: 1250px) {
    .profil-filter-bar {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

.profil-filter-reset {
    align-self: end;
    justify-self: end;
    width: 38px;
    height: 38px;
    padding: 8px;
    border: 1px solid var(--or-terne);
    border-radius: 6px;
    background: var(--beige);
    color: var(--brun-cuir);
    cursor: pointer;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
}

.profil-filter-reset svg {
    width: 100%;
    height: 100%;
}

.profil-filter-reset:hover,
.profil-filter-reset:focus-visible {
    border-color: var(--or);
    background: var(--or-clair);
    color: var(--brun-nuit);
}

.profil-filter-reset:focus-visible {
    outline: 2px solid var(--brun-nuit);
    outline-offset: 2px;
}

/* ===== Caractéristiques (icônes) ===== */

.profil-card-stats {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.profil-card-stat {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.profil-card-stat--initiative {
    position: absolute;
    top: 4px;
    left: 0;
    width: 40px;
    height: 40px;
}

.profil-card-stat--niveau {
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    height: 44px;
}

.profil-card-stat--pm,
.profil-card-stat--pv,
.profil-card-stat--pa {
    position: absolute;
    bottom: 6px;
}

.profil-card-stat--pm {
    left: calc(50% - 58px);
}

.profil-card-stat--pv {
    left: calc(50% - 18px);
}

.profil-card-stat--pa {
    right: calc(50% - 58px);
}

.profil-card-stat img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.profil-card-stat strong {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-family: 'Helvetica Neue Bold', sans-serif;
    font-size: 14px;
    line-height: 1;
    text-shadow:
        0 0px 3px var(--brun-nuit),
        0 0 3px var(--brun-nuit),
        0 0 3px var(--brun-nuit),
        0 0 3px var(--brun-nuit);
}

.profil-card-stat--initiative strong,
.profil-card-stat--niveau strong {
    font-size: 16px;
}

/* ===== Plages et tri ===== */

.filter-field--range .filter-range {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-field--range .filter-range input {
    min-width: 68px;
    width: 68px;
}

.filter-field--range .filter-range span {
    color: var(--or-clair);
}

.profil-sort {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.profil-sort-label {
    margin-right: 2px;
    color: var(--brun-cuir);
    font-family: 'Grandstander', cursive;
    font-size: 13px;
    font-weight: 700;
}

.profil-sort-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 36px;
    padding: 5px;
    border: 1px solid var(--or-terne);
    border-radius: 6px;
    background: var(--beige);
    color: var(--brun-cuir);
    cursor: pointer;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
}

.profil-sort-button img {
    width: 23px;
    height: 23px;
    object-fit: contain;
}

.profil-sort-default-icon {
    width: 23px;
    height: 23px;
}

.profil-sort-symbol {
    width: 23px;
    height: 23px;
}

.profil-sort-direction {
    width: 12px;
    height: 12px;
    margin-left: -5px;
    border-radius: 50%;
    background: var(--beige);
}

.profil-sort-direction.is-ascending {
    transform: rotate(180deg);
}

.profil-sort-button:hover,
.profil-sort-button:focus-visible,
.profil-sort-button.is-active {
    border-color: var(--or);
    background: var(--or-clair);
    color: var(--brun-nuit);
}

.profil-sort-button:focus-visible {
    outline: 2px solid var(--brun-nuit);
    outline-offset: 2px;
}

@media (max-width: 700px) {
    .profil-sort {
        width: 100%;
        margin-left: 0;
    }

    .profil-sort-button {
        flex: 1 1 0;
    }
}
