/* ============================================================
   UserPreferenceCharts — styles partagés (donuts CSS purs)
   Utilisé par la page profil (onglet Top/Bar) ET les pages
   publiques (top10/bar/wishlist/favorites). Chargé globalement
   via _Host.cshtml pour être dispo partout où le composant rend.
   Base = sombre ; surcharges [data-theme="light"] en bas.
   ============================================================ */

.up-pref-card {
    background: linear-gradient(165deg, rgba(188,112,164,.12), rgba(18,17,26,.55));
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 16px;
    padding: 14px 16px 16px;
}

.up-pref-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.up-pref-card__title {
    font-weight: 850;
    font-size: 1.05rem;
    color: rgba(255,255,255,.95);
}

.up-pref-card__subtitle {
    font-size: .82rem;
    margin-top: 2px;
}

.up-pref-card__badge {
    font-size: .75rem;
    font-weight: 750;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    color: rgba(255,255,255,.82);
    white-space: nowrap;
}

/* Grille adaptative : évite de comprimer les légendes sur les cartes étroites. */
.up-pref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
}

@media (max-width: 1050px) {
    .up-pref-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (max-width: 680px) {
    .up-pref-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.up-pref-chart {
    background: rgba(0,0,0,.18);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px;
    padding: 10px 12px 12px;
    min-width: 0;
}

.up-pref-chart--empty {
    min-height: 120px;
}

.up-pref-chart__heading {
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: rgba(255,255,255,.72);
    margin-bottom: 8px;
}

.up-pref-chart__body {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.up-pref-donut {
    flex: 0 0 148px;
    width: 148px;
    height: 148px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
    -webkit-mask: radial-gradient(farthest-side, transparent 56%, #000 57%);
    mask: radial-gradient(farthest-side, transparent 56%, #000 57%);
}

.up-pref-legend {
    flex: 1;
    list-style: none;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.up-pref-legend--scroll {
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.up-pref-legend__row {
    display: grid;
    grid-template-columns: 12px 1fr auto;
    gap: 10px;
    align-items: start;
    font-size: .88rem;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
    cursor: help;
}

.up-pref-legend__row:hover {
    background: rgba(255,255,255,.04);
}

.up-pref-legend__row:last-child {
    border-bottom: none;
}

.up-pref-legend__swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-top: 5px;
    box-shadow: 0 0 0 1px rgba(0,0,0,.25);
}

.up-pref-legend__label {
    color: rgba(255,255,255,.9);
    min-width: 0;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    line-height: 1.35;
    hyphens: auto;
}

.up-pref-legend__pct {
    font-variant-numeric: tabular-nums;
    color: rgba(255,255,255,.55);
    font-size: .82rem;
    white-space: nowrap;
    align-self: start;
    padding-top: 2px;
}

@media (max-width: 520px) {
    .up-pref-chart__body {
        flex-direction: column;
        align-items: center;
    }

    .up-pref-legend {
        width: 100%;
    }

    .up-pref-donut {
        flex-basis: 140px;
        width: 140px;
        height: 140px;
    }
}

/* ====================== THÈME CLAIR ====================== */
[data-theme="light"] .up-pref-card {
    background: linear-gradient(165deg, rgba(188,112,164,.10), rgba(191,214,65,.06));
    border-color: rgba(20,18,28,.10);
}

[data-theme="light"] .up-pref-card__title {
    color: rgba(20,18,28,.90);
}

[data-theme="light"] .up-pref-card__badge {
    background: rgba(20,18,28,.06);
    border-color: rgba(20,18,28,.12);
    color: rgba(20,18,28,.75);
}

[data-theme="light"] .up-pref-chart {
    background: #ffffff;
    border-color: rgba(20,18,28,.08);
    box-shadow: 0 6px 18px rgba(60,50,80,.06);
}

[data-theme="light"] .up-pref-chart__heading {
    color: rgba(20,18,28,.65);
}

[data-theme="light"] .up-pref-donut {
    box-shadow: inset 0 0 0 1px rgba(20,18,28,.10);
}

[data-theme="light"] .up-pref-legend__label {
    color: rgba(20,18,28,.85);
}

[data-theme="light"] .up-pref-legend__pct {
    color: rgba(20,18,28,.50);
}

[data-theme="light"] .up-pref-legend__row {
    border-bottom-color: rgba(20,18,28,.08);
}

[data-theme="light"] .up-pref-legend__row:hover {
    background: rgba(20,18,28,.04);
}

[data-theme="light"] .up-pref-legend__swatch {
    box-shadow: 0 0 0 1px rgba(20,18,28,.18);
}
