/* =====================================================================
   30 - COMPONENTS
   Buttons, cards, forms, tables, alerts, chips, pagination, toggles.
   Old template classes (.btn-asia, .bg-asia, .table-dark...) are styled
   here too, so every page gets the theme without being rewritten.
   ===================================================================== */

/* ---------- Buttons --------------------------------------------------
   WarZ style: solid worn-paint blocks with torn edges.
   - Shape  : mask = assets/img/ui/edge.svg (rough rectangle)
   - Texture: assets/img/ui/grunge.png over the colour
   Both files come from tools/make_ui_textures.py.
   ---------------------------------------------------------------------- */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 10px 22px;
    font-family: var(--font);
    font-size: 16px;
    font-weight: 700;
    font-stretch: var(--stretch-tight);
    letter-spacing: .3px;
    line-height: 1.2;
    border: 0;
    border-radius: 0;
    -webkit-mask: var(--mask-edge) 0 0 / 100% 100% no-repeat;
    mask: var(--mask-edge) 0 0 / 100% 100% no-repeat;
    transition: transform .2s var(--ease-out), filter .25s, background-color .25s, color .2s;
}
.btn i { font-size: .95em; margin: 0 !important; }
.btn:focus, .btn.focus { box-shadow: none; }
.btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; -webkit-mask: none; mask: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .4; filter: grayscale(.7); transform: none !important; }
.btn-block { display: flex; width: 100%; }

.btn-lg { padding: 14px 32px; font-size: 20px; }
.btn-sm { padding: 6px 14px; font-size: 14px; }
.btn-xs { padding: 4px 11px; font-size: 13px; font-weight: 600; }

/* Primary: worn crimson */
.btn-asia, .btn-primary-x {
    color: #fff !important;
    background: var(--tex-grunge) 0 0 / 260px repeat, linear-gradient(180deg, var(--accent-hot), var(--accent) 55%, var(--accent-dark));
    text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}
.btn-asia:hover, .btn-primary-x:hover { filter: brightness(1.18) saturate(1.1); transform: translateY(-2px); }

/* Secondary: worn charcoal, turns crimson on hover */
.btn-ghost, .btn-outline-secondary {
    color: var(--text) !important;
    background: var(--tex-grunge) 0 0 / 260px repeat, linear-gradient(180deg, #2b2b31, #19191d);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.btn-ghost:hover, .btn-outline-secondary:hover {
    color: #fff !important;
    background: var(--tex-grunge) 0 0 / 260px repeat, linear-gradient(180deg, var(--accent-hot), var(--accent) 55%, var(--accent-dark));
    transform: translateY(-2px);
}
.btn-outline-secondary { color: var(--text-dim) !important; }

.btn-success { color: #04170e !important; background: var(--tex-grunge) 0 0 / 260px repeat, linear-gradient(180deg, #53e7a8, #1e9e69); }
.btn-danger { color: #fff !important; background: var(--tex-grunge) 0 0 / 260px repeat, linear-gradient(180deg, #e8424b, #9d151b); }
.btn-success:hover, .btn-danger:hover { filter: brightness(1.12); }

/* ---------- Big action tiles (hero / call to action) ------------------
   <x-cta-tile route="register" icon="fas fa-skull" title="..." sub="..." />
   Large icon, condensed title, small line under it - like WarZ's hero buttons.
   ---------------------------------------------------------------------- */
.cta-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.cta-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 250px;
    padding: 14px 28px 14px 20px;
    color: #fff !important;
    text-align: left;
    background: var(--tex-grunge) 0 0 / 260px repeat, linear-gradient(180deg, var(--accent-hot), var(--accent) 55%, var(--accent-dark));
    -webkit-mask: var(--mask-edge) 0 0 / 100% 100% no-repeat;
    mask: var(--mask-edge) 0 0 / 100% 100% no-repeat;
    transition: transform .25s var(--ease-out), filter .25s;
}
.cta-tile:hover { transform: translateY(-3px); filter: brightness(1.15); }
/* Dark tile: game art (assets/img/ui/tile-art.jpg) under a smoky fade + crimson base line */
.cta-tile.is-dark {
    background:
        linear-gradient(0deg, var(--accent) 0 4px, transparent 4px),
        var(--tex-grunge) 0 0 / 260px repeat,
        linear-gradient(90deg, rgba(8, 8, 10, .8) 15%, rgba(8, 8, 10, .25) 75%, rgba(60, 6, 10, .2)),
        var(--tile-art) center / cover;
}
.cta-tile.is-dark:hover { filter: brightness(1.25); }
.cta-tile-icon { flex: none; width: 46px; text-align: center; font-size: 38px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .5)); }
.cta-tile-title { display: block; font-size: 30px; font-weight: 800; font-stretch: var(--stretch-tight); line-height: 1; text-shadow: 0 2px 3px rgba(0, 0, 0, .45); }
.cta-tile-sub { display: block; margin-top: 4px; font-size: 14px; font-weight: 600; font-stretch: var(--stretch-tight); opacity: .9; }

