/* NikolicWP Fitnes Poeni – the client's dashboard ([fp_poeni]) and leaderboard ([fp_rang_lista]).
 *
 * Colours follow the theme: Blocksy palette variables when present (--theme-palette-color-1 …),
 * otherwise the fallbacks below. Buttons reuse the theme's .ct-button when it exists. The two
 * variables the owner can set in Appearance (--fp-hero-bg, --fp-accent) override the hero colours.
 */

.fp-widget {
	--fp-text: var(--theme-text-color, #2b2f36);
	--fp-muted: color-mix(in srgb, var(--fp-text) 62%, transparent);
	--fp-line: color-mix(in srgb, var(--fp-text) 12%, transparent);
	--fp-soft: color-mix(in srgb, var(--fp-text) 5%, transparent);
	--fp-card: var(--theme-background-color, #fff);
	--fp-primary: var(--theme-palette-color-1, #2872fa);
	--fp-hero-bg: var(--theme-palette-color-4, #173963);
	--fp-hero-text: #fff;
	--fp-accent: #4ade80;
	--fp-pos: #15803d;
	--fp-neg: #c62828;
	--fp-warn: #b45309;
	--fp-radius: var(--theme-card-border-radius, 14px);
	--fp-focus: 0 0 0 3px color-mix(in srgb, var(--fp-primary) 35%, transparent);
	color: var(--fp-text);
	font-family: inherit;
	line-height: 1.55;
	max-width: 760px;
	margin: 0 auto;
	box-sizing: border-box;
}
.fp-widget *, .fp-widget *::before, .fp-widget *::after { box-sizing: inherit; }
.fp-widget :focus-visible { outline: none; box-shadow: var(--fp-focus); border-radius: 6px; }
.fp-widget .screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fp-widget [hidden], .fp-widget .is-hidden { display: none !important; }
.fp-widget p { margin: 0 0 .9em; }
.fp-widget ul, .fp-widget ol { list-style: none; margin: 0; padding: 0; }
.fp-widget .fp-small { font-size: .9em; color: var(--fp-muted); }
.fp-widget .fp-intro { color: var(--fp-muted); }
.fp-widget .fp-empty { padding: 18px; text-align: center; color: var(--fp-muted); background: var(--fp-soft); border-radius: var(--fp-radius); }
.fp-widget .fp-pos { color: var(--fp-pos); }
.fp-widget .fp-neg { color: var(--fp-neg); }

/* Notices */
.fp-widget .fp-notice { padding: 12px 16px; border-radius: 10px; margin: 0 0 14px; border-left: 4px solid currentColor; background: var(--fp-soft); }
.fp-widget .fp-notice-success { color: var(--fp-pos); background: color-mix(in srgb, var(--fp-pos) 10%, transparent); }
.fp-widget .fp-notice-error { color: var(--fp-neg); background: color-mix(in srgb, var(--fp-neg) 10%, transparent); }
.fp-widget .fp-notice-warning { color: var(--fp-warn); background: color-mix(in srgb, var(--fp-warn) 12%, transparent); }

/* Hero */
.fp-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; padding: 24px; border-radius: var(--fp-radius); background: var(--fp-hero-bg); color: var(--fp-hero-text); margin-bottom: 16px; position: relative; overflow: hidden; }
.fp-hero::after { content: ""; position: absolute; right: -70px; top: -90px; width: 240px; height: 240px; border-radius: 50%; background: var(--fp-accent); opacity: .14; pointer-events: none; }
.fp-hero__main { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; }
.fp-hero__side { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; }
.fp-hero .fp-balance-number { font-size: 3.2em; font-weight: 800; line-height: 1; letter-spacing: -.5px; color: var(--fp-accent); display: flex; align-items: baseline; gap: 6px; }
.fp-hero .fp-hero__unit { font-size: .4em; font-weight: 700; opacity: .9; }
.fp-hero .fp-balance-label { opacity: .9; margin-top: 6px; }
.fp-hero__cap { font-size: .85em; opacity: .8; margin-top: 6px; }
.fp-progress { height: 10px; border-radius: 10px; background: rgba(255,255,255,.22); overflow: hidden; margin-top: 12px; }
.fp-progress > span { display: block; height: 100%; border-radius: 10px; background: var(--fp-accent); transition: width .5s ease; }
.fp-progress--thin { height: 6px; margin-top: 8px; }
.fp-panel .fp-progress { background: var(--fp-soft); }
.fp-panel .fp-progress > span { background: var(--fp-primary); }
.fp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fp-stat { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; min-width: 0; }
.fp-stat__value { font-size: 1.4em; font-weight: 700; line-height: 1.1; }
.fp-stat__label { font-size: .78em; opacity: .85; line-height: 1.3; }
.fp-next { background: rgba(255,255,255,.1); border-radius: 12px; padding: 10px 12px; font-size: .92em; }
.fp-next .fp-progress { background: rgba(255,255,255,.18); }
.fp-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.fp-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: .85em; }

/* Tabs */
.fp-tabs { display: flex; gap: 6px; padding: 6px; margin: 0 0 14px; border: 1px solid var(--fp-line); border-radius: 12px; background: var(--fp-card); overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.fp-tabs::-webkit-scrollbar { display: none; }
.fp-tab { flex: 0 0 auto; appearance: none; border: 0; background: transparent; color: var(--fp-text); font: inherit; font-weight: 600; font-size: .95em; padding: 9px 16px; border-radius: 8px; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.fp-tab:hover { background: var(--fp-soft); }
.fp-tab.is-active { background: var(--fp-primary); color: #fff; }
.fp-panel { animation: fp-fade .18s ease; }
.fp-panel__title { margin: 24px 0 10px; font-size: 1.15em; }
.fp-subheading { margin: 22px 0 10px; font-size: 1.05em; }
@keyframes fp-fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* Toolbars, chips, selects, search, switches */
.fp-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.fp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fp-chip { appearance: none; border: 1px solid var(--fp-line); background: var(--fp-card); color: var(--fp-text); font: inherit; font-size: .88em; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.fp-chip:hover { background: var(--fp-soft); }
.fp-chip.is-active { background: var(--fp-primary); border-color: var(--fp-primary); color: #fff; }
.fp-select select, .fp-search input { font: inherit; font-size: .92em; padding: 7px 12px; border: 1px solid var(--fp-line); border-radius: 999px; background: var(--fp-card); color: var(--fp-text); min-height: 36px; }
.fp-search { margin-left: auto; flex: 1 1 180px; max-width: 260px; }
.fp-search input { width: 100%; }
.fp-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; position: relative; }
.fp-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fp-switch__track { width: 40px; height: 22px; border-radius: 999px; background: color-mix(in srgb, var(--fp-text) 25%, transparent); position: relative; flex: 0 0 auto; transition: background .2s; }
.fp-switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.fp-switch input:checked + .fp-switch__track { background: var(--fp-primary); }
.fp-switch input:checked + .fp-switch__track::after { transform: translateX(18px); }
.fp-switch input:focus-visible + .fp-switch__track { box-shadow: var(--fp-focus); }
.fp-switch__label { font-size: .92em; }
.fp-switch--row { display: flex; padding: 12px 0; border-bottom: 1px solid var(--fp-line); }
.fp-prefs__save { margin-top: 14px; display: flex; align-items: center; gap: 12px; }
.fp-prefs__status { font-size: .9em; color: var(--fp-pos); }

/* Buttons */
.fp-btn { appearance: none; border: 0; border-radius: 8px; background: var(--fp-primary); color: #fff; font: inherit; font-weight: 600; font-size: .92em; padding: 9px 16px; cursor: pointer; line-height: 1.2; }
.fp-btn:hover { filter: brightness(1.08); }
.fp-btn[disabled] { opacity: .45; cursor: default; filter: none; }
.fp-btn--ghost { background: var(--fp-soft); color: var(--fp-text); }
.fp-widget .ct-button.fp-btn { padding: 9px 16px; font-size: .92em; }

/* Rewards */
.fp-rewards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.fp-reward { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--fp-line); border-radius: var(--fp-radius); background: var(--fp-card); transition: box-shadow .15s, transform .15s; }
.fp-reward.is-affordable { border-color: color-mix(in srgb, var(--fp-pos) 45%, transparent); }
.fp-reward.is-affordable:hover { box-shadow: 0 8px 24px rgba(0,0,0,.08); transform: translateY(-1px); }
.fp-reward.is-locked { opacity: .78; }
.fp-reward__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.fp-reward__name { font-weight: 700; }
.fp-reward__cost { flex: 0 0 auto; font-weight: 700; color: var(--fp-primary); white-space: nowrap; }
.fp-reward__desc { margin: 0; font-size: .9em; color: var(--fp-muted); }
.fp-reward__foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.fp-redeem-form { margin: 0; }
.fp-missing { font-size: .88em; color: var(--fp-muted); }
.fp-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8em; font-weight: 600; }
.fp-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.fp-pill--ok, .fp-pill--approved { color: var(--fp-pos); background: color-mix(in srgb, var(--fp-pos) 12%, transparent); }
.fp-pill--pending { color: var(--fp-warn); background: color-mix(in srgb, var(--fp-warn) 14%, transparent); }
.fp-pill--rejected { color: var(--fp-neg); background: color-mix(in srgb, var(--fp-neg) 10%, transparent); }
.fp-requests { border: 1px solid var(--fp-line); border-radius: var(--fp-radius); overflow: hidden; }
.fp-request { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--fp-line); font-size: .93em; }
.fp-request:last-child { border-bottom: 0; }
.fp-request__date { color: var(--fp-muted); white-space: nowrap; }
.fp-request__name small { color: var(--fp-muted); margin-left: 4px; }

/* History */
.fp-summary { font-size: .9em; color: var(--fp-muted); margin: 0 0 10px; }
.fp-history { border: 1px solid var(--fp-line); border-radius: var(--fp-radius); overflow: hidden; }
.fp-history__row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--fp-line); }
.fp-history__row:last-child { border-bottom: 0; }
.fp-history__icon { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.fp-history__row--earn .fp-history__icon { background: color-mix(in srgb, var(--fp-pos) 14%, transparent); color: var(--fp-pos); }
.fp-history__row--earn .fp-history__icon::before { content: "+"; }
.fp-history__row--spend .fp-history__icon { background: color-mix(in srgb, var(--fp-neg) 12%, transparent); color: var(--fp-neg); }
.fp-history__row--spend .fp-history__icon::before { content: "−"; }
.fp-history__row--expire .fp-history__icon { background: color-mix(in srgb, var(--fp-warn) 14%, transparent); color: var(--fp-warn); }
.fp-history__row--expire .fp-history__icon::before { content: "⌛"; font-size: 13px; }
.fp-history__body { display: flex; flex-direction: column; min-width: 0; }
.fp-history__reason { font-weight: 600; overflow-wrap: anywhere; }
.fp-history__meta { font-size: .82em; color: var(--fp-muted); }
.fp-history__points { font-weight: 700; white-space: nowrap; }
.fp-history-wrap.is-loading, [data-fp-rank-rows].is-loading { opacity: .5; pointer-events: none; }

/* How to earn */
.fp-how { border: 1px solid var(--fp-line); border-radius: var(--fp-radius); overflow: hidden; }
.fp-how__row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--fp-line); }
.fp-how__row:last-child { border-bottom: 0; }
.fp-how__row:nth-child(even) { background: var(--fp-soft); }
.fp-how__points { font-weight: 700; color: var(--fp-pos); white-space: nowrap; }

/* Leaderboard */
.fp-rank__row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border: 1px solid var(--fp-line); border-radius: 12px; margin-bottom: 8px; background: var(--fp-card); }
.fp-rank__row.is-me { border-color: var(--fp-primary); background: color-mix(in srgb, var(--fp-primary) 7%, transparent); }
.fp-rank__pos { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; background: var(--fp-soft); font-size: .9em; }
.fp-rank__row.is-top .fp-rank__pos { background: color-mix(in srgb, var(--fp-primary) 15%, transparent); color: var(--fp-primary); }
.fp-rank__who { display: flex; flex-direction: column; min-width: 0; }
.fp-rank__name { font-weight: 600; overflow-wrap: anywhere; }
.fp-rank__name em { font-style: normal; font-weight: 400; color: var(--fp-muted); }
.fp-rank__badges { font-size: .9em; }
.fp-rank__points { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }
.fp-rank__points strong { color: var(--fp-primary); }
.fp-rank__points small { font-size: .78em; color: var(--fp-muted); }
.fp-rank__gap { text-align: center; color: var(--fp-muted); padding: 2px 0 8px; letter-spacing: 3px; }

