/* UN Ambassador — Dashboard styles
 *
 * Rule of thumb: custom CSS is reserved for creative, bespoke components
 * (medallions, progress bar, wallet/history card layouts, CSS-only tabs,
 * pills, modal). Everything that is just text (headings, paragraphs,
 * <small>, <strong>, lists, tables) inherits from the active theme so
 * font, color and spacing changes propagate automatically.
 *
 * If you catch yourself writing `font-size`, `color`, or `font-weight`
 * on plain text: stop. Use semantic HTML and let the theme do its job.
 */

:root {
	--un-accent:        var(--un-rose);
	--un-accent-deep:   var(--un-rose-deep);
	--un-accent-soft:   var(--un-rose-bg);
	--un-gold:          var(--un-rose-mid);
	--un-gold-light:    var(--un-rose-light);
	--un-section-border: var(--un-border);
}

/* -------------------------------------------------------------------------
 * Dashboard shell — just grouping, no typography.
 * ---------------------------------------------------------------------- */
.un-ambassador-dashboard {
	max-width: 860px;
	margin: 0 auto;
}

/* Theme styles button.button as black bg + white text, but a.button inherits
 * link color (black) → invisible "black on black" text. Force white text on
 * any .button inside the ambassador dashboard scope. */
.un-ambassador-dashboard a.button,
.un-ambassador-dashboard .button {
	color: var(--un-white);
}
.un-ambassador-dashboard a.button:hover,
.un-ambassador-dashboard .button:hover {
	color: var(--un-white);
	opacity: 0.9;
}
.un-ambassador-dashboard > section {
	margin-bottom: 1.4em;
	padding: 1.8em 2em;
	background: var(--un-white);
	border: 1px solid var(--un-section-border);
	border-radius: var(--un-radius);
}

/* -------------------------------------------------------------------------
 * Hero — bespoke layout merging tier + progression.
 * Only LAYOUT here, no typography overrides.
 * ---------------------------------------------------------------------- */
.un-hero__alert {
	display: flex;
	align-items: center;
	gap: 0.6em;
	padding: 0.7em 1em;
	margin-bottom: 1.2em;
	background: var(--un-warning-bg);
	border-left: 3px solid var(--un-warning);
	border-radius: var(--un-radius);
}

.un-hero__header {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1em;
	margin-bottom: 1.6em;
	padding-bottom: 1em;
	border-bottom: 1px solid var(--un-section-border);
	flex-wrap: wrap;
}
.un-hero__header h2 { margin: 0; }
.un-hero__header p { margin: 0; }

.un-hero__body {
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: 2em;
	align-items: center;
}
@media (max-width: 640px) {
	.un-hero__body {
		grid-template-columns: 1fr;
		gap: 1.4em;
		justify-items: center;
		text-align: center;
	}
}

/* Current / next tier pillar (medallion + label + name, stacked) */
.un-hero__pillar {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.6em;
	text-align: center;
	min-width: 110px;
}
.un-hero__pillar p { margin: 0; line-height: 1.4; }

/* Progress column */
.un-hero__progress { min-width: 0; }
.un-hero__progress p { margin: 0.8em 0 0; }

.un-hero__stats {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	gap: 1em;
	margin-bottom: 0.8em;
}
.un-hero__stat small { display: block; }
.un-hero__stat--target { text-align: right; }

