/* NPCs — diretório em 2 painéis, PLANO (sem caixa dentro de caixa). A página
   já vive dentro do #content_text do site, então aqui não há containers com
   fundo/borda próprios: só seções separadas por divisórias finas + tipografia.
   Categorias à esquerda, lista da categoria à direita; no mobile a coluna de
   categorias vira uma faixa rolável no topo. Paleta slate + dourado do site. */

.npc-page {
    --n-bg-soft:       rgba(0, 0, 0, 0.22);
    --n-border:        rgba(148, 163, 184, 0.16);
    --n-border-strong: rgba(148, 163, 184, 0.30);
    --n-accent:        #94a3b8;
    --n-accent-hi:     #cbd5e1;
    --n-text:          #e2e8f0;
    --n-text-soft:     rgba(226, 232, 240, 0.62);
    --n-text-mute:     rgba(226, 232, 240, 0.42);
    --n-gold:          #ffd479;
    /* Ícone de NPC = 2 tons: manto (--npc-fill) azul quase preto + detalhe
       interno (currentColor) claro. Precisam diferir senão o detalhe some. */
    --npc-robe:        #0f1a30;
    --npc-detail:      #c4d0e4;
    color: var(--n-text);
    padding: 0 12px;
    /* Respiro acima ao rolar pro topo (scrollIntoView no detalhe do NPC) — não
       cola o título no topo do viewport. */
    scroll-margin-top: 40px;
}

.npc-page .page-intro {
    color: var(--n-text-soft);
    margin: 0 0 16px;
    max-width: 720px;
    font-size: 13px;
}

/* Atributo `hidden` precisa vencer os `display:flex/grid` das classes (mesma
   especificidade → senão a caixa do outfit/etc aparece vazia mesmo "hidden"). */
.npc-page [hidden] { display: none !important; }

/* =========================================================
   SEARCH — plano, sem caixa (só o campo)
   ========================================================= */
.npc-search { margin: 0 0 18px; }
.npc-search__field {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 460px;
}
.npc-search__icon {
    position: absolute;
    left: 11px;
    width: 18px;
    height: 18px;
    color: var(--npc-detail);
    --npc-fill: var(--npc-robe);
    pointer-events: none;
    opacity: 0.85;
}
.npc-search input {
    width: 100%;
    padding: 9px 12px 9px 38px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(18, 22, 30, 0.55);
    color: var(--n-text);
    font-size: 13.5px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.npc-search input::placeholder { color: var(--n-text-mute); }
.npc-search input:focus {
    outline: none;
    border-color: var(--n-accent);
    box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.14);
}
.npc-search__status { margin-top: 8px; font-size: 12px; color: var(--n-text-mute); }
.npc-search__status--loading { color: var(--n-gold); }

.npc-search__list {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    max-width: 560px;
    display: flex;
    flex-direction: column;
}
.npc-search__list li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border-bottom: 1px solid var(--n-border);
    color: var(--n-accent-hi);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.12s, padding-left 0.12s;
}
.npc-search__list li:first-child a { border-top: 1px solid var(--n-border); }
.npc-search__list li a:hover { color: #fff; padding-left: 9px; }
.npc-search__cat-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: var(--npc-detail);
    --npc-fill: var(--npc-robe);
}
.npc-search__name { flex: 1; min-width: 0; }
/* Lado direito: categoria + cidade empilhadas, alinhadas à direita */
.npc-search__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
    text-align: right;
    line-height: 1.25;
}
.npc-search__category { font-size: 11px; color: var(--n-text-mute); font-weight: 500; }
.npc-search__town { font-size: 10px; color: var(--n-text-mute); opacity: 0.8; font-weight: 500; }

/* =========================================================
   LAYOUT 2 PAINÉIS
   ========================================================= */
.npc-layout {
    display: grid;
    grid-template-columns: 210px 1fr;
    align-items: start;
}
.npc-rail {
    border-right: 1px solid var(--n-border);
    padding-right: 14px;
}
/* Toggle de modo: por tipo / por cidade */
.npc-rail__modes {
    display: flex;
    gap: 2px;
    margin: 0 0 10px;
    padding: 3px;
    background: rgba(148, 163, 184, 0.06);
    border: 1px solid var(--n-border);
    border-radius: 8px;
}
.npc-rail__mode {
    flex: 1;
    padding: 6px 8px;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--n-text-mute);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.npc-rail__mode:hover { color: var(--n-accent-hi); }
.npc-rail__mode.is-active {
    background: rgba(255, 212, 121, 0.10);
    color: var(--n-gold);
}
.npc-main {
    min-width: 0;
    padding-left: 22px;
}

