/* =========================================================
   CATÁLOGO DE CONTAS — TEMA ESCURO / NEON
   Paleta:
     --bg          fundo geral (quase preto, tom azulado)
     --surface     fundo de cards/painéis
     --surface-2   fundo de elementos internos (badges, chips)
     --cyan        neon primário (ações, bordas, links)
     --magenta     neon secundário (destaque raro / urgente)
     --gold        cor do preço
     --text        texto principal
     --muted       texto secundário
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@600;800&family=Rajdhani:wght@500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg: #070a12;
  --bg-grid: #0b0f1a;
  --surface: #101625;
  --surface-2: #182036;
  --border: #223052;
  --cyan: #00e5ff;
  --cyan-dim: #00a3b8;
  --magenta: #ff2e93;
  --gold: #ffb020;
  --text: #eaf0ff;
  --muted: #8a97b4;
  --danger: #ff3b5c;
  --radius: 14px;
  --font-display: 'Orbitron', sans-serif;
  --font-heading: 'Rajdhani', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 16px;
  line-height: 1.4;
  overflow-x: hidden;
  max-width: 100vw;
}

/* fundo com grade sutil, remete a HUD de jogo */
body {
  background-image:
    linear-gradient(rgba(0,229,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,255,0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  background-attachment: fixed;
}

a { color: inherit; }

::selection { background: var(--magenta); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--cyan-dim); }

/* =========================== HEADER =========================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(180deg, rgba(7,10,18,0.98), rgba(7,10,18,0.9));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .topbar-inner { padding: 14px 16px; gap: 12px; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-badge {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 20px;
  box-shadow: 0 0 18px rgba(0,229,255,0.45);
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .brand-badge { width: 36px; height: 36px; font-size: 16px; }
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 1px;
  margin: 0;
  color: var(--text);
  text-transform: uppercase;
}
.brand-text span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}
@media (max-width: 480px) {
  .brand-text h1 { font-size: 15px; }
  .brand-text span { font-size: 10.5px; }
}

.stock-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .stock-status { margin-left: 0; width: 100%; justify-content: space-between; }
}

.dot-live {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: pulseDot 1.6s infinite;
}
@keyframes pulseDot {
  0%,100% { opacity: 1; }
  50% { opacity: .35; }
}

.btn-update {
  background: transparent;
  border: 1px solid var(--cyan-dim);
  color: var(--cyan);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all .2s ease;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .btn-update { padding: 8px 12px; font-size: 12px; }
}
.btn-update:hover {
  background: rgba(0,229,255,0.1);
  box-shadow: 0 0 14px rgba(0,229,255,0.35);
  transform: translateY(-1px);
}
.btn-update.loading .refresh-icon { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================== FILTROS =========================== */
.filters {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px 4px;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr;
  gap: 12px;
}
@media (max-width: 980px) {
  .filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .filters { grid-template-columns: 1fr; padding: 16px 16px 4px; gap: 10px; }
}
@media (max-width: 360px) {
  .filters { padding: 14px 12px 4px; }
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.field input,
.field select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 13px;
  border-radius: 9px;
  font-family: var(--font-heading);
  font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder { color: #566083; }
.field input:focus, .field select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,229,255,0.15);
}

.search-field { position: relative; }
.search-field .icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-52%);
  color: var(--muted); pointer-events: none;
}
.search-field input { padding-left: 36px; }

.price-range { display: flex; gap: 8px; }
.price-range input { width: 50%; min-width: 0; }

/* chips de resumo */
.filters-summary {
  max-width: 1400px;
  margin: 10px auto 0;
  padding: 0 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
@media (max-width: 560px) {
  .filters-summary { padding: 0 16px; }
}
@media (max-width: 360px) {
  .filters-summary { padding: 0 12px; }
}
.filters-summary strong { color: var(--cyan); }

/* =========================== CATEGORIAS / ACCORDION =========================== */
.catalog {
  max-width: 1400px;
  margin: 0 auto;
  padding: 22px 24px 60px;
}
@media (max-width: 560px) {
  .catalog { padding: 16px 12px 40px; }
}

.category {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(16,22,37,0.9), rgba(16,22,37,0.55));
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  transition: border-color .2s;
}
.category:hover { border-color: var(--cyan-dim); }

.category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  gap: 14px;
}
@media (max-width: 480px) {
  .category-head { padding: 13px 14px; gap: 8px; }
}

.category-head-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

.category-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 480px) {
  .category-title { font-size: 14.5px; }
}

.category-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--bg);
  background: var(--cyan);
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.category-chevron {
  color: var(--muted);
  transition: transform .3s ease;
  flex-shrink: 0;
}
.category.open .category-chevron { transform: rotate(180deg); color: var(--cyan); }

.category-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease;
}
.category.open .category-body { max-height: none; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
  padding: 4px 20px 22px;
}
@media (max-width: 700px) {
  .category-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; padding: 4px 14px 18px; }
}
@media (max-width: 480px) {
  .category-grid { grid-template-columns: 1fr; gap: 12px; padding: 4px 12px 16px; }
}
@media (min-width: 481px) and (max-width: 700px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
}

