@font-face {
    font-family: 'Helvetica Neue Bold';
    src: url('../../fonts/HelveticaNeueBold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

.cartes-profil-page h1 {
    text-align: center;
}

.cartes-profil-page {
    position: relative;
}

.cartes-profil-help {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    position: absolute;
    top: 0;
    right: 0;
    padding: 8px 12px;
    border: 1px solid var(--or-terne);
    border-radius: 20px;
    background: var(--beige);
    color: var(--brun-cuir);
    font-family: 'Nunito', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 2px 0 rgba(75, 48, 30, 0.12);
    transition:
        background 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}

.cartes-profil-help svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.cartes-profil-help:hover,
.cartes-profil-help:focus-visible {
    background: var(--or);
    color: var(--brun-nuit);
    transform: translateY(-1px);
}

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

.cartes-profil-intro {
    max-width: 980px;
    margin: 0.5rem auto 1.5rem;
    text-align: center;
    color: var(--brun-cuir);
    font-size: 0.95rem;
    line-height: 1.6;
}

.cartes-profil-intro p {
    margin: 0;
}

.cartes-profil-intro p + p {
    margin-top: 0.55rem;
}

.cartes-profil-intro-order {
    margin-top: 0.8rem !important;
    padding: 0.7rem 1rem;
    border: 1px solid rgba(137, 91, 48, 0.2);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.3);
}

.cartes-profil-intro-order a {
    font-weight: 700;
}

/* ===== 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-tab-sub {
    font-family: 'Nunito', sans-serif;
    font-size: 11px;
    opacity: 0.85;
}

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

.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;
}

.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;
}

.profil-card-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: auto;
    padding-right: 6px;
}

.profil-card-actions .article-card-eye,
.profil-card-actions .profil-card-open-tab,
.profil-card-actions .profil-select-toggle {
    position: static;
    flex: 0 0 auto;
}

.profil-card-actions .article-card-eye {
    opacity: 0.75;
    color: var(--brun-nuit);
}

.profil-card-traits {
    margin: 0;
    color: var(--brun-cuir);
    font-size: 0.82rem;
    line-height: 1.35;
}

/* ===== Layout principal + aside sélection ===== */

.cartes-profil-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 24px;
    align-items: start;
}

.cartes-profil-main {
    grid-column: 1;
    grid-row: 1 / span 2;
}

.cartes-profil-page:not(.profil-selection-mode-active) .cartes-profil-layout {
    grid-template-columns: 1fr;
}

.cartes-profil-page:not(.profil-selection-mode-active) .profil-select-toggle {
    display: none;
}

.cartes-profil-main {
    min-width: 0;
}

#cartes-profil-infos {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}

#cartes-profil-count {
    font-family: 'Nunito', sans-serif;
    color: var(--brun-nuit);
    font-weight: 700;
}

#profil-selection-enable {
    margin-left: auto;
    padding: 9px 15px;
    background: var(--or);
    border: 2px solid var(--or-clair);
    border-radius: 6px;
    color: var(--brun-nuit);
    font-family: 'Grandstander', cursive;
    font-size: 14px;
    font-weight: 700;
    box-shadow:
        0 3px 0 var(--or-terne),
        0 5px 12px rgba(0, 0, 0, 0.2);
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

#profil-selection-enable:hover,
#profil-selection-enable:focus-visible {
    background: var(--or-clair);
    border-color: var(--or);
    color: var(--brun-nuit);
    box-shadow:
        0 2px 0 var(--or-terne),
        0 7px 14px rgba(0, 0, 0, 0.24);
    transform: translateY(-1px);
}

.profil-selection-mode-active #profil-selection-enable {
    display: none;
}

.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;
    }
}

/* ===== Badge recto/verso ===== */

.profil-face-badge {
    position: absolute;
    top: 4px;
    left: 34px;
    z-index: 2;
    background: var(--brun-nuit);
    color: var(--or-clair);
    font-family: 'Grandstander', cursive;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 4px;
}

.profil-status-badge {
    display: inline-block;
    padding: 3px 6px;
    border: 1px solid currentColor;
    border-radius: 4px;
    font-family: 'Nunito', sans-serif;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
}

.profil-card .profil-status-badge {
    align-self: flex-start;
    width: fit-content;
    margin-top: 8px;
}

.profil-status-badge--wip {
    background: rgba(120, 75, 20, 0.9);
    color: #ffe09a;
}

.profil-status-badge--beta {
    background: rgba(21, 75, 105, 0.9);
    color: #c4ecff;
}

.profil-modal-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 12px auto 0;
    color: var(--brun-cuir);
    font-size: 12px;
    text-align: center;
}

.profil-face-link {
    align-self: center;
    color: var(--brun-cuir);
    font-size: 11px;
    font-weight: 600;
    text-decoration: underline;
    white-space: nowrap;
}

.profil-face-link:hover {
    color: #fff;
}

#profil-modal .profil-face-link {
    display: block;
    width: fit-content;
    margin: 12px auto 0;
}

.profil-modal-selection-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 14px auto 0;
    padding: 7px 12px;
    border: 1px solid #287a43;
    border-radius: 5px;
    background: #287a43;
    color: #fff;
    font-family: 'Grandstander', cursive;
    font-size: 12px;
}

