/* ── RESET BÁSICO ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.row { display: flex; flex-wrap: wrap; margin: 0 -8px; }
.row > [class^="col"] { padding: 0 8px; margin-bottom: 16px; }
.col-12  { width: 100%; }
.col-md-6 { width: 50%; }
.col-md-3 { width: 25%; }
.g-3 { gap: 0; }
.mt-2 { margin-top: 12px; }

/* ── VARIÁVEIS ── */
:root {
  --amarelo: #FFD93D;
  --azul:    #4CC9F0;
  --verde:   #6BCB77;
  --rosa:    #FF6B9D;
  --laranja: #FF8C42;
  --roxo:    #9B5DE5;
  --fundo:   #FFF9F0;
  --texto:   #2D2D2D;
  --card-bg: #FFFFFF;
  --borda:   #E8E0F0;
  --fonte:   'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

/* ── BODY ── */
body {
  font-family: var(--fonte);
  background: var(--fundo);
  background-image:
    radial-gradient(circle at 10% 20%, #fff0f5 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, #f0f5ff 0%, transparent 40%);
  color: var(--texto);
  min-height: 100vh;
}

/* ── HEADER ── */
.header {
  background: linear-gradient(135deg, #9B5DE5 0%, #F15BB5 50%, #FF8C42 100%);
  padding: 28px 0 22px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(155,93,229,.3);
  position: relative;
  overflow: hidden;
}
.header::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg,
    rgba(255,255,255,.04) 0px, rgba(255,255,255,.04) 2px,
    transparent 2px, transparent 20px);
}
.header h1 {
  font-size: 2.2rem; font-weight: 800; color: #fff;
  margin: 0; letter-spacing: -0.5px;
  text-shadow: 0 2px 8px rgba(0,0,0,.2);
  position: relative;
}
.header p {
  color: rgba(255,255,255,.85);
  margin: 6px 0 0; font-size: .95rem; font-weight: 600;
  position: relative;
}

/* ── LAYOUT ── */
.main-wrapper { max-width: 1100px; margin: 0 auto; padding: 32px 16px 60px; }

/* ── TABS ── */
.custom-tabs {
  display: flex; gap: 8px; margin-bottom: 28px;
  background: #fff; border-radius: 16px; padding: 6px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
.custom-tabs button {
  flex: 1; border: none; border-radius: 12px;
  padding: 10px 16px; font-family: var(--fonte);
  font-size: .9rem; font-weight: 700;
  cursor: pointer; transition: all .2s;
  background: transparent; color: #888;
}
.custom-tabs button.active {
  background: linear-gradient(135deg, #9B5DE5, #F15BB5);
  color: #fff; box-shadow: 0 3px 10px rgba(155,93,229,.4);
}
.tab-pane         { display: none; }
.tab-pane.active  { display: block; }

/* ── TÍTULOS DE SEÇÃO ── */
.section-title {
  font-size: 1.35rem; font-weight: 700;
  margin-bottom: 18px; color: #5a3e8f;
  display: flex; align-items: center; gap: 8px;
}

/* ── FORMULÁRIO DE CADASTRO ── */
.form-card {
  background: #fff; border-radius: 20px; padding: 28px;
  box-shadow: 0 4px 20px rgba(0,0,0,.07);
  border: 1.5px solid var(--borda);
}
.form-card label {
  font-weight: 700; font-size: .88rem;
  color: #6b5b8e; margin-bottom: 5px; display: block;
}
.form-card input,
.form-card select,
.form-card textarea {
  border-radius: 12px; border: 1.5px solid #ddd;
  padding: 10px 14px; font-family: var(--fonte);
  font-size: .95rem; width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus {
  border-color: #9B5DE5; outline: none;
  box-shadow: 0 0 0 3px rgba(155,93,229,.15);
}

/* ── CHECKBOXES DE CATEGORIA (cadastro) ── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px; margin-top: 4px;
}
.cat-item {
  display: flex; align-items: center; gap: 9px;
  background: #f8f4ff; border: 1.5px solid #e0d4f7;
  border-radius: 12px; padding: 9px 14px;
  cursor: pointer; transition: all .18s; user-select: none;
}
.cat-item:hover { border-color: #9B5DE5; background: #f0e8ff; }
.cat-item input[type=checkbox] { display: none; }
.cat-check {
  width: 20px; height: 20px; min-width: 20px;
  border-radius: 6px; border: 2px solid #bba8e0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; transition: all .18s; background: #fff;
}
.cat-item input:checked ~ .cat-check  { background: #9B5DE5; border-color: #9B5DE5; color: #fff; }
.cat-item input:checked ~ .cat-label  { color: #6b3faf; font-weight: 700; }
.cat-label { font-size: .88rem; font-weight: 600; color: #555; }
.cat-dot   { width: 10px; height: 10px; border-radius: 50%; min-width: 10px; }

/* ── BOTÃO SALVAR ── */
.btn-salvar {
  background: linear-gradient(135deg, #9B5DE5, #F15BB5);
  color: #fff; border: none; border-radius: 14px; padding: 12px 32px;
  font-family: var(--fonte); font-size: 1rem; font-weight: 800;
  cursor: pointer; transition: all .2s;
  box-shadow: 0 4px 14px rgba(155,93,229,.35);
}
.btn-salvar:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(155,93,229,.45); }

/* ── PAINEL DE PESQUISA ── */
.search-box {
  background: #fff; border-radius: 18px;
  border: 1.5px solid var(--borda); padding: 20px 22px 16px;
  box-shadow: 0 3px 12px rgba(0,0,0,.06); margin-bottom: 22px;
}
.search-box-title {
  font-size: .82rem; font-weight: 800; color: #9B5DE5;
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 12px;
}
.inp-busca {
  border-radius: 12px; border: 1.5px solid #ddd;
  padding: 9px 14px; font-family: var(--fonte);
  font-size: .92rem; width: 100%; margin-bottom: 16px;
  transition: border-color .2s;
}
.inp-busca:focus { border-color: #9B5DE5; outline: none; box-shadow: 0 0 0 3px rgba(155,93,229,.12); }

/* ── CHECKBOXES DE FILTRO (pesquisa) ── */
.filter-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px; margin-bottom: 14px;
}
.filter-cat-item {
  display: flex; align-items: center; gap: 8px;
  background: #f8f4ff; border: 1.5px solid #e0d4f7;
  border-radius: 10px; padding: 8px 12px;
  cursor: pointer; transition: all .18s; user-select: none;
}
.filter-cat-item:hover { border-color: #9B5DE5; background: #ede6ff; }
.filter-cat-item input[type=checkbox] { display: none; }
.filter-cat-item .fcheck {
  width: 18px; height: 18px; min-width: 18px;
  border-radius: 5px; border: 2px solid #bba8e0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; background: #fff; transition: all .18s;
}
.filter-cat-item input:checked ~ .fcheck  { background: #9B5DE5; border-color: #9B5DE5; color: #fff; }
.filter-cat-item input:checked ~ .flabel  { color: #5a2fa0; font-weight: 800; }
.filter-cat-item .fdot  { width: 9px; height: 9px; border-radius: 50%; min-width: 9px; }
.filter-cat-item .flabel { font-size: .83rem; font-weight: 600; color: #555; }

/* ── MODO DE FILTRO ── */
.filter-mode-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-top: 10px; border-top: 1px solid #f0e8ff;
}
.filter-mode-row span { font-size: .8rem; font-weight: 700; color: #888; }
.mode-toggle {
  display: flex; background: #f3eeff;
  border-radius: 10px; padding: 3px; gap: 3px;
}
.mode-btn {
  border: none; border-radius: 8px; padding: 5px 14px;
  font-family: var(--fonte); font-size: .8rem; font-weight: 700;
  cursor: pointer; background: transparent; color: #888; transition: all .18s;
}
.mode-btn.active { background: #9B5DE5; color: #fff; box-shadow: 0 2px 6px rgba(155,93,229,.3); }

.result-count { font-size: .82rem; font-weight: 700; color: #aaa; margin-bottom: 16px; }
.result-count strong { color: #9B5DE5; }

.btn-limpar {
  border: none; background: #fff0f0; color: #e63946;
  border-radius: 8px; padding: 5px 14px;
  font-family: var(--fonte); font-size: .8rem; font-weight: 700;
  cursor: pointer; margin-left: auto;
}

/* ── GRID DE JOGOS ── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.game-card {
  background: #fff; border-radius: 18px;
  border: 1.5px solid var(--borda); padding: 18px;
  box-shadow: 0 3px 12px rgba(0,0,0,.06);
  transition: transform .2s, box-shadow .2s;
  position: relative; overflow: hidden;
}
.game-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.game-card-accent { height: 5px; border-radius: 4px; margin-bottom: 14px; }
.game-card h4 { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; color: #2d2d2d; }
.game-card .desc { font-size: .82rem; color: #888; margin-bottom: 12px; line-height: 1.45; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { background: #f3eeff; color: #7b4fc0; border-radius: 8px; padding: 3px 10px; font-size: .75rem; font-weight: 700; }
.game-age { font-size: .78rem; font-weight: 700; color: #aaa; margin-bottom: 8px; }
.card-actions { display: flex; gap: 6px; margin-top: 12px; }
.btn-edit, .btn-del {
  border: none; border-radius: 8px; padding: 5px 12px;
  font-size: .78rem; font-weight: 700; cursor: pointer; font-family: var(--fonte);
}
.btn-edit { background: #eef2ff; color: #4361ee; }
.btn-del  { background: #fff0f0; color: #e63946; }

/* ── ABA CATEGORIAS ── */
.cat-manage-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
}
.cat-card {
  background: #fff; border-radius: 16px;
  border: 1.5px solid var(--borda); padding: 16px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.cat-card .big-dot { width: 18px; height: 18px; border-radius: 50%; min-width: 18px; }
.cat-card-label { font-weight: 700; font-size: .92rem; color: #444; }
.cat-card-count { font-size: .78rem; color: #aaa; }
.add-cat-row {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: #fff; border-radius: 16px; padding: 18px 20px;
  border: 1.5px dashed #c9b8f0;
}
.add-cat-row input {
  border-radius: 10px; border: 1.5px solid #ddd;
  padding: 9px 14px; font-family: var(--fonte);
  font-size: .9rem; flex: 1; min-width: 140px;
}
.color-picker-wrap { display: flex; align-items: center; gap: 6px; }
.color-picker-wrap label { font-size: .82rem; font-weight: 700; color: #888; white-space: nowrap; }
.btn-add-cat {
  background: #9B5DE5; color: #fff; border: none;
  border-radius: 10px; padding: 9px 20px;
  font-family: var(--fonte); font-size: .9rem; font-weight: 700; cursor: pointer;
}

/* ── TOAST ── */
.toast-box {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #2d2d2d; color: #fff;
  border-radius: 14px; padding: 12px 24px;
  font-weight: 700; font-size: .9rem;
  transition: transform .3s; z-index: 999;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.toast-box.show { transform: translateX(-50%) translateY(0); }

/* ── MOBILE ── */
@media(max-width:600px){
  .col-md-6, .col-md-3 { width: 100%; }

  .header h1 { font-size: 1.4rem; }
  .header p  { font-size: .82rem; }

  .main-wrapper { padding: 16px 10px 60px; }

  .custom-tabs { flex-wrap: wrap; gap: 5px; padding: 5px; }
  .custom-tabs button { flex: 1 1 calc(50% - 5px); font-size: .78rem; padding: 9px 6px; min-width: 0; }

  .form-card { padding: 16px 14px; }

  .cat-grid        { grid-template-columns: 1fr 1fr; }
  .filter-cat-grid { grid-template-columns: 1fr 1fr; }

  .filter-mode-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .mode-toggle { width: 100%; }
  .mode-btn { flex: 1; text-align: center; font-size: .75rem; padding: 6px 8px; }
  .btn-limpar { margin-left: 0; width: 100%; text-align: center; }

  .games-grid { grid-template-columns: 1fr; }

  .cat-manage-grid { grid-template-columns: 1fr 1fr; }

  .add-cat-row { flex-direction: column; align-items: stretch; }
  .add-cat-row input { width: 100%; }
  .btn-add-cat { width: 100%; padding: 11px; }

  .inp-busca { font-size: .88rem; }
}

/* ── LAYOUT SIDEBAR ── */
.lista-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: start;
}
.sidebar {
  background: #fff; border-radius: 18px;
  border: 1.5px solid var(--borda); padding: 20px 18px;
  box-shadow: 0 3px 12px rgba(0,0,0,.06);
  position: sticky; top: 20px; order: 2;
}
.lista-main { min-width: 0; order: 1; }
.sidebar .filter-cat-grid { grid-template-columns: 1fr !important; gap: 6px; margin-bottom: 0; }
.sidebar .mode-toggle { flex-direction: column; width: 100%; }
.sidebar .mode-btn { text-align: center; }
.lista-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 8px; }

@media(max-width:700px) {
  .lista-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; order: -1; }
  .sidebar .filter-cat-grid { grid-template-columns: 1fr 1fr !important; }
}

/* ── FOTO DO JOGO ── */
.foto-wrap {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.foto-wrap img {
  width: 110px; height: 110px;
  object-fit: cover; border-radius: 12px;
  border: 2px dashed #c9b8f0;
  cursor: pointer; transition: all .2s;
  background: #f8f4ff;
}
.foto-wrap img:hover { border-color: #9B5DE5; transform: scale(1.03); }
.foto-hint { font-size: .8rem; color: #aaa; font-weight: 600; max-width: 200px; }

/* foto no card */
.game-card-foto {
  width: 100%; height: 140px;
  object-fit: contain;
  border-radius: 10px; margin-bottom: 12px;
  background: #f8f4ff;
}
.game-card-sem-foto {
  width: 100%; height: 140px;
  background: linear-gradient(135deg, #f8f4ff, #ede6ff);
  border-radius: 10px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
}