/* =========================== CARD DE CONTA =========================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
  animation: cardIn .35s ease both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--cyan);
  box-shadow: 0 10px 30px rgba(0,229,255,0.18), 0 0 0 1px rgba(0,229,255,0.25) inset;
}
.card.is-urgent { border-color: rgba(255,59,92,0.55); }
.card.is-urgent:hover { border-color: var(--danger); box-shadow: 0 10px 30px rgba(255,59,92,0.25); }

.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #05070d;
  overflow: hidden;
}
.card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.card:hover .card-media img { transform: scale(1.06); }

.card-tag {
  position: absolute;
  top: 10px; left: 10px;
  background: rgba(7,10,18,0.85);
  border: 1px solid var(--cyan-dim);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 6px;
}
.card-tag.urgent {
  border-color: var(--danger);
  color: var(--danger);
  animation: pulseUrgent 1.5s infinite;
}
@keyframes pulseUrgent {
  0% { box-shadow: 0 0 0 0 rgba(255,59,92,.5); }
  70% { box-shadow: 0 0 0 8px rgba(255,59,92,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,59,92,0); }
}

.card-photos-count {
  position: absolute;
  bottom: 10px; right: 10px;
  background: rgba(7,10,18,0.85);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
}
.chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 3px 9px;
  border-radius: 20px;
}
.chip.code { color: var(--cyan); }
.chip.qty { color: var(--text); }
.chip.qty.zero { color: var(--danger); border-color: rgba(255,59,92,0.4); }

.card-items {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 58px;
  overflow: hidden;
}
.card-items li { list-style: none; }
.card-items li::before { content: "▹ "; color: var(--cyan-dim); }

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.card-price {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255,176,32,0.35);
}
.card-price small { display: block; font-family: var(--font-mono); font-size: 10px; color: var(--muted); font-weight: 400; text-shadow: none; }

.btn-view {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-dim));
  color: #04121a;
  border: none;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn-view:hover { transform: scale(1.05); box-shadow: 0 0 16px rgba(0,229,255,0.5); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-family: var(--font-mono);
}
.empty-state .big { font-size: 40px; margin-bottom: 10px; }

/* =========================== MODAL DETALHE =========================== */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(2,4,9,0.88);
  backdrop-filter: blur(6px);
  z-index: 100;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}
.modal-overlay.active { display: flex; }
@media (max-width: 640px) {
  .modal-overlay { padding: 16px 8px; }
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 980px;
  width: 100%;
  padding: 26px;
  position: relative;
  box-shadow: 0 0 0 1px rgba(0,229,255,0.1), 0 30px 80px rgba(0,0,0,0.6);
  animation: modalIn .25s ease both;
}
@media (max-width: 640px) {
  .modal { padding: 18px 16px; border-radius: 12px; }
}
@media (max-width: 360px) {
  .modal { padding: 14px 12px; }
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px; height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: .2s;
  z-index: 5;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--danger); border-color: var(--danger); }
@media (max-width: 640px) {
  .modal-close { top: 12px; right: 12px; width: 30px; height: 30px; font-size: 16px; }
}

.modal-header { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; padding-right: 40px; }
.modal-title { font-family: var(--font-heading); font-weight: 700; font-size: 20px; color: var(--text); }
.modal-sub { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-bottom: 18px; }
@media (max-width: 480px) {
  .modal-title { font-size: 17px; }
}

.modal-price-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.modal-price-box .price { font-family: var(--font-display); font-size: 24px; color: var(--gold); text-shadow: 0 0 14px rgba(255,176,32,0.4); }
.modal-price-box .btn-cta {
  background: linear-gradient(135deg, var(--magenta), var(--cyan));
  border: none; color: #08040a; font-family: var(--font-heading); font-weight: 800;
  padding: 12px 22px; border-radius: 9px; cursor: pointer; font-size: 14px;
  transition: transform .15s;
}
.modal-price-box .btn-cta:hover { transform: scale(1.04); }

.contato-modal { max-width: 420px; padding-top: 34px; }
.contato-opcoes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}
.contato-btn {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 14px 18px;
  font-size: 15px;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--cyan);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin: 22px 0 14px;
}
.section-title.alt { color: var(--gold); }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 8px; }
  .gallery-item img { height: 90px; }
}
.gallery-item {
  background: #05070d;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: zoom-in;
  transition: transform .2s, border-color .2s;
}
.gallery-item:hover { transform: translateY(-3px); border-color: var(--cyan); }
.gallery-item img { width: 100%; height: 120px; object-fit: cover; display: block; }
.gallery-item span { display: block; font-size: 11px; padding: 6px 8px; color: var(--muted); text-align: center; }

.possibility-alert {
  background: rgba(255,46,147,0.08);
  border: 1px solid rgba(255,46,147,0.35);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 6px;
}
.possibility-alert b { color: var(--magenta); }
.possibility-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.possibility-tags .tag { background: var(--surface-2); border: 1px solid var(--border); font-size: 11.5px; padding: 4px 10px; border-radius: 20px; color: var(--muted); }

/* Lightbox (zoom de imagem) */
.lightbox {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.94);
  z-index: 200;
  align-items: center; justify-content: center;
}
.lightbox.active { display: flex; }
.lightbox img { max-width: 92vw; max-height: 88vh; object-fit: contain; border-radius: 8px; box-shadow: 0 0 60px rgba(0,229,255,0.15); }
.lightbox-close {
  position: absolute; top: 22px; right: 30px;
  background: none; border: none; color: #fff; font-size: 36px; cursor: pointer;
}
@media (max-width: 480px) {
  .lightbox-close { top: 10px; right: 14px; font-size: 30px; }
}
.lightbox-close:hover { color: var(--magenta); }

/* Toast (feedback do "Atualizar Estoque") */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--surface);
  border: 1px solid var(--cyan);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  z-index: 300;
  box-shadow: 0 0 20px rgba(0,229,255,0.3);
  transition: transform .3s ease;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--danger); }

/* Loading skeleton inicial */
.loading-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
  font-family: var(--font-mono);
}
.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin .8s linear infinite;
}

.footer-note {
  text-align: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 20px 24px 40px;
  max-width: 1400px;
  margin: 0 auto;
}
@media (max-width: 480px) {
  .footer-note { padding: 16px 14px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
