/* ════════════════════════════════════════════════
   Gamification Module – Styles v1.15
   ════════════════════════════════════════════════ */

/* ── CSS Custom Properties ───────────────────── */
:root {
    --gm-primary:   #6366f1;
    --gm-secondary: #8b5cf6;
    --gm-success:   #22c55e;
    --gm-warning:   #f59e0b;
    --gm-danger:    #ef4444;
    --gm-info:      #06b6d4;
    --gm-bg:        #f8fafc;
    --gm-border:    #e2e8f0;
    --gm-radius:    12px;
    --gm-shadow:    0 2px 8px rgba(99,102,241,.12);
}

/* ── Inline badge (posts / comments) ────────── */
.gm-inline-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    line-height: 1;
    margin-top: 2px;
}
.gm-badge-link {
    color: var(--gm-primary) !important;
    opacity: .85;
    transition: opacity .15s;
}
.gm-badge-link:hover { opacity: 1; }
.gm-pts {
    color: #94a3b8;
    font-size: 10px;
}

/* ── Admin layout ────────────────────────────── */
.gm-admin-header {
    background: linear-gradient(135deg, var(--gm-primary), var(--gm-secondary));
    color: #fff;
    border-radius: var(--gm-radius) var(--gm-radius) 0 0;
    padding: 24px 28px 20px;
    margin: -15px -15px 24px;  /* bleed to panel edges */
}
.gm-admin-header h2 {
    margin: 0 0 4px;
    font-size: 1.4rem;
    font-weight: 700;
}
.gm-admin-header p { margin: 0; opacity: .85; font-size: .9rem; }
.gm-admin-header .gm-version {
    font-size: 11px;
    opacity: .6;
    margin-top: 8px;
}

