/* Admin — extensão do design system para o painel administrativo */
body.admin-body { background: #EEEEF3; }

/* ---------- Shell / Sidebar ---------- */
.admin-shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.admin-sidebar {
  background: linear-gradient(180deg, #14141F 0%, #191926 100%);
  color: #fff; padding: 22px 14px 14px; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.06);
}
.admin-sidebar .logo { color: #fff; margin-bottom: 26px; padding: 0 6px; }
.admin-sidebar .logo-mark { box-shadow: 0 0 0 3px rgba(238,21,21,.18); }
.admin-nav { display: flex; flex-direction: column; flex: 1; }
.admin-nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 14px; border-radius: 10px; border: none; background: none;
  color: #B7B7C6; font-weight: 600; font-size: .92rem; margin-bottom: 2px;
  position: relative; transition: background .15s, color .15s;
}
.admin-nav button::before {
  content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 0; background: var(--red); border-radius: 0 4px 4px 0; transition: height .15s;
}
.admin-nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
.admin-nav button.active { background: rgba(238,21,21,.14); color: #fff; }
.admin-nav button.active::before { height: 22px; }
.admin-nav button .nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .75; transition: opacity .15s; }
.admin-nav button:hover .nav-icon, .admin-nav button.active .nav-icon { opacity: 1; }
.admin-nav .nav-group-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #6B6B7B; font-weight: 700; margin: 18px 0 6px; padding: 0 14px; }
.admin-nav #btn-admin-logout { margin-top: 10px; color: #E39999; }
.admin-nav #btn-admin-logout:hover { background: rgba(238,21,21,.12); color: #fff; }
.admin-sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.admin-sidebar-foot a { display: flex; align-items: center; gap: 8px; padding: 11px 14px; color: #C9C9D6; font-weight: 600; font-size: .88rem; border-radius: 10px; transition: background .15s; }
.admin-sidebar-foot a:hover { background: rgba(255,255,255,.07); color: #fff; }

/* ---------- Main / Topbar ---------- */
.admin-main { padding: 26px 32px 60px; max-width: 1440px; }
.admin-topbar {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.admin-topbar h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.01em; }
.admin-topbar-user { display: flex; align-items: center; gap: 10px; }
.admin-topbar-user .atu-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--red); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .82rem;
  font-family: var(--font-head); flex-shrink: 0;
}
.admin-topbar-user .atu-name { font-weight: 700; font-size: .86rem; line-height: 1.2; }
.admin-topbar-user .atu-role { color: var(--text-muted); font-size: .74rem; }

/* ---------- KPIs ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px;
  transition: box-shadow .15s, transform .15s; position: relative; overflow: hidden;
  display: flex; align-items: flex-start; gap: 14px;
}
.kpi-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--border); }
.kpi-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.kpi-card .kpi-body { min-width: 0; }
.kpi-card .kpi-label { color: var(--text-muted); font-size: .8rem; margin-bottom: 6px; font-weight: 600; }
.kpi-card .kpi-value { font-family: var(--font-head); font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
.kpi-icon { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--bg); color: var(--text-muted); }
.kpi-icon svg { width: 20px; height: 20px; }
.kpi-available::before { background: var(--available); } .kpi-available .kpi-icon { background: var(--available-bg); color: var(--available); }
.kpi-reserved::before { background: var(--reserved); } .kpi-reserved .kpi-icon { background: var(--reserved-bg); color: var(--reserved); }
.kpi-sold::before { background: var(--sold); } .kpi-sold .kpi-icon { background: var(--sold-bg); color: var(--sold); }
.kpi-value-item::before { background: var(--red); } .kpi-value-item .kpi-icon { background: #FCE4E4; color: var(--red); }
.kpi-total::before { background: var(--purple); } .kpi-total .kpi-icon { background: #ECE6FA; color: var(--purple); }

/* ---------- Ações rápidas (Dashboard) ---------- */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.qa-btn {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text); font-weight: 700; font-size: .9rem; transition: border-color .15s, background .15s, transform .15s;
}
.qa-btn svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--red); }
.qa-btn:hover { border-color: var(--red); background: #FFF5F5; transform: translateY(-1px); }

/* ---------- Cards / Tables ---------- */
.admin-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
.admin-card > h3:first-child { margin-top: 0; }
.admin-table-wrap { overflow-x: auto; border-radius: 10px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.admin-table th {
  text-align: left; padding: 11px 12px; color: var(--text-muted); font-weight: 700;
  font-size: .74rem; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 2px solid var(--border); white-space: nowrap; background: var(--bg);
  position: sticky; top: 0; z-index: 1;
}
.admin-table th:first-child { border-top-left-radius: 8px; }
.admin-table th:last-child { border-top-right-radius: 8px; }
.admin-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tbody tr { transition: background .1s; }
.admin-table tbody tr:hover td { background: #FAFAFC; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table img.thumb { width: 40px; height: 54px; object-fit: cover; border-radius: 5px; box-shadow: 0 1px 3px rgba(20,20,40,.15); max-width: none; }
.admin-table img.thumb-ref { opacity: .55; border: 1px dashed var(--text-faint); box-shadow: none; }
.needs-photo-flag { font-size: .7rem; font-weight: 700; color: var(--red); margin-top: 2px; }

.admin-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.admin-toolbar .flex { flex-wrap: wrap; }
.admin-input, .admin-select {
  padding: 10px 14px; border-radius: 9px; border: 1px solid var(--border); background: #fff;
  font-size: .88rem; transition: border-color .15s, box-shadow .15s;
}
.admin-input:focus, .admin-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36,81,176,.12); outline: none; }
.admin-input { min-width: 220px; }
.admin-empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }

