/* static/css/boss_tracker.css
   Neutro de propósito: usa currentColor e tons translúcidos, então herda o
   tema claro/escuro do site (text-theme-change). */

.bt { max-width: 1200px; margin: 24px auto; padding: 0 16px; display: grid; gap: 20px; }

/* ---------- filtros: barra única + painel recolhível ----------
   Mesmos tokens do items.css (.items-toolbar / .ibtn / .fchip).
   Variáveis opcionais: --items-sticky-top (navbar), --color-accent, --item-card-pad */
.bt {
    --i-border: rgba(128, 128, 128, .34);
    --i-fill: rgba(128, 128, 128, .13);
    --i-accent: var(--color-accent, #4d8dff);
}
.bt *, .bt *::before, .bt *::after { box-sizing: border-box; }
.bt [hidden] { display: none !important; }

.bt-filterbox {
    position: sticky;
    top: calc(var(--items-sticky-top, 0px) + 8px + 90px);   /* +90px = navbar */
    z-index: 900;
    margin: 8px auto 30px auto;
    width: 1000px;
    max-width: min(90vw, 1600px);
    border-radius: 16px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, .25), 0 1px 2px rgba(0, 0, 0, .2);
}
/* a barra não deve "crescer" no hover do card_blank */
.bt-filterbox > *:hover,
.bt-filterbox > * { transform: none !important; transition: background-color .2s ease !important; }
.bt-filterbox > * { width: 100%; max-width: none; margin: 0; background: var(--card-color, var(--i-fill)) !important; }

.bt-filters { display: block; padding: 6px 8px; margin: calc(-1 * var(--item-card-pad, 20px)); }

.bt-bar { display: flex; align-items: center; gap: 8px; }

/* campos */
.bt-search { position: relative; flex: 1 1 200px; min-width: 0; }
.bt-search input[type="search"],
.bt-select {
    width: 100%; min-height: 42px; padding: 0 12px;
    font: inherit; font-size: 16px;            /* 16px evita zoom no iOS */
    color: inherit; background: var(--i-fill);
    border: 1px solid var(--i-border); border-radius: 10px;
}
.bt-search input[type="search"] { padding-right: 38px; }
.bt-search input::placeholder { color: inherit; opacity: .55; }
.bt-search input[type="search"]::-webkit-search-cancel-button,
.bt-search input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.bt .bt-select {
    width: auto; height: 42px; padding-right: 30px;
    -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'/></svg>");
    background-repeat: no-repeat; background-position: right 10px center;
}
.bt-select option { color: #111; background: #fff; }

.bt-search__clear {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px; display: grid; place-items: center; padding: 0;
    font-size: 16px; color: inherit; background: none; border: 0; border-radius: 50%;
    opacity: .7; cursor: pointer;
}
.bt-search__clear:hover { opacity: 1; background: var(--i-border); }

/* botões */
.bt-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 42px; padding: 0 12px; font: inherit; font-size: 15px; color: inherit;
    background: var(--i-fill); border: 1px solid var(--i-border); border-radius: 10px;
    cursor: pointer; white-space: nowrap;
}
.bt-btn:hover { border-color: var(--i-accent); }
.bt-btn--icon { width: 42px; padding: 0; }
.bt-btn[aria-pressed="true"],
.bt-btn[aria-expanded="true"],
.bt-btn--primary { color: #fff; background: var(--i-accent); border-color: transparent; }

.bt-badge {
    display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
    font-size: 12px; font-weight: 700; color: #fff; background: var(--i-accent); border-radius: 10px;
}
.bt-view { display: flex; gap: 4px; }

.bt-link {
    padding: 6px 4px; font: inherit; font-size: 14px; color: inherit;
    text-decoration: underline; background: none; border: 0; opacity: .8; cursor: pointer;
}
.bt-link:hover { opacity: 1; }

/* status */
.bt-status {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-top: 8px; padding: 0 4px; font-size: 13px;
}
.bt-muted { opacity: .65; }

/* painel */
.bt-panel {
    max-height: min(62vh, 560px); margin-top: 10px; padding-top: 12px;
    overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--i-border);
}
.bt-panel__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); gap: 16px 24px; }
.bt-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.bt-group--wide { grid-column: 1 / -1; }
.bt-group legend { padding: 0; margin-bottom: 8px; font-size: 14px; font-weight: 600; }

/* chips (iguais ao .fchip) */
.bt-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bt-chip {
    display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 0 11px;
    font: inherit; font-size: 14px; color: inherit; user-select: none; cursor: pointer;
    background: var(--i-fill); border: 1px solid var(--i-border); border-radius: 999px;
    transition: background-color .12s, border-color .12s;
}
.bt-chip i { font-style: normal; }
.bt-chip small { font-size: 11px; opacity: .6; }
.bt-chip:hover { border-color: var(--i-accent); }
.bt-chip[aria-pressed="true"] {
    font-weight: 600;
    background: color-mix(in srgb, var(--i-accent) 32%, transparent);
    border-color: var(--i-accent);
}

.bt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.bt :is(button, input, select):focus-visible,
.boss__stretched-link:focus-visible { outline: 2px solid var(--i-accent); outline-offset: 2px; }