/* Modo detalhe (igual items/monsters): esconde a coluna de categorias e a busca,
   o detalhe ocupa a página inteira; o breadcrumb (NPCs > Categoria) fica no topo. */
.npc-page--detail .page-title,
.npc-page--detail .page-intro,
.npc-page--detail .npc-search,
.npc-page--detail .npc-rail { display: none; }
.npc-page--detail .npc-layout { display: block; }
.npc-page--detail .npc-main { padding-left: 0; }

/* ---- Lista de categorias (esquerda) ---- */
.npc-category-menu { list-style: none; margin: 0; padding: 0; }
.npc-cat-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    border-radius: 8px;
    color: var(--n-accent-hi);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.12s, color 0.12s;
}
.npc-cat-item:hover { background: rgba(148, 163, 184, 0.08); color: #fff; }
.npc-cat-item__icon {
    width: 26px;
    height: 26px;
    padding: 4px;
    border-radius: 7px;
    /* Fundo um pouco mais claro que o resto pra destacar o manto escuro do NPC. */
    background: rgba(148, 163, 184, 0.16);
    border: 1px solid rgba(148, 163, 184, 0.20);
    color: var(--npc-detail);
    --npc-fill: var(--npc-robe);
    flex-shrink: 0;
    transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.npc-cat-item__label { flex: 1; min-width: 0; }
.npc-cat-item__count {
    font-size: 11px;
    font-weight: 600;
    color: var(--n-text-mute);
    font-variant-numeric: tabular-nums;
}
.npc-cat-item.active {
    background: rgba(255, 212, 121, 0.08);
    color: #fff;
}
.npc-cat-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 2px;
    background: var(--n-gold);
}
.npc-cat-item.active .npc-cat-item__icon {
    color: var(--n-gold);
    border-color: rgba(255, 212, 121, 0.40);
    background: rgba(255, 212, 121, 0.08);
}
.npc-cat-item.active .npc-cat-item__count { color: rgba(255, 212, 121, 0.85); }

/* =========================================================
   BREADCRUMB
   ========================================================= */
.npc-breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--n-text-mute); margin-bottom: 14px; }
.npc-breadcrumb a { color: var(--n-accent); text-decoration: none; font-weight: 600; }
.npc-breadcrumb a:hover { color: var(--n-accent-hi); text-decoration: underline; }
.npc-breadcrumb__separator { opacity: 0.6; }

/* =========================================================
   LISTA DE NPCs DA CATEGORIA (direita) — linhas reguladas
   ========================================================= */
.npc-intro,
.npc-category-empty {
    font-size: 13px;
    color: var(--n-text-soft);
    padding: 6px 2px;
}
.npc-loading { margin-top: 10px; font-size: 13px; color: var(--n-text-soft); }
.npc-error { margin-top: 10px; font-size: 13px; color: #fca5a5; }

.npc-category-panel__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--n-border-strong);
}
.npc-category-panel__header h3 {
    margin: 0;
    font-family: 'Cardo', 'Times New Roman', serif;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--color-heading);
}
.npc-category-panel__count { font-size: 12px; color: var(--n-text-mute); font-variant-numeric: tabular-nums; }

.npc-category-panel__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0 28px;
}
.npc-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 4px 8px 10px;
    border-bottom: 1px solid var(--n-border);
    border-left: 2px solid transparent;
    color: var(--n-accent-hi);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.npc-row:hover {
    color: #fff;
    border-left-color: var(--n-gold);
    background: rgba(148, 163, 184, 0.05);
}
.npc-row__name { min-width: 0; }
.npc-row__meta {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 500;
    color: var(--n-text-mute);
}

/* =========================================================
   DETALHE — plano (sem caixa externa)
   ========================================================= */
.npc-detail__title { display: flex; flex-direction: row; gap: 16px; align-items: flex-start; }
.npc-detail__heading { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.npc-detail__outfit {
    flex-shrink: 0;
    width: 74px;
    height: 74px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--n-border);
    border-radius: 10px;
}
.npc-detail__outfit img { image-rendering: pixelated; max-width: 64px; max-height: 64px; }
.npc-detail__locations { font-size: 12px; color: var(--n-text-soft); }
.npc-detail__city-link { color: var(--n-accent); text-decoration: none; font-weight: 600; }
.npc-detail__city-link:hover { color: var(--n-accent-hi); text-decoration: underline; }
.npc-detail__title h2 {
    margin: 0;
    font-family: 'Cardo', 'Trajan Pro', 'Times New Roman', serif;
    font-size: 24px;
    color: var(--color-heading);
    text-shadow: var(--text-shadow-heading);
    letter-spacing: 0.3px;
}
.npc-detail__meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--n-text-soft); align-items: center; }
.npc-map-link { color: var(--n-gold); text-decoration: none; font-weight: 600; }
.npc-map-link:hover { text-decoration: underline; }
.npc-map-link__pin { margin-right: 4px; font-size: 0.95em; }