/* ── Stat cards ──────────────────────────────── */
.gm-stat-card {
    background: #fff;
    border: 1px solid var(--gm-border);
    border-radius: var(--gm-radius);
    padding: 16px;
    text-align: center;
    transition: box-shadow .2s, transform .2s;
}
.gm-stat-card:hover {
    box-shadow: var(--gm-shadow);
    transform: translateY(-2px);
}
.gm-stat-card .gm-stat-icon  { font-size: 2rem; line-height: 1; margin-bottom: 4px; }
.gm-stat-card .gm-stat-value { font-size: 1.6rem; font-weight: 700; color: var(--gm-primary); }
.gm-stat-card .gm-stat-label { font-size: .75rem; color: #64748b; margin-top: 2px; }

/* ── Nav tabs (module-wide) ──────────────────── */
.gm-nav {
    border-bottom: 2px solid var(--gm-border);
    margin-bottom: 24px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.gm-nav a {
    padding: 8px 16px;
    border-radius: 8px 8px 0 0;
    font-size: .875rem;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    border: 1px solid transparent;
    border-bottom: none;
    transition: background .15s, color .15s;
}
.gm-nav a:hover     { background: var(--gm-bg); color: var(--gm-primary); }
.gm-nav a.active    {
    background: #fff;
    color: var(--gm-primary);
    border-color: var(--gm-border);
    margin-bottom: -2px;
    padding-bottom: 10px;
}

/* ── Cards ───────────────────────────────────── */
.gm-card {
    background: #fff;
    border: 1px solid var(--gm-border);
    border-radius: var(--gm-radius);
    box-shadow: var(--gm-shadow);
    overflow: hidden;
    margin-bottom: 20px;
}
.gm-card-header {
    background: var(--gm-bg);
    border-bottom: 1px solid var(--gm-border);
    padding: 12px 20px;
    font-weight: 600;
    font-size: .9rem;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
}
.gm-card-body { padding: 20px; }

/* ── Challenge cards ─────────────────────────── */
.gm-challenge-card {
    border: 1px solid var(--gm-border);
    border-radius: var(--gm-radius);
    padding: 16px;
    transition: box-shadow .2s, border-color .2s;
    background: #fff;
}
.gm-challenge-card:hover { box-shadow: var(--gm-shadow); border-color: var(--gm-primary); }
.gm-challenge-card.completed { border-color: var(--gm-success); background: #f0fdf4; }
.gm-progress {
    height: 8px;
    background: var(--gm-border);
    border-radius: 99px;
    overflow: hidden;
    margin-top: 8px;
}
.gm-progress-bar {
    height: 100%;
    border-radius: 99px;
    background: var(--gm-primary);
    transition: width .4s ease;
}
.gm-progress-bar.done { background: var(--gm-success); }

/* ── Leaderboard ─────────────────────────────── */
.gm-leaderboard-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--gm-border);
    transition: background .15s;
}
.gm-leaderboard-row:hover    { background: var(--gm-bg); }
.gm-leaderboard-row.top-3    { background: #fefce8; }
.gm-leaderboard-row .rank    { min-width: 28px; font-weight: 700; color: #94a3b8; font-size: .9rem; }
.gm-leaderboard-row .pts     { margin-left: auto; font-weight: 700; color: var(--gm-primary); white-space: nowrap; }

/* ── Dashboard page ──────────────────────────── */
.gm-dashboard-hero {
    background: linear-gradient(135deg, var(--gm-primary), var(--gm-secondary));
    color: #fff;
    border-radius: var(--gm-radius);
    padding: 32px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.gm-dashboard-hero .gm-hero-icon { font-size: 4rem; line-height: 1; flex-shrink: 0; }
.gm-dashboard-hero h2 { margin: 0 0 4px; font-size: 1.6rem; font-weight: 700; }
.gm-dashboard-hero p  { margin: 0; opacity: .85; }

/* ── Space widget panel ──────────────────────── */
.gamification-space-widget .list-group-item { transition: background .15s; }
.gamification-space-widget .list-group-item:hover { background: var(--gm-bg); }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 576px) {
    .gm-admin-header { padding: 16px; }
    .gm-dashboard-hero { flex-direction: column; text-align: center; }
}

/* ── Mobile optimizations (v1.5) ─────────────── */
@media (max-width: 768px) {
    .gm-nav { gap: 2px; }
    .gm-nav a { padding: 6px 10px; font-size: .8rem; }
    .gm-leaderboard-row { padding: 8px 12px; gap: 8px; }
    .gm-leaderboard-row .pts { font-size: .85rem; }
    .gm-challenge-card { padding: 12px; }
    .gm-stat-card .gm-stat-value { font-size: 1.3rem; }
    .gm-stat-card .gm-stat-icon  { font-size: 1.5rem; }
    .gm-inline-badge { font-size: 10px; }
    .gm-dashboard-hero { padding: 20px; gap: 16px; }
    .gm-dashboard-hero h2 { font-size: 1.3rem; }
    .gamification-space-widget .list-group-item { padding: 6px 12px; }
}

/* ── Team challenge progress ─────────────────── */
.gm-team-card .member-slot {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--gm-border);
    display: inline-block;
}

/* ── Reward shop cards ───────────────────────── */
.gm-reward-unavailable { opacity: .55; pointer-events: none; }

/* ── Season archive banner ───────────────────── */
.gm-season-archived-badge {
    background: linear-gradient(90deg, #f59e0b, #d97706);
    color: #fff;
    padding: 2px 10px;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 600;
}

/* ════════════════════════════════════════════════
   v1.5 Additions
   ════════════════════════════════════════════════ */

/* ── Mobile: touch-friendly tap targets ─────── */
@media (max-width: 576px) {
    .gm-nav a          { padding: 10px 12px; font-size: .8rem; }
    .gm-card-body      { padding: 14px; }
    .gm-stat-card      { padding: 12px 8px; }
    .gm-stat-value     { font-size: 1.3rem; }
    .gm-leaderboard-row{ padding: 8px 12px; }

    /* Quick links wrap nicely on phones */
    .btn-sm            { padding: 8px 12px; font-size: .8rem; }
}

/* ── Reward cards – responsive ───────────────── */
@media (max-width: 768px) {
    .gm-reward-card    { margin-bottom: 12px; }
}

/* ── Team member slot ────────────────────────── */
.gm-team-slot {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--gm-border);
    border: 1px dashed #94a3b8;
    display: inline-block;
    flex-shrink: 0;
}

/* ── Season badge ────────────────────────────── */
.gm-season-active {
    background: linear-gradient(135deg, var(--gm-warning), #d97706);
    color: #fff;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 600;
}

/* ── Rate limit indicator ────────────────────── */
.gm-rate-badge {
    background: #f1f5f9;
    border: 1px solid var(--gm-border);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: .75rem;
    color: #64748b;
}

/* ── Public profile (no-login) ───────────────── */
.gm-public-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px;
}

/* ── Share input group ───────────────────────── */
#gm-share-url { font-family: monospace; font-size: .8rem; color: #334155; }

/* ════════════════════════════════════════════════
   v1.5.2 Layout – HumHub-native width & panel alignment
   ════════════════════════════════════════════════ */

/* ── .gm-page wrapper ────────────────────────────
   All user-facing views wrap their content in <div class="gm-page">.
   This div respects HumHub's content column - no extra max-width needed
   unless the admin explicitly sets contentMaxWidth in Admin → Appearance.
   GamificationAsset injects the max-width CSS dynamically when set.       */
.gm-page {
    /* intentionally no max-width here – GamificationAsset injects it dynamically */
}

/* ── Page header (leaderboard, teams, etc.) ─────────────────────── */
/* Sits directly at the top of the content panel, flush with edges.   */
.gm-page-header {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px 4px 0 0;
    padding: 14px 20px 12px;
    margin-bottom: 0;
    border-bottom: 2px solid var(--gm-primary);
}

/* ── Profile hero ────────────────────────────── */
.gm-profile-hero {
    background: linear-gradient(135deg, var(--gm-primary), var(--gm-secondary));
    color: #fff;
    border-radius: var(--gm-radius);
    padding: 24px 28px;
    margin-bottom: 20px;
}
.gm-profile-avatar {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,.4);
}
.gm-profile-hero h3 { color: #fff; margin: 0 0 4px; font-size: 1.4rem; font-weight: 700; }
.gm-hero-meta { opacity: .85; font-size: .9rem; }
.gm-badge-pill {
    background: rgba(255,255,255,.25);
    border-radius: 99px;
    padding: 2px 10px;
    font-size: .8rem;
}
.gm-hero-progress { max-width: 480px; }
.btn-outline-light { border-color: rgba(255,255,255,.6); color: #fff; }
.btn-outline-light:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ── History privacy notice ──────────────────── */
.gm-history-private {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: var(--gm-radius);
    color: #64748b;
    font-size: .875rem;
}

/* ── Leaderboard "You" highlight ─────────────── */
tr.info td { background-color: #e8f4fd !important; }

/* ════════════════════════════════════════════════
   v1.7.0 Additions
   ════════════════════════════════════════════════ */

/* ── Toast container (injected via JS) ───────── */
#gm-toast-container { font-family: inherit; }

/* ── Achievement cards ───────────────────────── */
.gm-achievement-card {
    border: 1px solid var(--gm-border);
    border-radius: var(--gm-radius);
    padding: 14px 16px;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: box-shadow .2s, transform .2s;
}
.gm-achievement-card:hover {
    box-shadow: var(--gm-shadow);
    transform: translateY(-2px);
}
.gm-achievement-card.earned {
    border-color: var(--gm-warning);
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
}
.gm-achievement-card.secret:not(.earned) {
    opacity: .55;
    filter: grayscale(.6);
}
.gm-achievement-card .ach-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
    width: 44px;
    text-align: center;
}
.gm-achievement-card .ach-name { font-weight: 600; font-size: .9rem; }
.gm-achievement-card .ach-desc { font-size: .8rem; color: #64748b; margin-top: 2px; }
.gm-achievement-card .ach-badge {
    margin-left: auto;
    flex-shrink: 0;
}

/* ── Prestige badge ──────────────────────────── */
.gm-prestige-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border-radius: 99px;
    padding: 2px 10px;
    font-size: .75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ── Multiplier banner ───────────────────────── */
.gm-multiplier-banner {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border-radius: var(--gm-radius);
    padding: 12px 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    animation: gm-pulse 2s infinite;
}
@keyframes gm-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,.4); }
    50%       { box-shadow: 0 0 0 8px rgba(245,158,11,0); }
}

/* ── Peer recognition ────────────────────────── */
.gm-gift-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}
.gm-gift-modal-inner {
    background: #fff;
    border-radius: var(--gm-radius);
    padding: 28px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 8px 40px rgba(0,0,0,.2);
}
.gm-gift-btn {
    background: none;
    border: 1px solid var(--gm-border);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: .8rem;
    cursor: pointer;
    color: var(--gm-primary);
    transition: background .15s;
}
.gm-gift-btn:hover { background: var(--gm-bg); }

