/* GEA · Data display — avatars, badges, tags, kbd, divider, table, progress, stat */

/* FLAG — country flag pill, wraps the flag-icons (.fi) class.
   Library: https://flagicons.lipis.dev
   Usage: <x-flag code="GE" /> or <span class="gea-flag"><span class="fi fi-ge"></span></span>
   Variants: --sm, --md (default), --lg, --xl. Compose with country code like "GE · Georgia". */
.gea-flag {
    display: inline-flex;
    align-items: center;
    gap: var(--gea-space-2);
    color: var(--gea-text);
    font-size: var(--gea-text-sm);
    line-height: 1;
}
.gea-flag .fi,
.gea-flag .fis {
    flex: none;
    width: 20px;
    height: 15px;
    border-radius: 2px;
    background-size: cover;
    box-shadow: inset 0 0 0 1px var(--gea-border);
    line-height: 1;
}
.gea-flag--sm  .fi, .gea-flag--sm  .fis { width: 16px; height: 12px; border-radius: 2px; }
.gea-flag--md  .fi, .gea-flag--md  .fis { width: 20px; height: 15px; }
.gea-flag--lg  .fi, .gea-flag--lg  .fis { width: 28px; height: 21px; border-radius: 3px; }
.gea-flag--xl  .fi, .gea-flag--xl  .fis { width: 40px; height: 30px; border-radius: 4px; }

/* Round / pill flag — useful for avatar-style placements. */
.gea-flag--round .fi,
.gea-flag--round .fis {
    width: 18px; height: 18px;
    border-radius: 50%;
    background-size: cover; background-position: center;
    box-shadow: inset 0 0 0 1px var(--gea-border-strong);
}
.gea-flag--round.gea-flag--lg .fi,
.gea-flag--round.gea-flag--lg .fis { width: 24px; height: 24px; }

.gea-flag__code {
    font-family: var(--gea-font-mono);
    font-size: var(--gea-text-xs);
    color: var(--gea-text-muted);
    text-transform: uppercase;
    letter-spacing: var(--gea-tracking-wider);
    font-weight: var(--gea-weight-semibold);
}
.gea-flag__name { color: var(--gea-text); }

/* AVATAR */
.gea-avatar {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    flex: none;
    width: 40px; height: 40px;
    background: var(--gea-surface-raised);
    border-radius: 50%;
    color: var(--gea-text);
    font-size: var(--gea-text-sm);
    font-weight: var(--gea-weight-semibold);
    user-select: none;
}
.gea-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.gea-avatar--xs  { width: 20px; height: 20px; font-size: 10px; }
.gea-avatar--sm  { width: 28px; height: 28px; font-size: 11px; }
.gea-avatar--md  { width: 40px; height: 40px; }
.gea-avatar--lg  { width: 56px; height: 56px; font-size: var(--gea-text-md); }
.gea-avatar--xl  { width: 72px; height: 72px; font-size: var(--gea-text-lg); }
.gea-avatar--2xl { width: 96px; height: 96px; font-size: var(--gea-text-xl); }
.gea-avatar--square { border-radius: var(--gea-radius-md); }
.gea-avatar--ring   { box-shadow: 0 0 0 2px var(--gea-bg), 0 0 0 4px var(--gea-brand-500); }
.gea-avatar--brand  { background: var(--gea-brand-500); color: var(--gea-text-on-brand); }

.gea-avatar__status {
    position: absolute; right: 0; bottom: 0;
    width: 12px; height: 12px;
    border: 2px solid var(--gea-bg); border-radius: 50%;
    background: var(--gea-text-subtle);
}
.gea-avatar--lg .gea-avatar__status,
.gea-avatar--xl .gea-avatar__status { width: 14px; height: 14px; }
.gea-avatar__status--online  { background: var(--gea-success); }
.gea-avatar__status--away    { background: var(--gea-warning); }
.gea-avatar__status--busy    { background: var(--gea-danger); }
.gea-avatar__status--offline { background: var(--gea-neutral-500); }