/* Bespoke progress bar */
.un-hero__bar {
	height: 8px;
	background: var(--un-accent-soft);
	border-radius: var(--un-radius);
	overflow: hidden;
}
.un-hero__bar-fill {
	height: 100%;
	background: var(--un-accent);
	border-radius: var(--un-radius);
	transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* -------------------------------------------------------------------------
 * Medallions — flat typographic tier badges (creative, custom).
 * ---------------------------------------------------------------------- */
.un-medallion {
	width: 108px;
	height: 108px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
/* The webp rank icon carries the tier's colour + shape; the container just
 * sizes it. The per-tier `--slug` modifier stays in the markup but needs no
 * styling now (kept for potential per-tier tweaks / JS hooks). */
.un-medallion__img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}
/* Next-tier preview uses the greyed "-locked" webp variant; a touch of extra
 * transparency reinforces the "not yet unlocked" read. */
.un-medallion--ghost .un-medallion__img { opacity: 0.9; }

/* Suspended tier: the markup already asks for the "-locked" art, so the
 * grayscale filter is normally a no-op — it is the safety net for the two tiers
 * that ship no locked variant (Partner, Staff), which fall back to the coloured
 * file. The extra fade is what separates "switched off" from "not yet unlocked". */
.un-medallion--suspended .un-medallion__img {
	filter: grayscale(1);
	opacity: 0.5;
}

/* "Désactivé" is plain <small><em>, styled by the theme like every other muted
 * caption in this dashboard — nothing to add here but the strike weight, which
 * defaults far too heavy on a <strong>. */
.un-hero__pillar s,
.un-advantages__stat s { text-decoration-thickness: 1px; }

/* -------------------------------------------------------------------------
 * Referral — two-column layout + copy row.
 * ---------------------------------------------------------------------- */
.un-two-col {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.2em 1.8em;
}
@media (max-width: 600px) {
	.un-two-col { grid-template-columns: 1fr; }
}
.un-two-col p { margin: 0 0 0.4em; }
.un-copy-row {
	display: flex;
	gap: 0.4em;
	align-items: stretch;
	flex-wrap: nowrap;
}
.un-copy-input {
	flex: 1 1 auto;
	min-width: 0;
	height: 38px;
	box-sizing: border-box;
	padding: 0 12px;
	border: 1px solid var(--un-border);
	border-radius: var(--un-radius);
	background: var(--un-white);
	font-family: monospace;
}
.un-copy-row .un-copy-btn {
	flex: 0 0 auto;
	height: 38px;
	box-sizing: border-box;
}

/* -------------------------------------------------------------------------
 * Wallet — two-card grid.
 * ---------------------------------------------------------------------- */
.un-wallet__grid {
	display: grid;
	grid-template-columns: 1.3fr 1fr;
	gap: 1em;
	margin-top: 1em;
}
@media (max-width: 600px) {
	.un-wallet__grid { grid-template-columns: 1fr; }
}
.un-wallet__card {
	padding: 1.2em 1.4em;
	border-radius: var(--un-radius);
	background: var(--un-white);
	border: 1px solid var(--un-section-border);
}
.un-wallet__card--available {
	border-color: var(--un-accent);
}
.un-wallet__card p { margin: 0; }
.un-wallet__card h4 { margin: 0.2em 0 0.6em; }

/* -------------------------------------------------------------------------
 * Publications — status + inline submit form.
 * ---------------------------------------------------------------------- */
.un-publications__header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1em;
	margin-bottom: 0.6em;
}
.un-publications__header h3 { margin: 0; }
.un-publications__suspended {
	margin: 0 0 1.2em;
	padding: 0.8em 1.1em;
	background: var(--un-error-bg);
	border-left: 3px solid var(--un-error);
	border-radius: var(--un-radius);
}

/* Inline form: URL input + button in one row.
   !important used only to overpower theme WC rules that force
   max-width and text-transform: capitalize on the url input. */
.un-post-submit {
	display: flex;
	gap: 0.6em;
	flex-wrap: wrap;
	align-items: stretch;
	margin-top: 0.6em;
}
.un-post-submit input[type="url"] {
	flex: 1 1 auto !important;
	width: auto !important;
	max-width: none !important;
	min-width: 0;
	height: 42px;
	box-sizing: border-box;
	padding: 0 14px !important;
	margin: 0 !important;
	border: 1px solid var(--un-border);
	border-radius: var(--un-radius);
	background: var(--un-white);
	text-transform: none !important;
}
.un-post-submit input[type="url"]::placeholder {
	text-transform: none;
}
.un-post-submit input[type="url"]:focus {
	outline: none;
	border-color: var(--un-accent);
	box-shadow: 0 0 0 3px rgba(145, 111, 115, 0.15);
}
.un-post-submit button[type="submit"] {
	flex: 0 0 auto;
}
.un-form-feedback {
	flex-basis: 100%;
	margin: 0.4em 0 0;
}
@media (max-width: 540px) {
	.un-post-submit input[type="url"] { flex-basis: 100%; }
	.un-post-submit button[type="submit"] { flex-basis: 100%; }
}

/* -------------------------------------------------------------------------
 * Pills (posting status) — bespoke badge component.
 * ---------------------------------------------------------------------- */
.un-pill {
	display: inline-block;
	padding: 0.25em 0.85em;
	border-radius: var(--un-radius);
	font-weight: 600;
	white-space: nowrap;
}
.un-pill--green  { background: var(--un-success-bg); color: var(--un-success); }
.un-pill--orange { background: var(--un-warning-bg); color: var(--un-warning); }
.un-pill--red    { background: var(--un-error-bg); color: var(--un-error); }