/* ---------- Estado vazio padrão (dentro de células de tabela com colspan) ---------- */
.admin-empty { text-align: center; padding: 44px 20px; color: var(--text-muted); }
.admin-empty .ae-icon { width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 50%; background: var(--bg); color: var(--text-faint); display: flex; align-items: center; justify-content: center; }
.admin-empty .ae-icon svg { width: 22px; height: 22px; }
.admin-empty strong { display: block; color: var(--text); font-family: var(--font-head); font-size: .95rem; margin-bottom: 4px; }
.admin-empty span { font-size: .84rem; }

/* ---------- Chips (quick filters) ---------- */
.chip-filter { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--text-muted); font-weight: 700; font-size: .82rem; cursor: pointer; transition: all .15s; }
.chip-filter:hover { border-color: var(--text-muted); color: var(--text); }
.chip-filter.active { background: var(--text); border-color: var(--text); color: #fff; }
.chip-filter .count { opacity: .7; font-weight: 600; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,15,25,.6); backdrop-filter: blur(2px); z-index: 300; display: none; align-items: flex-start; justify-content: center; padding: 40px 20px; overflow-y: auto; }
.modal-overlay.open { display: flex; }
.modal-box { background: #fff; border-radius: var(--radius-lg); padding: 28px; width: 100%; max-width: 720px; box-shadow: var(--shadow-lg); }
.modal-box.wide { max-width: 960px; }
.img-thumb-list { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.img-thumb-list .it { position: relative; width: 70px; height: 94px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.img-thumb-list .it img { width: 100%; height: 100%; object-fit: cover; }
.img-thumb-list .it button { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.6); color: #fff; border: none; width: 20px; height: 20px; border-radius: 50%; font-size: .7rem; }
.tag-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--bg); font-size: .78rem; font-weight: 700; }

/* Quick-select de idioma no formulário de produto */
.lang-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.lang-chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); font-size: .78rem; font-weight: 700; color: var(--text-muted); cursor: pointer; transition: all .12s; }
.lang-chip:hover { border-color: var(--blue); color: var(--blue); }
.lang-chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* Seções recolhíveis do formulário de produto — encurta o formulário na primeira olhada;
   seções opcionais ficam fechadas até o admin abrir ou até já terem dado preenchido. */
.form-section { border: 1px solid var(--border); border-radius: 10px; margin-top: 14px; padding: 0 14px; background: #FAFAFC; }
.form-section[open] { padding-bottom: 6px; }
.form-section summary { list-style: none; cursor: pointer; padding: 13px 0; font-weight: 700; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.form-section summary::-webkit-details-marker { display: none; }
.form-section summary::before { content: '▸'; color: var(--text-muted); transition: transform .12s; font-size: .8rem; }
.form-section[open] summary::before { transform: rotate(90deg); }
.form-section-hint { font-weight: 400; font-size: .78rem; color: var(--text-muted); }

/* ---------- Login ---------- */
.login-box { max-width: 380px; margin: 90px auto; background: #fff; border-radius: var(--radius-lg); padding: 34px 32px; box-shadow: var(--shadow-lg); border-top: 4px solid var(--red); }
body.admin-body:has(#login-view:not(.hide)) { background: radial-gradient(circle at 50% 0%, #23233a 0%, #14141F 60%); min-height: 100vh; }

/* ---------- Acervo de Referência ---------- */
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.ref-tile { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; cursor: default; transition: box-shadow .15s, transform .15s, border-color .15s; display: flex; flex-direction: column; align-items: center; position: relative; }
.ref-tile.clickable { cursor: pointer; }
.ref-tile.clickable:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--text-faint); }
.ref-tile img { max-width: 100%; max-height: 120px; object-fit: contain; margin-bottom: 8px; }
.ref-tile-noimg { width: 100%; height: 80px; display: flex; align-items: center; justify-content: center; background: var(--bg); border-radius: 8px; margin-bottom: 8px; color: var(--text-faint); }
.ref-tile-noimg svg { width: 30px; height: 30px; }
.ref-tile strong { font-size: .88rem; line-height: 1.3; }
.ref-tile.added { border-color: var(--available); background: var(--available-bg); }
.ref-tile .ref-added-badge { position: absolute; top: 8px; right: 8px; background: var(--available); color: #fff; font-size: .68rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; }
mark.hl { background: #FFF3B0; color: inherit; border-radius: 3px; padding: 0 1px; }
.acervo-search-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }

/* Faixa de miniaturas por idioma (TCGdex) no formulário de produto */
.lang-variant-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.lang-variant-tile { flex: 0 0 auto; width: 74px; background: var(--bg); border: 2px solid var(--border); border-radius: 10px; padding: 6px; text-align: center; cursor: pointer; transition: border-color .12s, transform .12s; }
.lang-variant-tile:hover { border-color: var(--blue); transform: translateY(-2px); }
.lang-variant-tile.selected { border-color: var(--red); background: #FFF3F3; }
.lang-variant-tile img { width: 100%; height: 64px; object-fit: contain; margin-bottom: 4px; }
.lang-variant-tile span { display: block; font-size: .66rem; font-weight: 700; color: var(--text-muted); line-height: 1.2; }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; }
  .admin-main { padding: 20px; }
  .admin-topbar-user .atu-name, .admin-topbar-user .atu-role { display: none; }
}