.profil-modal-selection-toggle:hover,
.profil-modal-selection-toggle:focus-visible {
    background: #1f6336;
    border-color: #1f6336;
}

.profil-modal-selection-toggle.is-active {
    border-color: #b53a3a;
    background: #b53a3a;
}

.profil-modal-selection-toggle.is-active:hover,
.profil-modal-selection-toggle.is-active:focus-visible {
    border-color: #922d2d;
    background: #922d2d;
}

.profil-modal-selection-icon {
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

/* ===== Boutons spécifiques carte profil ===== */

.profil-card-open-tab {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    color: var(--brun-nuit);
    opacity: 0.75;
    transition:
        background 0.2s ease,
        opacity 0.2s ease;
}

.profil-card-open-tab:hover {
    opacity: 1;
    background: #fff;
}

.profil-select-toggle {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 2;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.85);
    color: var(--brun-cuir);
    font-size: 18px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.15s ease;
}

.profil-select-toggle:hover {
    background: #fff;
    transform: scale(1.08);
}

.profil-select-toggle.is-active {
    background: var(--or);
    color: var(--brun-nuit);
}

/* ===== Aside sélection PDF ===== */

.profil-selection-aside {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: 16px;
    background: var(--beige);
    border: 2px solid var(--or);
    border-radius: 12px;
    padding: 16px;
    box-shadow:
        0 4px 0 var(--beige-fonce),
        0 6px 14px rgba(0, 0, 0, 0.12);
}

.profil-selection-aside h2 {
    font-family: 'Grandstander', cursive;
    font-size: 16px;
    color: var(--brun-nuit);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.profil-selection-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.profil-selection-clear,
.profil-selection-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--brun-cuir);
    cursor: pointer;
}

.profil-selection-clear:hover,
.profil-selection-clear:focus-visible {
    background: var(--beige-fonce);
    color: var(--rouille);
}

.profil-selection-close {
    font-size: 22px;
    line-height: 1;
}

.profil-selection-close:hover,
.profil-selection-close:focus-visible {
    background: var(--beige-fonce);
    color: var(--brun-nuit);
}

#profil-selection-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--or);
    color: var(--brun-nuit);
    font-size: 12px;
    font-weight: 700;
}

.profil-selection-empty {
    font-size: 13px;
    color: var(--brun-cuir);
    font-style: italic;
    margin: 0 0 12px;
}

#profil-selection-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 360px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.profil-selection-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--beige-fonce);
    border-radius: 8px;
    padding: 6px 8px;
}

.profil-selection-item img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex: 0 0 auto;
}

.profil-selection-item-name {
    flex: 1;
    font-size: 12.5px;
    color: var(--brun-nuit);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profil-selection-item-details {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    gap: 1px;
}

.profil-selection-item-version {
    overflow: hidden;
    color: var(--brun-nuit);
    font-size: 10px;
    opacity: 0.7;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profil-selection-face-badge {
    flex: 0 0 auto;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--brun-nuit);
    color: var(--or-clair);
    font-family: 'Grandstander', cursive;
    font-size: 10px;
    text-transform: uppercase;
}

.profil-selection-remove {
    flex: 0 0 auto;
    background: none;
    border: none;
    font-size: 16px;
    line-height: 1;
    color: var(--brun-cuir);
    cursor: pointer;
    padding: 2px 4px;
}

.profil-selection-remove:hover {
    color: #e63946;
}

#profil-generate-pdf {
    width: 100%;
    background: var(--rouille);
    border-color: var(--rouille);
    color: var(--beige-clair);
}

#profil-generate-pdf:hover,
#profil-generate-pdf:focus-visible {
    background: var(--brun-cuir-clair);
    border-color: var(--brun-cuir-clair);
    color: var(--white);
}

/* ===== Modale carte HD ===== */

.profil-modal-viewer {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.profil-modal-image {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    margin: 0 auto;
    border-radius: 8px;
}

.profil-modal-navigation {
    display: flex;
    flex: 0 0 36px;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 52px;
    padding: 0;
    border: 1px solid var(--brun-nuit);
    border-radius: 4px;
    background: transparent;
    color: var(--brun-nuit);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.profil-modal-navigation:hover,
.profil-modal-navigation:focus-visible {
    background: var(--brun-nuit);
    color: var(--beige-clair);
}

.profil-modal-navigation:disabled {
    border-color: #b8b0a5;
    color: #b8b0a5;
    cursor: default;
    opacity: 0.55;
}

@media (max-width: 500px) {
    .profil-modal-viewer {
        gap: 6px;
    }

    .profil-modal-navigation {
        flex-basis: 30px;
        width: 30px;
        height: 44px;
        font-size: 22px;
    }

    .cartes-profil-help {
        position: static;
        display: flex;
        width: fit-content;
        margin: 0 auto 12px;
    }
}

/* ===== Responsive ===== */

@media (max-width: 900px) {
    .cartes-profil-layout {
        grid-template-columns: 1fr;
    }

    .cartes-profil-main,
    .profil-selection-aside {
        grid-column: 1;
        grid-row: auto;
    }

    .profil-selection-aside {
        position: static;
    }
}
