/* =====================================================================
   RPG XP Systém — Frontend styly
   Záměrně NEPOUŽÍVÁ hardkódované barvy — dědí ze šablony webu.
   Výjimka: sémantické stavy (⬆ zelená / ❌ červená).
   Popup barvy jsou přepisovatelné CSS proměnnými z nastavení pluginu.
   ===================================================================== */

/* ── CSS proměnné (výchozí hodnoty, přepisovatelné šablonou/nastavením) ─── */
:root {
    --xp-bar-h:        8px;
    --xp-bar-radius:   4px;
    --xp-bar-bg:       rgba(128,128,128,0.18);
    --xp-bar-fill:     currentColor;
    --xp-bar-opacity:  0.7;

    --xp-lvl-font:     .72em;
    --xp-lvl-pad:      .15em .45em;
    --xp-lvl-radius:   3px;
    --xp-lvl-bg:       rgba(128,128,128,0.12);
    --xp-lvl-border:   rgba(128,128,128,0.25);

    --xp-star-opacity:       0.55;
    --xp-star-opacity-hover: 1;
    --xp-star-cursor:        pointer;

    --xp-popup-bg:       #16213e;
    --xp-popup-color:    #f0c040;
    --xp-popup-border:   2px solid rgba(240,192,64,0.5);
    --xp-popup-btn-bg:   #f0c040;
    --xp-popup-btn-color:#16213e;
    --xp-popup-z:        9999;
    --xp-popup-radius:   10px;
    --xp-popup-shadow:   0 8px 40px rgba(0,0,0,0.55);
}

/* ── XP Progress Bar (obecný) ────────────────────────────────────────────── */
.xp-bar-wrap {
    display: block;
    height: var(--xp-bar-h);
    border-radius: var(--xp-bar-radius);
    background: var(--xp-bar-bg);
    overflow: hidden;
    position: relative;
}

.xp-bar-fill {
    display: block;
    height: 100%;
    border-radius: var(--xp-bar-radius);
    background: var(--xp-bar-fill);
    opacity: var(--xp-bar-opacity);
    transition: width .4s ease;
    min-width: 2px;
}

/* ── Level badge ─────────────────────────────────────────────────────────── */
.rpg-xp-lvl-badge {
    display: inline-block;
    font-size: var(--xp-lvl-font);
    font-weight: bold;
    padding: var(--xp-lvl-pad);
    border-radius: var(--xp-lvl-radius);
    background: var(--xp-lvl-bg);
    border: 1px solid var(--xp-lvl-border);
    letter-spacing: .03em;
    vertical-align: middle;
}

/* ── Userpanel XP widget ─────────────────────────────────────────────────── */
.rpg-xp-userpanel {
    margin-top: .75em;
    padding-top: .65em;
    border-top: 1px solid rgba(128,128,128,0.15);
    font-size: .85em;
    line-height: 1.35;
}

.rpg-xp-row {
    display: flex;
    align-items: center;
    gap: .5em;
    margin-bottom: .35em;
    flex-wrap: wrap;
}

.rpg-xp-label {
    flex: 1;
    opacity: .75;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rpg-xp-amount {
    font-weight: bold;
    white-space: nowrap;
}

.rpg-xp-next {
    margin-top: .3em;
    font-size: .88em;
    opacity: .65;
}

/* ── HCM XP widget (rpg-xp-bar) ─────────────────────────────────────────── */
.xp-widget {
    display: flex;
    flex-direction: column;
    gap: .4em;
    padding: .75em 0;
}

.xp-widget-header {
    display: flex;
    align-items: center;
    gap: .6em;
    font-size: .9em;
    flex-wrap: wrap;
}

.xp-widget-title {
    flex: 1;
    opacity: .75;
    font-style: italic;
}

.xp-widget-xp {
    font-weight: bold;
}

.xp-widget-next {
    font-size: .82em;
    opacity: .6;
    text-align: right;
}

/* ── Hvězdičky u příspěvků ───────────────────────────────────────────────── */
.rpg-xp-star-btn {
    display: inline-flex;
    align-items: center;
    gap: .2em;
    font-size: .82em;
    opacity: var(--xp-star-opacity);
    transition: opacity .15s, transform .1s;
    vertical-align: middle;
    line-height: 1;
}

.rpg-xp-star-can {
    cursor: var(--xp-star-cursor);
    opacity: var(--xp-star-opacity);
}

.rpg-xp-star-can:hover {
    opacity: var(--xp-star-opacity-hover);
    transform: scale(1.12);
}

.rpg-xp-star-given {
    opacity: .9;
    cursor: default;
}

.rpg-xp-star-disabled {
    opacity: .3;
    cursor: default;
}

.rpg-xp-star-display {
    font-size: .82em;
    opacity: .5;
    vertical-align: middle;
}

.rpg-xp-star-btn sup,
.rpg-xp-star-display sup {
    font-size: .75em;
    vertical-align: super;
    line-height: 1;
}

/* Přechodný stav během AJAX ─────────────────────────────────────────────── */
.rpg-xp-star-btn.rpg-xp-star-loading {
    opacity: .4;
    pointer-events: none;
}

/* ── Level-up Popup ──────────────────────────────────────────────────────── */
.xp-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: var(--xp-popup-z);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: xpOverlayIn .25s ease;
}

@keyframes xpOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.xp-popup {
    background: var(--xp-popup-bg);
    color: var(--xp-popup-color);
    border: var(--xp-popup-border);
    border-radius: var(--xp-popup-radius);
    box-shadow: var(--xp-popup-shadow);
    padding: 2em 2.5em;
    text-align: center;
    max-width: 380px;
    width: 90%;
    position: relative;
    animation: xpPopupIn .32s cubic-bezier(.175,.885,.32,1.275);
}

@keyframes xpPopupIn {
    from { transform: scale(.7) translateY(20px); opacity: 0; }
    to   { transform: scale(1)  translateY(0);    opacity: 1; }
}

.xp-popup-icon {
    font-size: 3.2em;
    line-height: 1;
    margin-bottom: .25em;
    animation: xpIconBounce .6s .25s ease both;
}

@keyframes xpIconBounce {
    0%   { transform: scale(.5) rotate(-15deg); opacity: 0; }
    70%  { transform: scale(1.2) rotate(5deg);  opacity: 1; }
    100% { transform: scale(1)  rotate(0deg);   opacity: 1; }
}

.xp-popup-title {
    font-size: 1.6em;
    font-weight: bold;
    margin: 0 0 .4em;
    line-height: 1.2;
}

.xp-popup-text {
    font-size: 1em;
    line-height: 1.5;
    margin-bottom: .5em;
    opacity: .9;
}

.xp-popup-sub {
    font-size: .85em;
    opacity: .65;
    margin-bottom: 1.2em;
}

.xp-popup-btn {
    display: inline-block;
    background: var(--xp-popup-btn-bg);
    color: var(--xp-popup-btn-color);
    border: none;
    border-radius: 5px;
    padding: .55em 1.6em;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: filter .15s, transform .1s;
    text-decoration: none;
}

.xp-popup-btn:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}

/* Confetti particles ─────────────────────────────────────────────────────── */
.xp-confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    pointer-events: none;
    animation: xpConfettiFall 1.2s ease-in forwards;
}

@keyframes xpConfettiFall {
    0%   { opacity: 1; transform: translateY(0)   rotate(0deg)   scale(1); }
    100% { opacity: 0; transform: translateY(80px) rotate(360deg) scale(.5); }
}