.gea-avatar-group { display: inline-flex; }
.gea-avatar-group .gea-avatar { box-shadow: 0 0 0 2px var(--gea-bg); margin-left: -10px; }
.gea-avatar-group .gea-avatar:first-child { margin-left: 0; }
.gea-avatar-group .gea-avatar--sm { margin-left: -8px; }
.gea-avatar-group .gea-avatar--lg { margin-left: -14px; }
.gea-avatar-group__more { background: var(--gea-surface-overlay); color: var(--gea-text-muted); font-size: var(--gea-text-xs); }

/* BADGE */
.gea-badge {
    display: inline-flex; align-items: center; gap: 6px;
    height: 22px; padding: 0 10px;
    font-family: var(--gea-font-sans);
    font-size: var(--gea-text-xs); font-weight: var(--gea-weight-semibold); line-height: 1;
    /* Reset inherited tracking — badges often sit inside display headings
       which use --tracking-tighter (-0.04em) and crush the badge text. */
    letter-spacing: normal;
    color: var(--gea-text);
    background: var(--gea-surface-raised);
    border: 1px solid var(--gea-border);
    border-radius: var(--gea-radius-full);
    white-space: nowrap;
}
.gea-badge .gea-icon { width: 12px; height: 12px; }
.gea-badge--sm { height: 18px; padding: 0 6px; font-size: 10px; }
.gea-badge--lg { height: 28px; padding: 0 12px; font-size: var(--gea-text-sm); gap: 6px; }
.gea-badge--lg .gea-icon { width: 14px; height: 14px; }
/* Brand soft badge — was cyan-on-cyan which got unreadable on team-hero
   radial glow backgrounds. Now uses pure white text with a solid cyan border
   and only-slightly-tinted bg so contrast holds in any context. */
.gea-badge--brand {
    background: rgba(1, 238, 235, 0.14);
    border-color: var(--gea-brand-500);
    color: #FFFFFF;
}
.gea-badge--brand .gea-icon { color: var(--gea-brand-500); }
.gea-badge--success { background: var(--gea-success-soft); border-color: var(--gea-success-border); color: var(--gea-success); }
.gea-badge--warning { background: var(--gea-warning-soft); border-color: var(--gea-warning-border); color: var(--gea-warning); }
.gea-badge--danger  { background: var(--gea-danger-soft);  border-color: var(--gea-danger-border);  color: var(--gea-danger); }
.gea-badge--solid-brand { background: var(--gea-brand-500); color: var(--gea-text-on-brand); border-color: transparent; }
.gea-badge--outline { background: transparent; border-color: var(--gea-border-strong); color: var(--gea-text-muted); }
.gea-badge--dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.gea-badge--count {
    min-width: 18px; height: 18px; padding: 0 5px; font-size: 10px;
    background: var(--gea-danger); color: #fff; border-color: transparent;
}

/* TAG */
.gea-tag {
    display: inline-flex; align-items: center; gap: var(--gea-space-1-5);
    height: 28px; padding: 0 10px;
    font-size: var(--gea-text-xs); font-weight: var(--gea-weight-medium);
    color: var(--gea-text); background: var(--gea-surface-raised);
    border: 1px solid var(--gea-border); border-radius: var(--gea-radius-md);
}
.gea-tag__remove {
    display: inline-grid; place-items: center;
    width: 14px; height: 14px; border-radius: 50%;
    background: rgba(255,255,255,.08); color: var(--gea-text-muted);
    cursor: pointer;
    transition: background-color .15s var(--gea-ease-out), color .15s var(--gea-ease-out);
}
.gea-tag__remove:hover { background: rgba(255,255,255,.16); color: var(--gea-text); }
.gea-tag__remove .gea-icon { width: 8px; height: 8px; }
.gea-tag--brand { background: rgba(1,238,235,.10); border-color: rgba(1,238,235,.32); color: var(--gea-brand-300); }