.npc-detail__description { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--n-border); font-size: 13px; line-height: 1.6; }
.npc-detail__description-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 10px; font-size: 11px; color: var(--n-text-mute); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }
.npc-detail__lang { display: flex; align-items: center; gap: 8px; }
.npc-detail__lang img { width: 24px; height: 16px; border-radius: 4px; border: 1px solid transparent; cursor: pointer; opacity: 0.7; transition: opacity 0.15s, border-color 0.15s; }
.npc-detail__lang img:hover { opacity: 1; }
.npc-detail__lang img.active { border-color: var(--n-gold); opacity: 1; }
.npc-detail__description-body p { margin: 0 0 10px; }
.npc-detail__description-body p:last-child { margin-bottom: 0; }

.npc-detail__tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; margin-top: 18px; }
.npc-table h3 {
    margin: 0 0 4px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--n-border-strong);
    font-family: 'Cardo', 'Times New Roman', serif;
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--n-accent-hi);
    font-weight: 600;
}
.npc-table table { width: 100%; border-collapse: collapse; }
.npc-table th { text-align: left; padding: 6px 4px; font-size: 10px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--n-text-mute); border-bottom: 1px solid var(--n-border); }
.npc-table td { padding: 7px 4px; font-size: 12px; color: var(--n-text); border-bottom: 1px solid var(--n-border); }
.npc-table tbody tr:hover td { background: rgba(148, 163, 184, 0.05); }
.npc-table__empty { padding: 8px 4px; font-size: 12px; color: var(--n-text-mute); }

.npc-item-cell { display: flex; align-items: center; gap: 8px; }
/* Sprite no tamanho nativo (32x32, igual à loot dos monsters). box-sizing
   content-box garante que padding/border do frame NAO comam a area da sprite —
   ela renderiza exatamente 32x32 (1:1 com o GIF), sem downscale pra 26. */
.npc-item-cell img { box-sizing: content-box; width: 32px; height: 32px; border-radius: 6px; background: rgba(0, 0, 0, 0.3); padding: 2px; border: 1px solid var(--n-border); object-fit: contain; image-rendering: pixelated; }
.npc-item-link { color: var(--n-accent-hi); text-decoration: none; font-weight: 600; }
.npc-item-link:hover { color: var(--n-gold); text-decoration: underline; }
.npc-price { color: var(--n-gold); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.npc-detail__back { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--n-border); }
.npc-detail__back a { color: var(--n-accent); text-decoration: none; font-weight: 600; }
.npc-detail__back a:hover { color: var(--n-accent-hi); text-decoration: underline; }

/* =========================================================
   MOBILE — categorias viram faixa rolável no topo
   ========================================================= */
@media (max-width: 768px) {
    .npc-layout { display: block; }
    .npc-rail {
        border-right: 0;
        padding-right: 0;
        border-bottom: 1px solid var(--n-border);
        padding-bottom: 8px;
        margin-bottom: 16px;
    }
    .npc-rail__title { display: none; }
    .npc-category-menu {
        display: flex;
        gap: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-bottom: 4px;
    }
    .npc-cat-item {
        flex: 0 0 auto;
        border-radius: 8px;
        padding: 6px 10px 6px 8px;
    }
    /* sem barra lateral na faixa horizontal — ativa marca pelo fundo dourado */
    .npc-cat-item.active::before { content: none; }
    .npc-cat-item__label { white-space: nowrap; }
    .npc-main { padding-left: 0; }
    .npc-category-panel__list { grid-template-columns: 1fr; }
}

/* Sprite composta (bundle: ex. backpack of mana fluids) no detalhe */
.item-sprite-bundle { position: relative; display: inline-block; width: 32px; height: 32px; vertical-align: middle; flex-shrink: 0; }
.npc-item-cell .item-sprite-bundle .base { width: 100%; height: 100%; padding: 0; border: 0; background: transparent; border-radius: 0; display: block; image-rendering: pixelated; }
.npc-item-cell .item-sprite-bundle .overlay { position: absolute; bottom: 0; right: 0; width: 55%; height: 55%; padding: 0; border: 0; background: transparent; border-radius: 0; image-rendering: pixelated; pointer-events: none; object-fit: contain; }