/* mobile: busca + lista/grid em cima, filtros + mundo + ordenação embaixo; barra deixa de ser sticky */
@media (max-width: 640px) {
    .bt-filterbox { top: calc(var(--items-sticky-top, 0px) + 4px + 90px); }
    .bt-filters { padding: 4px 6px; }
    .bt-bar {
        display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas: "search search view" "filters world sort"; gap: 8px;
    }
    .bt-search { grid-area: search; }
    .bt-view { grid-area: view; }
    .bt-btn--filters { grid-area: filters; }
    #bt-world { grid-area: world; min-width: 0; width: 100%; }
    #bt-sort { grid-area: sort; min-width: 0; }
    .bt-btn, .bt-search input[type="search"] { min-height: 44px; }
    .bt .bt-select { height: 44px; }
    .bt-btn--icon { width: 44px; }
    .bt-panel { max-height: 58dvh; }
    .bt-chip { min-height: 38px; }
}
@media (max-width: 380px) { .bt-btn__label { display: none; } }
/* relative (não static): static ignora z-index e os cards (position: relative) passariam por cima do painel aberto */
@media (max-width: 640px), (max-height: 640px) { .bt-filterbox { position: relative; top: auto; } }

/* ---------- grade / lista ---------- */
.boss-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.boss-grid[data-view="list"] { grid-template-columns: 1fr; width: 100%; max-width: min(100%, 1000px); margin-inline: auto; }   /* 1000px = largura da barra de filtros */
.boss[hidden] { display: none; }
/* cada card vira seu próprio contexto de empilhamento: o z-index interno do card_blank/hover
   não vaza e não passa por cima da barra de filtros sticky */
.boss { position: relative; z-index: 0; }
.boss:hover, .boss:focus-within { z-index: 1; }
.bt-empty { text-align: center; padding: 32px 0; opacity: .8; }

/* ---------- card ---------- */
.boss__inner {
    padding: 16px; display: grid; gap: 12px;
    grid-template-columns: max-content 1fr; align-items: start;
}
.boss__stretched-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }

/* Hover e clique no card blank INTEIRO: o alvo é o elemento raiz que o card() gera
   (primeiro filho do <article class="boss">). O link cobre esse mesmo elemento. */
.boss > :first-child {
    position: relative;
    background: var(--card-color);
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.boss > :first-child:hover,
.boss > :first-child:focus-within {
    transform: var(--card-hover-scale);
    box-shadow: var(--card-hover-shadow);
    background: var(--card-hover-highlight);
    z-index: 5;
}
@media (prefers-reduced-motion: reduce) {
    .boss > :first-child, .boss > :first-child:hover, .boss > :first-child:focus-within { transition: none; transform: none; }
}
.boss__media { grid-row: span 2; }
.boss__media { min-width: 64px; display: flex; justify-content: center; }
.boss__media img {
    width: auto; height: auto; max-width: none;   /* tamanho original do sprite */
    image-rendering: crisp-edges;                  /* fallback */
    image-rendering: pixelated;
}
.boss__name { margin: 0 0 6px; font-size: 1.05rem; line-height: 1.2; }
.boss__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.boss__inner > :not(.boss__media):not(.boss__head):not(.boss__stretched-link) { grid-column: 1 / -1; }

.chip {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
    font-size: .75rem; background: rgba(127,127,127,.2); border: 0;
}
.boss__kind--boss { background: rgba(200,70,70,.28); }
.boss__kind--creature { background: rgba(70,150,200,.28); }

/* chance: azul (baixa) -> verde (alta) */
.boss__chance { --hue: calc(215 - var(--p) * .8); display: grid; gap: 6px; }
.boss__chance-top { display: flex; align-items: baseline; gap: 10px; }
.boss__chance-value { font-size: 1.9rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.boss__chance-label { font-size: .8rem; opacity: .75; }
.boss__bar { height: 6px; border-radius: 3px; background: rgba(127,127,127,.25); overflow: hidden; }
.boss__bar i { display: block; height: 100%; width: calc(var(--p) * 1%); background: hsl(var(--hue) 65% 50%); }
.boss[data-status="sem_dados"] .boss__bar i,
.boss[data-status="nunca_visto"] .boss__bar i { width: 0; }
.boss__status { margin: 0; font-size: .8rem; opacity: .8; }

.boss__stats { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.boss__stats .stat { display: grid; gap: 2px; }
.boss__stats dt { font-size: .72rem; opacity: .65; }
.boss__stats dd { margin: 0; font-size: .92rem; font-variant-numeric: tabular-nums; }
.boss__stats small { opacity: .65; margin-left: 4px; }


/* lista: card em linha no desktop */
@media (min-width: 760px) {
    .boss-grid[data-view="list"] .boss__inner {
        grid-template-columns: minmax(64px, max-content) minmax(180px, 1.2fr) minmax(200px, 1.4fr) minmax(260px, 2fr);
        align-items: center;
    }
    .boss-grid[data-view="list"] .boss__media { grid-row: auto; }
    .boss-grid[data-view="list"] .boss__inner > :not(.boss__media):not(.boss__head):not(.boss__stretched-link) { grid-column: auto; }
}