/* ── Stat counter animation ──────────────────── */
[data-gm-count] { display: inline-block; }

/* ── Level-up flash ──────────────────────────── */
@keyframes gm-levelup {
    0%   { transform: scale(1); }
    25%  { transform: scale(1.15); }
    50%  { transform: scale(1); }
    75%  { transform: scale(1.08); }
    100% { transform: scale(1); }
}
.gm-levelup-anim { animation: gm-levelup .6s ease-out; }

/* ── Retention funnel bars ───────────────────── */
.gm-progress-bar.info    { background: var(--gm-info); }
.gm-progress-bar.success { background: var(--gm-success); }
.gm-progress-bar.warning { background: var(--gm-warning); }

/* ── Webhook code block ──────────────────────── */
.gm-webhook-url {
    font-family: monospace;
    font-size: .8rem;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    word-break: break-all;
}


/* ════════════════════════════════════════════════
   v1.15 – Gerundete Badges, Level-Pills & Labels
   ════════════════════════════════════════════════ */

/* ── Tier-Badge (Rang/Abzeichen: IMPERATOR, EXPERT etc.) ─────────── */
.gm-tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px 3px 8px;
    font-size: .75rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: .03em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--gm-badge-text, #fff);
    background: var(--gm-badge-bg, #f59e0b);
    border-radius: var(--gm-badge-radius, var(--gm-radius, 8px));
}
.gm-tier-badge.gm-tier-legend  { background: #7c3aed; }
.gm-tier-badge.gm-tier-expert  { background: #d97706; }
.gm-tier-badge.gm-tier-advanced{ background: #b45309; }
.gm-tier-badge.gm-tier-active  { background: #0284c7; }
.gm-tier-badge.gm-tier-beginner{ background: #6b7280; }

/* ── Level-Badge (LVL 1 … LVL 10) ──────────────────────────────── */
.gm-level-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: .7rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--gm-level-text, #fff);
    background: var(--gm-level-bg, var(--gm-primary, #6366f1));
    border-radius: var(--gm-badge-radius, var(--gm-radius, 8px));
}
.gm-level-badge.gm-level-max { background: var(--gm-level-bg, #7c3aed); filter: brightness(1.15); }

/* ── Bootstrap-3 label-* → gerundete Ersatz-Styles ──────────────── */
/* Alle .label-Klassen bekommen nun denselben Radius wie das Modul  */
.label {
    border-radius: var(--gm-badge-radius, var(--gm-radius, 8px)) !important;
    padding: .25em .6em !important;
    font-size: .72em !important;
    display: inline-flex !important;
    align-items: center;
    gap: 3px;
}

/* ── Inline-Badge (Wandpost-Punkte-Anzeige) ──────────────────────── */
.gm-inline-badge-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 7px;
    font-size: .72rem;
    font-weight: 600;
    background: rgba(99,102,241,.12);
    color: var(--gm-primary, #6366f1);
    border-radius: var(--gm-badge-radius, var(--gm-radius, 8px));
}

/* ── JS-gesteuerter Radius (gesetzt via inline style auf :root) ──── */
/* Wird durch gamification.js nach Laden der Seite aktualisiert      */