/* KBD */
.gea-kbd {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px; padding: 0 6px;
    font-family: var(--gea-font-mono); font-size: var(--gea-text-2xs); font-weight: var(--gea-weight-semibold);
    color: var(--gea-text-muted);
    background: var(--gea-bg-elevated);
    border: 1px solid var(--gea-border); border-bottom-width: 2px;
    border-radius: var(--gea-radius-xs);
}

/* DIVIDER */
.gea-divider { height: 1px; width: 100%; background: var(--gea-divider); border: 0; margin: 0; }
.gea-divider--vertical { width: 1px; height: 100%; }
.gea-divider--label {
    display: flex; align-items: center; gap: var(--gea-space-3);
    color: var(--gea-text-subtle); font-size: var(--gea-text-xs);
    text-transform: uppercase; letter-spacing: var(--gea-tracking-widest);
    background: transparent;
}
.gea-divider--label::before, .gea-divider--label::after { content: ''; flex: 1; height: 1px; background: var(--gea-divider); }

/* TABLE */
.gea-table-wrap {
    width: 100%; overflow-x: auto;
    border: 1px solid var(--gea-border);
    border-radius: var(--gea-radius-lg);
    background: var(--gea-bg-elevated);
    -webkit-overflow-scrolling: touch;
}
/* Subtle scrollbar so users see the table is horizontally scrollable on mobile */
.gea-table-wrap::-webkit-scrollbar { height: 6px; }
.gea-table-wrap::-webkit-scrollbar-track { background: transparent; }
.gea-table-wrap::-webkit-scrollbar-thumb {
    background: var(--gea-border-strong); border-radius: var(--gea-radius-full);
}
.gea-table { width: 100%; border-collapse: collapse; font-size: var(--gea-text-sm); }
.gea-table thead th {
    padding: 12px 16px; text-align: left;
    font-size: var(--gea-text-2xs); font-weight: var(--gea-weight-semibold);
    text-transform: uppercase; letter-spacing: var(--gea-tracking-wider);
    color: var(--gea-text-subtle);
    background: var(--gea-bg-subtle);
    border-bottom: 1px solid var(--gea-border);
    white-space: nowrap;
}
.gea-table tbody td {
    padding: 14px 16px; color: var(--gea-text);
    border-bottom: 1px solid var(--gea-border-subtle);
    vertical-align: middle;
}
.gea-table tbody tr:last-child td { border-bottom: 0; }
.gea-table tbody tr { transition: background-color .15s var(--gea-ease-out); }
.gea-table tbody tr:hover { background: rgba(255,255,255,.025); }
.gea-table .gea-table__rank { font-family: var(--gea-font-mono); font-weight: var(--gea-weight-semibold); color: var(--gea-text-muted); width: 48px; white-space: nowrap; }
.gea-table .gea-table__team { display: inline-flex; align-items: center; gap: var(--gea-space-3); }
.gea-table .gea-table__num { font-family: var(--gea-font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.gea-table tr.is-highlight { background: rgba(1,238,235,.06); box-shadow: inset 3px 0 0 var(--gea-brand-500); }

/* PROGRESS */
.gea-progress { width: 100%; height: 8px; background: var(--gea-surface-overlay); border-radius: var(--gea-radius-full); overflow: hidden; }
.gea-progress__bar { height: 100%; background: var(--gea-brand-500); border-radius: var(--gea-radius-full); transition: width .3s var(--gea-ease-out); }
.gea-progress--sm { height: 4px; }
.gea-progress--lg { height: 12px; }
.gea-progress--success .gea-progress__bar { background: var(--gea-success); }
.gea-progress--warning .gea-progress__bar { background: var(--gea-warning); }
.gea-progress--danger  .gea-progress__bar { background: var(--gea-danger); }
.gea-progress--striped .gea-progress__bar {
    background-image: linear-gradient(135deg, rgba(0,0,0,.18) 25%, transparent 25%, transparent 50%, rgba(0,0,0,.18) 50%, rgba(0,0,0,.18) 75%, transparent 75%, transparent);
    background-size: 16px 16px;
    animation: gea-progress-stripe 1s linear infinite;
}
@keyframes gea-progress-stripe { from { background-position: 16px 0; } to { background-position: 0 0; } }

/* FORM DOTS — visual W/L history (most recent on the right) */
.gea-form-dots { display: inline-flex; gap: 4px; align-items: center; }
.gea-form-dot {
    width: 22px; height: 22px;
    border-radius: var(--gea-radius-xs);
    display: grid; place-items: center;
    font-family: var(--gea-font-mono);
    font-size: 11px;
    font-weight: var(--gea-weight-bold);
    flex: none;
}
.gea-form-dot--w { background: var(--gea-success); color: rgba(0,0,0,.85); }
.gea-form-dot--l { background: var(--gea-danger);  color: #fff; }
.gea-form-dot--d { background: var(--gea-text-subtle); color: var(--gea-bg); }
.gea-form-dot--n { background: var(--gea-surface-overlay); color: var(--gea-text-subtle); }
.gea-form-dots--lg .gea-form-dot { width: 32px; height: 32px; font-size: 14px; border-radius: var(--gea-radius-sm); }

/* TROPHY — single achievement row */
.gea-trophy {
    display: flex; align-items: center; gap: var(--gea-space-3);
    padding: var(--gea-space-3) var(--gea-space-4);
    background: var(--gea-bg-elevated);
    border: 1px solid var(--gea-border);
    border-radius: var(--gea-radius-lg);
    transition: border-color .15s var(--gea-ease-out);
}
.gea-trophy:hover { border-color: var(--gea-border-strong); }
.gea-trophy__icon {
    flex: none;
    display: grid; place-items: center;
    width: 44px; height: 44px;
    border-radius: var(--gea-radius-md);
    background: rgba(255, 176, 32, 0.10);
    color: var(--gea-warning);
}
.gea-trophy__icon .gea-icon { width: 22px; height: 22px; }
.gea-trophy--gold   .gea-trophy__icon { background: rgba(255, 200, 32, 0.14);  color: #FFD24D; box-shadow: 0 0 16px -4px rgba(255, 200, 32, 0.45); }
.gea-trophy--silver .gea-trophy__icon { background: rgba(220, 220, 220, 0.10); color: #DCDCDC; }
.gea-trophy--bronze .gea-trophy__icon { background: rgba(205, 127, 50, 0.10);  color: #E89B5C; }
.gea-trophy__info  { flex: 1; min-width: 0; }
.gea-trophy__title { font-size: var(--gea-text-sm); font-weight: var(--gea-weight-semibold); color: var(--gea-text); }
.gea-trophy__sub   { font-size: var(--gea-text-xs); color: var(--gea-text-subtle); margin-top: 2px; }
.gea-trophy__year  { font-family: var(--gea-font-mono); font-size: var(--gea-text-xs); color: var(--gea-text-muted); flex: none; }

/* STAT */
.gea-stat {
    display: flex; flex-direction: column; gap: var(--gea-space-1);
    padding: var(--gea-space-5);
    background: var(--gea-bg-elevated);
    border: 1px solid var(--gea-border);
    border-radius: var(--gea-radius-lg);
}
.gea-stat__label {
    font-size: var(--gea-text-xs); text-transform: uppercase; letter-spacing: var(--gea-tracking-wider);
    color: var(--gea-text-subtle); font-weight: var(--gea-weight-semibold);
}
.gea-stat__value {
    font-family: var(--gea-font-display);
    font-size: var(--gea-text-3xl); font-weight: var(--gea-weight-bold);
    letter-spacing: var(--gea-tracking-tight);
    color: var(--gea-text); line-height: 1;
}
.gea-stat__delta { display: inline-flex; align-items: center; gap: var(--gea-space-1); font-size: var(--gea-text-sm); font-weight: var(--gea-weight-semibold); }
.gea-stat__delta--up   { color: var(--gea-success); }
.gea-stat__delta--down { color: var(--gea-danger); }

/* ============== CHIP ==============
   Pill-shaped tag-style element for filters, game lists, recent
   searches, etc. Default = subtle bg, .is-active = brand-tinted.
   Wraps content in a row with a small gap so an icon + label work
   without extra wrapper markup. */
.gea-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--gea-space-1-5);
    padding: 6px 12px;
    border-radius: var(--gea-radius-full);
    border: 1px solid var(--gea-border);
    background: var(--gea-bg-elevated);
    color: var(--gea-text-muted);
    font-size: var(--gea-text-xs);
    font-weight: var(--gea-weight-medium);
    text-decoration: none;
    transition: background-color .15s var(--gea-ease-out),
                border-color .15s var(--gea-ease-out),
                color .15s var(--gea-ease-out);
    white-space: nowrap;
}
.gea-chip:hover {
    border-color: var(--gea-border-strong);
    color: var(--gea-text);
}
.gea-chip.is-active {
    background: rgba(1, 238, 235, .12);
    border-color: rgba(1, 238, 235, .35);
    color: var(--gea-brand-300);
}

/* ============== TAB COUNT BADGE ==============
   Small numeric badge next to a tab label — shows the result count
   for that filter without making the tab itself wider. */
.gea-tab__count {
    margin-left: var(--gea-space-2);
    padding: 2px 7px;
    background: var(--gea-surface);
    border-radius: var(--gea-radius-full);
    font-size: var(--gea-text-2xs);
    font-weight: var(--gea-weight-bold);
    color: var(--gea-text-muted);
    font-variant-numeric: tabular-nums;
}
.gea-tab.is-active .gea-tab__count {
    background: rgba(1, 238, 235, .2);
    color: var(--gea-brand-300);
}

/* ============== MARKDOWN CONTENT ==============
   Renders the output of App\Support\SimpleMarkdown — used for tournament
   rules, descriptions, and any other markdown surface. Tight typographic
   rhythm built on --gea-space-* scale, brand-coloured links, code chips. */
.gea-md-content {
    color: var(--gea-text);
    font-size: var(--gea-text-md);
    line-height: var(--gea-leading-relaxed, 1.7);
}
.gea-md-content > * + * { margin-top: var(--gea-space-3); }
.gea-md-content > h2,
.gea-md-content > h3,
.gea-md-content > h4 { margin-top: var(--gea-space-5); margin-bottom: var(--gea-space-2); }
.gea-md-heading {
    font-family: var(--gea-font-display, inherit);
    color: var(--gea-text);
    font-weight: var(--gea-weight-semibold);
    letter-spacing: -0.01em;
}
.gea-md-content h2.gea-md-heading { font-size: var(--gea-text-xl); }
.gea-md-content h3.gea-md-heading { font-size: var(--gea-text-lg); }
.gea-md-content h4.gea-md-heading { font-size: var(--gea-text-md); color: var(--gea-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.gea-md-content p { margin: 0; }
.gea-md-content a {
    color: var(--gea-brand-400);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.gea-md-content a:hover { color: var(--gea-brand-300); }
.gea-md-content strong { color: var(--gea-text); font-weight: var(--gea-weight-bold); }
.gea-md-content em { font-style: italic; color: var(--gea-text); }
.gea-md-list {
    margin: 0;
    padding-left: var(--gea-space-5);
}
.gea-md-list li { margin-top: var(--gea-space-1); }
.gea-md-list li::marker { color: var(--gea-brand-500); }
.gea-md-quote {
    margin: 0;
    padding: var(--gea-space-3) var(--gea-space-4);
    border-left: 3px solid var(--gea-brand-500);
    background: var(--gea-surface-1);
    border-radius: var(--gea-radius-sm);
    color: var(--gea-text-muted);
}
.gea-md-quote p { margin: 0; }
.gea-md-code {
    background: var(--gea-surface-2, #0d1117);
    border: 1px solid var(--gea-border-2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--gea-font-mono, monospace);
    font-size: 0.9em;
    color: var(--gea-brand-300);
}
.gea-md-content hr {
    border: 0;
    border-top: 1px solid var(--gea-border-2);
    margin: var(--gea-space-5) 0;
}