/* -------------------------------------------------------------------------
 * History — CSS-only tabs. Radio:checked ~ sibling label/panel.
 * ---------------------------------------------------------------------- */
.un-history__tabs {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0;
	border-bottom: 1px solid var(--un-section-border);
	margin-top: 1em;
}
.un-history__tabs input[type="radio"] {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}
.un-history__tab {
	padding: 0.9em 0.6em;
	text-align: center;
	cursor: pointer;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	font-weight: 600;
	user-select: none;
}
.un-history__tab.is-empty { opacity: 0.5; }

.un-history__panel {
	display: none;
	grid-column: 1 / -1;
	padding-top: 1.2em;
}

#un-tab-pubs:checked   ~ label[for="un-tab-pubs"],
#un-tab-refs:checked   ~ label[for="un-tab-refs"],
#un-tab-ledger:checked ~ label[for="un-tab-ledger"] {
	color: var(--un-accent);
	border-bottom-color: var(--un-accent);
}
#un-tab-pubs:checked   ~ .un-history__panel--pubs,
#un-tab-refs:checked   ~ .un-history__panel--refs,
#un-tab-ledger:checked ~ .un-history__panel--ledger {
	display: block;
}

.un-history__panel table { width: 100%; }
/* Kill the last row border so it doesn't stack with the section border. */
.un-history__panel table tbody tr:last-child td,
.un-history__panel table tbody tr:last-child th {
	border-bottom: 0 !important;
}

/* Data-driven color tag on ledger rows (can't delegate — color comes
   from PHP based on ledger entry type). */
.un-ledger-type { font-weight: 600; }

/* -------------------------------------------------------------------------
 * CGU modal — bespoke overlay.
 * ---------------------------------------------------------------------- */
.un-cgu-modal-overlay {
	position: fixed;
	inset: 0;
	background: var(--un-overlay);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 99999;
	padding: 1em;
}
.un-cgu-modal {
	background: var(--un-white);
	max-width: 520px;
	width: 100%;
	padding: 2em;
	border-radius: var(--un-radius);
	max-height: 90vh;
	overflow-y: auto;
}
.un-cgu-content {
	background: var(--un-rose-bg);
	padding: 1em 1.2em;
	border-radius: var(--un-radius);
	margin: 1em 0;
	border: 1px solid var(--un-section-border);
}

/* Screen-reader only helper */
.un-ambassador-dashboard .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ==========================================================================
   Profile page — /[my-account-slug]/profil-ambassadeur/
   ========================================================================== */
.un-profile-page {
	max-width: 640px;
}