/* ---------- Worn tab buttons (news filter etc.) ----------------------
   Grey worn-paint plates with torn edges; the active one turns crimson.
   ---------------------------------------------------------------------- */
.worn-tabs { display: flex; flex-wrap: wrap; gap: 10px; }
.worn-tabs button, .worn-tabs a {
    min-width: 150px;
    padding: 9px 22px;
    border: 0;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    font-stretch: var(--stretch-tight);
    text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
    background: var(--tex-grunge) 0 0 / 220px repeat, linear-gradient(180deg, #7a7a80, #55555b 60%, #46464b);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .12);
    -webkit-mask: var(--mask-edge) 0 0 / 100% 100% no-repeat;
    mask: var(--mask-edge) 0 0 / 100% 100% no-repeat;
    transition: transform .2s var(--ease-out), filter .2s;
}
.worn-tabs a { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.worn-tabs button:hover, .worn-tabs a:hover { filter: brightness(1.18); transform: translateY(-2px); }
.worn-tabs button.active, .worn-tabs a.active { background: var(--tex-grunge) 0 0 / 260px repeat, linear-gradient(180deg, var(--accent-hot), var(--accent) 55%, var(--accent-dark)); box-shadow: none; }
.worn-tabs button:focus:not(:focus-visible) { outline: none; }

/* ---------- Cards / panels -------------------------------------------
   Flat charcoal plate with a crimson top line (WarZ style).
   .card-header gets a crimson tick on the left; put an icon in it if you like.
   ---------------------------------------------------------------------- */
.card, .bg-asia, .panel {
    background: var(--plate) !important;   /* charcoal with a faint top light (00-tokens.css) */
    border: 1px solid var(--line) !important;
    border-top: 3px solid var(--accent) !important;
    border-radius: 0 !important;
    box-shadow: var(--plate-hi), 0 14px 34px rgba(0, 0, 0, .3);
    color: var(--text);
}
.card, .panel { position: relative; }
.card { transition: border-color .3s; }
.card:hover { border-color: var(--line-strong) !important; border-top-color: var(--accent-hot) !important; }
.card-header {
    padding: 14px 20px;
    color: #fff !important;
    font-size: 18px;
    font-weight: 700;
    font-stretch: var(--stretch-tight);
    background: linear-gradient(90deg, rgba(184, 19, 27, .12), transparent 60%) !important;
    border-bottom: 1px solid var(--line) !important;
    box-shadow: inset 4px 0 0 var(--accent);
}
.card-header .card-title, .card-header h5, .card-header h3 { margin: 0; font-size: inherit; font-weight: inherit; }
.card-header i { color: var(--accent-hot); margin-right: 8px; }
.card-footer { background: transparent !important; border-top: 1px solid var(--line) !important; }
.card-header.d-flex::after { display: none; } /* AdminLTE clearfix would become a flex item */
.panel { padding: 22px; }

/* ---------- Tables ---------------------------------------------------- */
.table { color: var(--text); margin-bottom: 0; }
.table-dark { background: transparent !important; }
.table th, .table td { padding: 12px 16px; vertical-align: middle; background: transparent; border-color: var(--line) !important; }
.table-sm th, .table-sm td { padding: 9px 14px; }
.table thead th {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent-2) !important;
    background: rgba(255, 255, 255, .025);
    border-top: 0 !important;
    border-bottom: 1px solid var(--line-strong) !important;
}
.table tbody tr { transition: background .2s; }
.table tbody tr:nth-child(even) { background: rgba(255, 255, 255, .015); }
.table tbody tr:hover { background: rgba(184, 19, 27, .08); }

/* ---------- Worn icon badge + <x-stat> -------------------------------- */
.stat-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    color: #fff;
    font-size: 24px;
    background: var(--tex-grunge) 0 0 / 200px repeat, linear-gradient(180deg, var(--accent-hot), var(--accent) 55%, var(--accent-dark));
    -webkit-mask: var(--mask-edge) 0 0 / 100% 100% no-repeat;
    mask: var(--mask-edge) 0 0 / 100% 100% no-repeat;
    filter: drop-shadow(0 4px 10px rgba(184, 19, 27, .35));
}
.stat-icon.is-green, .is-green > .stat-icon { background: var(--tex-grunge) 0 0 / 200px repeat, linear-gradient(180deg, #4be3a2, #1d8f5f); }
.stat-icon.is-bone, .is-bone > .stat-icon { color: #1a160e; background: var(--tex-grunge) 0 0 / 200px repeat, linear-gradient(180deg, #efe3c4, #a9997a); }
.stat-box {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 100%;
    padding: 18px 20px;
    background: var(--plate);
    box-shadow: var(--plate-hi);
    border: 1px solid var(--line);
    border-top: 3px solid var(--accent);
}
.stat-box.is-green { border-top-color: #2fbf83; }
.stat-box.is-bone { border-top-color: var(--accent-2); }
.stat-box-value { color: #fff; font-family: var(--font-display); font-size: 34px; line-height: 1; letter-spacing: 1px; }
.stat-box-label { margin-top: 4px; color: var(--text-dim); font-size: 14px; font-weight: 600; }

/* ---------- Forms ----------------------------------------------------- */
.form-control, select.form-control {
    height: auto;
    padding: 11px 14px;
    color: #fff !important;
    background: rgba(6, 6, 8, .55) !important;
    border: 1px solid var(--line-strong);
    border-radius: 2px;
    transition: border-color .2s, box-shadow .2s;
}
.form-control-sm { padding: 6px 10px; border-radius: 2px; }
.form-control::placeholder { color: var(--text-faint); }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(184, 19, 27, .18), inset 0 -2px 0 var(--accent); }
select.form-control option { background: var(--ink-850); }
label { margin-bottom: 6px; color: var(--text-dim); font-size: 14px; font-weight: 400; }

/* Input with a leading icon: <div class="input-icon"><i class="fas fa-..."></i><input class="form-control"></div> */
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; transition: color .2s; }
.input-icon > .form-control { padding-left: 42px; }
.input-icon:focus-within > i { color: var(--accent-hot); }

.otp-input { font-family: var(--font-display); font-size: 2.2rem !important; letter-spacing: .6rem; text-align: center; }
.icheck-muted > input:first-child:checked + label::before { background: var(--accent) !important; border-color: var(--accent) !important; }

/* ---------- Alerts & toasts ------------------------------------------ */
.alert { border: 1px solid; border-left-width: 3px; border-radius: 2px; }
.alert-danger { color: #ffd1d5; background: rgba(255, 77, 90, .12); border-color: rgba(255, 77, 90, .4); }
.alert-success { color: #d2ffeb; background: rgba(61, 220, 151, .12); border-color: rgba(61, 220, 151, .4); }
.alert-warning { color: #ffeab0; background: rgba(255, 203, 71, .1); border-color: rgba(255, 203, 71, .35); }
.close { color: #fff; text-shadow: none; opacity: .6; }
.flash-wrap { position: fixed; top: calc(var(--nav-h) + 10px); right: 16px; z-index: 1080; max-width: 420px; }
.flash-wrap .alert { box-shadow: var(--shadow); animation: toast-in .5s var(--ease-out) both; }

/* ---------- Chips / badges ------------------------------------------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 2px; font-size: 11px; font-weight: 500; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-dim); border: 1px solid var(--line-strong); }
.chip-dot { font-size: 7px; }
.chip.ok { color: var(--ok); border-color: rgba(61, 220, 151, .4); background: rgba(61, 220, 151, .08); }
.chip.bad { color: var(--danger); border-color: rgba(255, 77, 90, .4); background: rgba(255, 77, 90, .08); }
.chip.gold { color: var(--accent-2); border-color: rgba(214, 199, 165, .45); background: rgba(214, 199, 165, .1); }
.badge-warning { color: var(--accent-ink); background: var(--accent-2); }

/* ---------- Pagination ------------------------------------------------ */
.pagination .page-link { color: var(--text-dim); background: rgba(255, 255, 255, .03); border-color: var(--line); border-radius: 0 !important; }
.pagination .page-item.active .page-link { color: #fff; background: var(--accent); border-color: var(--accent); }
.pagination .page-item.disabled .page-link { color: var(--text-faint); background: transparent; border-color: var(--line); }

/* ---------- Key/value rows & small boxes (admin) ------------------------------ */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 14px; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv > span:first-child { flex: none; color: var(--text-dim); white-space: nowrap; }   /* the label never breaks mid-word */

.small-box { overflow: hidden; color: #fff; border-radius: 0; border: 1px solid var(--line); border-top: 3px solid var(--accent); background: var(--plate) !important; box-shadow: var(--plate-hi); }
.small-box-dollar { border-top-color: var(--accent-2); }
.small-box .inner h4, .small-box .inner h5 { margin: 0; font-family: var(--font-display); font-size: 34px; letter-spacing: 1px; }
.small-box .icon { color: rgba(184, 19, 27, .25); }

/* ---------- Music toggle --------------------------------------------- */
.audio-control {
    position: fixed;
    right: 18px; bottom: 18px;
    z-index: 1040;
    display: grid;
    place-items: center;
    width: 48px; height: 48px;
    color: var(--text-dim);
    background: rgba(17, 17, 20, .8);
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    transition: all .3s;
}
.audio-control:hover { color: #fff; border-color: var(--accent); }
.audio-control.is-playing { color: var(--accent-hot); animation: pulse-accent 2s infinite; }
/* phones / tablets: in the top bar beside the menu button, so it never covers the page (top-up timer, buttons) */
@media (max-width: 991.98px) {
    .audio-control { top: 14px; bottom: auto; right: calc(clamp(16px, 4vw, 48px) + 50px); width: 40px; height: 40px; font-size: 15px; transition: top .35s, opacity .3s, color .3s, border-color .3s; }
    body:has(.site-nav.is-scrolled) .audio-control { top: 10px; }
    body:has(.nav-bell) .audio-control { right: calc(clamp(16px, 4vw, 48px) + 92px); }   /* signed in: the bell sits beside the menu button too */
    .nav-open .audio-control { opacity: 0; pointer-events: none; }
}

/* ---------- Misc legacy ------------------------------------------------ */
.qr-image { max-width: 260px; border-radius: 2px; box-shadow: 0 0 0 6px rgba(255, 255, 255, .06), var(--glow); }
.embed-responsive { border-radius: var(--radius); }

/* Table cell that cuts long text with "..." */
.cell-truncate { max-width: 180px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.min-w-0 { min-width: 0; }

/* ---------- Full-size picture viewer ([data-lightbox], js/ui/misc.js) ---------- */
.img-zoom {
    position: absolute; z-index: 4; right: 10px; top: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px;
    color: #fff; font-size: 15px;
    background: rgba(8, 8, 10, .72);
    border: 1px solid rgba(255, 255, 255, .22);
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    opacity: 0; transform: translateY(-4px);
    transition: opacity .25s, transform .25s, background .2s, border-color .2s;
    cursor: zoom-in;
}
.img-zoom:hover, .img-zoom:focus-visible { background: var(--accent); border-color: var(--accent-hot); outline: none; }
*:hover > .img-zoom, .img-zoom:focus-visible { opacity: 1; transform: none; }
@media (hover: none) { .img-zoom { opacity: 1; transform: none; } }

.lightbox {
    position: fixed; inset: 0; z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    padding: 56px 64px;
    background: rgba(4, 4, 6, .92);
    backdrop-filter: blur(6px);
    animation: lb-fade .2s ease-out;
}
.lightbox[hidden] { display: none; }
.lightbox-open { overflow: hidden; }
.lightbox-figure { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; margin: 0; }
.lightbox-cap { margin-top: 14px; color: #fff; font-size: 15px; text-align: center; }
.lightbox-count { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); color: var(--text-faint); font-family: var(--font-display); letter-spacing: 2px; }
.lightbox-close, .lightbox-nav {
    position: absolute; display: inline-flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; color: #fff; font-size: 18px;
    background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .18);
    transition: background .2s, border-color .2s;
}
.lightbox-close:hover, .lightbox-nav:hover { background: var(--accent); border-color: var(--accent-hot); }
.lightbox-close { top: 12px; right: 12px; }
.lightbox-nav { top: 50%; transform: translateY(-50%); }
.lightbox-nav.is-prev { left: 10px; }
.lightbox-nav.is-next { right: 10px; }
.lightbox-nav[hidden], .lightbox-count[hidden], .lightbox-cap[hidden] { display: none; }
@keyframes lightbox-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 575.98px) {
    .lightbox { padding: 56px 8px 48px; }
    .lightbox-nav { top: auto; bottom: 6px; transform: none; width: 40px; height: 40px; }
}

/* lightbox with details (news): picture left, details right; stacked on phones */
.lightbox-frame { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; min-height: 0; width: 100%; height: 100%; }
.lightbox-frame img { max-width: 100%; max-height: calc(100% - 44px); object-fit: contain; border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 30px 80px rgba(0, 0, 0, .7), 0 0 0 1px rgba(184, 19, 27, .25); animation: lightbox-in .3s var(--ease-out); }
.lightbox.has-detail .lightbox-figure { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 0; max-width: 1280px; height: auto; max-height: 100%; background: linear-gradient(180deg, #151517, #0d0d0f); border: 1px solid var(--line-strong); box-shadow: 0 40px 90px rgba(0, 0, 0, .7); }
.lightbox.has-detail .lightbox-frame { padding: 0; background: #08080a; }
.lightbox.has-detail .lightbox-frame img { max-height: calc(100vh - 140px); border: 0; box-shadow: none; }
.lightbox-detail { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 26px 24px; overflow-y: auto; max-height: calc(100vh - 140px); border-left: 1px solid var(--line); animation: lb-fade .35s ease-out; }
.lightbox-detail::before { content: ''; position: absolute; left: -1px; top: 0; width: 3px; height: 64px; background: var(--accent-hot); }
.lightbox-detail[hidden] { display: none; }
.lb-tag { display: inline-flex; align-items: center; gap: 8px; color: var(--accent-hot); font-size: 13px; font-weight: 700; letter-spacing: 1px; }
.lb-title { margin: 0; color: #fff; font-family: var(--font-display); font-size: 30px; font-weight: 400; letter-spacing: 1px; line-height: 1.1; }
.lb-date { color: var(--text-faint); font-size: 13px; }
.lb-text { margin: 6px 0 0; color: var(--text); font-size: 15px; line-height: 1.75; white-space: pre-line; }
.lb-link { align-self: flex-start; margin-top: auto; }
@media (max-width: 991.98px) {
    .lightbox.has-detail { align-items: flex-start; overflow-y: auto; }
    .lightbox.has-detail .lightbox-figure { grid-template-columns: minmax(0, 1fr); }
    .lightbox.has-detail .lightbox-frame img { max-height: 55vh; }
    .lightbox-detail { max-height: none; border-left: 0; border-top: 1px solid var(--line); }
    .lightbox-detail::before { top: -1px; left: 0; width: 64px; height: 3px; }
}