/* Pager */
.fp-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.fp-pager__info { font-size: .88em; color: var(--fp-muted); }

/* Referral */
.fp-referral-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.fp-referral-form .fp-field { flex: 1 1 220px; max-width: 340px; }
.fp-referral-form input[type=email] { width: 100%; font: inherit; padding: 9px 12px; border: 1px solid var(--fp-line); border-radius: 8px; background: var(--fp-card); color: var(--fp-text); }

/* Standalone leaderboard */
.fp-leaderboard-widget > h3, .fp-leaderboard-widget > h2, .fp-leaderboard-widget > h4 { margin-top: 0; }

/* Phones */
@media (max-width: 640px) {
	.fp-hero { grid-template-columns: 1fr; padding: 18px; gap: 14px; }
	.fp-hero .fp-balance-number { font-size: 2.8em; }
	.fp-stats { gap: 6px; }
	.fp-stat { padding: 8px 10px; }
	.fp-stat__value { font-size: 1.2em; }
	.fp-search { margin-left: 0; max-width: none; flex-basis: 100%; }
	.fp-toolbar .fp-select { flex: 1 1 auto; }
	.fp-toolbar .fp-select select { width: 100%; }
	.fp-rewards { grid-template-columns: 1fr; }
	.fp-request { grid-template-columns: minmax(0, 1fr) auto; }
	.fp-request__date { grid-column: 1 / -1; font-size: .82em; }
	.fp-pager .fp-btn { padding: 8px 10px; font-size: .85em; }
}

/* Motion and contrast preferences */
@media (prefers-reduced-motion: reduce) {
	.fp-widget * { transition: none !important; animation: none !important; }
}
@media (prefers-contrast: more) {
	.fp-widget { --fp-line: color-mix(in srgb, var(--fp-text) 40%, transparent); }
}