.un-profile-section {
	margin-top: 1.2em;
	padding: 1.5em;
	background: var(--un-white);
	border: 1px solid var(--un-section-border, #ebe2e4);
	border-radius: var(--un-radius);
}

.un-profile-section h3 {
	margin: 0 0 .4em;
	font-size: 1.1rem;
}

.un-profile-hint {
	margin: 0 0 1.2em;
	color: var(--un-text-2);
	font-size: .9rem;
}

.un-avatar-uploader {
	display: flex;
	align-items: center;
	gap: 20px;
	flex-wrap: wrap;
}

.un-avatar-frame {
	position: relative;
	width: 128px;
	height: 128px;
	border-radius: 50%;
	overflow: hidden;
	cursor: pointer;
	background: var(--un-bg-soft);
	border: 2px solid var(--un-section-border, #ebe2e4);
	flex-shrink: 0;
}

.un-avatar-preview {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.un-avatar-hover {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--un-overlay);
	color: var(--un-white);
	font-size: .85rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .05em;
	opacity: 0;
	transition: opacity .15s ease;
}

.un-avatar-frame:hover .un-avatar-hover,
.un-avatar-uploader.is-loading .un-avatar-hover {
	opacity: 1;
}

.un-avatar-uploader.is-loading .un-avatar-frame {
	pointer-events: none;
	opacity: .7;
}

.un-avatar-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-items: flex-start;
}

.un-avatar-feedback {
	flex-basis: 100%;
	margin: 0;
	font-size: .85rem;
	color: var(--un-text-2);
	min-height: 1.2em;
}

.un-avatar-feedback--error {
	color: var(--un-error);
}

/* My Looks — actions cell. Differentiate Modifier (primary) from Supprimer
   (discreet link) so the destructive action is visually distinct from the
   common edit action. Same-looking buttons led to mis-clicks where users
   trashed drafts thinking they were opening the edit form. */
.un-my-looks__actions {
	display: flex;
	gap: 12px;
	align-items: center;
	flex-wrap: wrap;
}

.un-my-looks__btn-edit {
	font-weight: 600;
}

.un-my-looks__btn-delete {
	display: inline-block;
	padding: 4px 8px;
	color: var(--un-error);
	font-size: .85em;
	text-decoration: underline;
	background: transparent;
	border: 0;
	cursor: pointer;
	transition: color 120ms ease;
}

.un-my-looks__btn-delete:hover,
.un-my-looks__btn-delete:focus {
	color: var(--un-error);
	text-decoration: none;
}

/* -------------------------------------------------------------------------
 * Section titles with rose UN icon (Parrainage, Cashback, Publications,
 * Vos avantages, Avis). Layout only — text inherits theme heading styles.
 * ---------------------------------------------------------------------- */
.un-section-title {
	display: flex;
	align-items: center;
	gap: 0.5em;
}
.un-section-icon {
	display: inline-flex;
	color: var(--un-accent);
	flex-shrink: 0;
}
.un-section-icon svg { display: block; }

/* -------------------------------------------------------------------------
 * Retention banner — pinned to the top of the hub, dismissable.
 * ---------------------------------------------------------------------- */
.un-hub-banner {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 1em;
	padding: 0.9em 1.2em;
	margin-bottom: 1.4em;
	background: var(--un-warning-bg);
	border-left: 3px solid var(--un-warning);
	border-radius: var(--un-radius);
}
.un-hub-banner[hidden] { display: none; }
.un-hub-banner__icon {
	display: inline-flex;
	flex-shrink: 0;
	color: var(--un-warning);
}
.un-hub-banner__icon svg { display: block; }
.un-hub-banner__body {
	display: flex;
	flex-direction: column;
	gap: 0.15em;
	min-width: 0;
	flex: 1 1 auto;
}
.un-hub-banner__dismiss {
	flex-shrink: 0;
	width: 28px;
	height: 28px;
	line-height: 1;
	font-size: 1.3em;
	color: var(--un-text-2);
	background: transparent;
	border: 0;
	cursor: pointer;
	border-radius: var(--un-radius);
}
.un-hub-banner__dismiss:hover { color: var(--un-text); }

/* -------------------------------------------------------------------------
 * Vos avantages — 3-stat summary card.
 * ---------------------------------------------------------------------- */
.un-advantages__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.2em;
	margin-top: 1em;
}
.un-advantages__stat {
	display: flex;
	flex-direction: column;
	gap: 0.25em;
	text-align: center;
	padding: 1em 0.6em;
	background: var(--un-accent-soft);
	border-radius: var(--un-radius);
}
.un-advantages__stat strong { font-size: 1.2em; }
/* Suspended: the whole card steps back so the three "Suspendu" values read as
 * one state rather than three separate problems. */
.un-advantages--suspended .un-advantages__stat { opacity: 0.75; }
.un-advantages__note { margin: 0.8em 0 0; text-align: center; }
@media (max-width: 640px) {
	.un-advantages__grid { grid-template-columns: 1fr; }
}

/* -------------------------------------------------------------------------
 * Publications list (under the submit form).
 * ---------------------------------------------------------------------- */
.un-publications__list {
	list-style: none;
	margin: 1.4em 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
}
.un-publications__item {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6em 1em;
	padding: 0.7em 0;
	border-top: 1px solid var(--un-section-border);
}
.un-publications__item-main {
	display: flex;
	align-items: center;
	gap: 0.6em;
	flex: 1 1 auto;
	min-width: 0;
}
.un-publications__link {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.un-publications__date {
	color: var(--un-text-2);
	font-size: 0.9em;
	flex-shrink: 0;
}
.un-publications__reason {
	flex-basis: 100%;
	color: var(--un-text-2);
}

/* -------------------------------------------------------------------------
 * Avis produits list.
 * ---------------------------------------------------------------------- */
.un-reviews__list {
	list-style: none;
	margin: 1em 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
}
.un-reviews__item {
	padding: 0.9em 0;
	border-top: 1px solid var(--un-section-border);
}
.un-reviews__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1em;
	flex-wrap: wrap;
}
.un-reviews__rating {
	color: var(--un-accent);
	letter-spacing: 0.08em;
	flex-shrink: 0;
}
.un-reviews__excerpt { margin: 0.4em 0 0.2em; }
.un-reviews__date {
	color: var(--un-text-2);
	font-size: 0.9em;
}
