/* =========================================================
   GoGym — styles.css
   ========================================================= */
:root {
  --bg: #0e1116;
  --bg-2: #161b22;
  --bg-3: #1c232d;
  --line: #2a323d;
  --text: #e6edf3;
  --muted: #8b97a7;
  --brand: #22c55e;
  --brand-dark: #16a34a;
  --danger: #ef4444;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
button { font-family: inherit; cursor: pointer; }
img { display: block; }
.muted { color: var(--muted); }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(14, 17, 22, .9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { font-size: 30px; }
.brand h1 { font-size: 22px; letter-spacing: .5px; }
.brand h1::first-letter { color: var(--brand); }
.brand-sub { margin: 0; font-size: 12.5px; color: var(--muted); }

.tabs { display: flex; gap: 6px; background: var(--bg-2); padding: 5px; border-radius: 999px; border: 1px solid var(--line); }
.tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 8px; transition: .15s;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--brand); color: #05210f; }
.badge {
  background: var(--bg-3); color: var(--text);
  min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px;
  font-size: 12px; display: inline-flex; align-items: center; justify-content: center;
}
.tab.is-active .badge { background: rgba(0, 0, 0, .25); color: #05210f; }

/* ---------- layout ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 22px 20px 60px; }
.view { display: none; }
.view.is-active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- filtros ---------- */
.filters {
  display: grid; gap: 12px; align-items: end;
  grid-template-columns: 2fr 1fr 1fr auto;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input, .field select {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 10px 12px; border-radius: 10px; font-size: 14px; width: 100%;
}
.field input:focus, .field select:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.field select { appearance: none; cursor: pointer; }

.result-info { color: var(--muted); font-size: 13.5px; margin: 18px 2px 14px; }

/* ---------- botões ---------- */
.btn {
  border: 1px solid transparent; border-radius: 10px;
  padding: 10px 16px; font-size: 14px; font-weight: 600; transition: .15s;
}
.btn-primary { background: var(--brand); color: #05210f; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--bg-3); color: var(--text); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--brand); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: rgba(239, 68, 68, .4); }
.btn-danger-ghost:hover { background: rgba(239, 68, 68, .12); }
.btn-block { width: 100%; }

/* ---------- grid de cards ---------- */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column;
  transition: .18s;
}
.card:hover { transform: translateY(-3px); border-color: #3a4452; box-shadow: var(--shadow); }
.card-media {
  aspect-ratio: 1 / 1; background: #fff; cursor: pointer; overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: contain; }
.card-body { padding: 12px 13px 13px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.card-title {
  font-size: 14.5px; font-weight: 700; cursor: pointer;
  text-transform: capitalize;
}
.card-title:hover { color: var(--brand); }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; min-height: 22px; }
.tag {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: var(--bg-3); color: var(--muted); border: 1px solid var(--line);
}
.tag-grupo { color: var(--brand); border-color: rgba(34, 197, 94, .35); background: rgba(34, 197, 94, .08); }
.btn-add { margin-top: auto; }
.btn-add.is-added { background: var(--bg-3); color: var(--brand); border: 1px solid rgba(34, 197, 94, .5); }

.load-more-wrap { text-align: center; margin-top: 26px; }
.grid-status { color: var(--muted); font-size: 13px; margin-top: 14px; }
.empty-inline { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- minha série ---------- */
.serie-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  flex-wrap: wrap; margin-bottom: 22px;
}
.serie-head h2 { font-size: 22px; }
.serie-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.empty {
  text-align: center; padding: 70px 20px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: var(--radius); background: var(--bg-2);
}
.empty-emoji { font-size: 44px; margin: 0 0 6px; }
.empty .btn { margin-top: 16px; }

.serie-grupo { margin-bottom: 28px; }
.serie-grupo-titulo {
  font-size: 16px; color: var(--brand); margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.serie-item {
  display: flex; gap: 14px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; margin-bottom: 12px;
}
.serie-thumb {
  width: 92px; height: 92px; flex: none; border-radius: 10px; object-fit: contain;
  background: #fff; cursor: pointer;
}
.serie-main { flex: 1; min-width: 0; }
.serie-item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.serie-item-head h4 { font-size: 15.5px; cursor: pointer; text-transform: capitalize; }
.serie-item-head h4:hover { color: var(--brand); }
.serie-grupos { font-size: 12px; color: var(--muted); margin: 3px 0 8px; }
.serie-move { display: flex; gap: 4px; flex: none; }
.icon-btn {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-3); color: var(--muted); font-size: 12px; line-height: 1;
}
.icon-btn:hover { color: var(--text); border-color: var(--brand); }
.icon-del:hover { color: var(--danger); border-color: var(--danger); }

.serie-campos { display: flex; flex-wrap: wrap; gap: 8px; }
.campo { display: flex; flex-direction: column; gap: 3px; }
.campo span { font-size: 10.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.campo input {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 6px 8px; font-size: 13px; width: 92px;
}
.campo input[type="number"] { width: 64px; }
.campo input:focus { outline: 1px solid var(--brand); border-color: var(--brand); }
.serie-obs {
  margin-top: 9px; width: 100%; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: 7px 10px; font-size: 13px;
}
.serie-obs:focus { outline: 1px solid var(--brand); border-color: var(--brand); }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .65); }
.modal-card {
  position: relative; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 18px; max-width: 820px; width: 100%; max-height: 90vh; overflow: auto;
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--bg-3); color: var(--text); font-size: 15px;
}
.modal-close:hover { color: var(--danger); border-color: var(--danger); }
.modal-body { padding: 22px; }
.modal-loading { text-align: center; padding: 60px 0; color: var(--muted); }
.modal-grid { display: grid; grid-template-columns: 280px 1fr; gap: 22px; }
.modal-media { background: #fff; border-radius: 12px; overflow: hidden; aspect-ratio: 1/1; }
.modal-media img { width: 100%; height: 100%; object-fit: contain; }
.modal-info h2 { font-size: 21px; text-transform: capitalize; }
.modal-orig { color: var(--muted); font-size: 12.5px; margin: 4px 0 16px; font-style: italic; }
.chip-row { margin-bottom: 10px; font-size: 13px; }
.chip-label { color: var(--muted); font-weight: 600; }
.chip {
  display: inline-block; background: var(--bg-3); border: 1px solid var(--line);
  padding: 2px 9px; border-radius: 999px; font-size: 12px; margin: 2px;
}
.modal-info .btn { margin-top: 12px; }
.modal-steps { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 18px; }
.modal-steps h3 { font-size: 16px; margin-bottom: 10px; }
.modal-steps h3 small { color: var(--muted); font-weight: 400; font-size: 12px; }
.modal-steps ol { margin: 0; padding-left: 20px; }
.modal-steps li { margin-bottom: 8px; font-size: 14px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--brand); color: #05210f; font-weight: 700; font-size: 14px;
  padding: 11px 20px; border-radius: 999px; z-index: 60; box-shadow: var(--shadow);
}
.toast[hidden] { display: none; }

/* ---------- responsivo ---------- */
@media (max-width: 760px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .field-search { grid-column: 1 / -1; }
  .modal-grid { grid-template-columns: 1fr; }
  .modal-media { max-width: 260px; margin: 0 auto; }
  .brand-sub { display: none; }
}
@media (max-width: 460px) {
  .filters { grid-template-columns: 1fr; }
  .serie-thumb { width: 70px; height: 70px; }
}

/* ---------- impressão ---------- */
@media print {
  .topbar, .serie-actions, .serie-move, .filters, #view-explorar,
  .toast, .modal, .empty { display: none !important; }
  body { background: #fff; color: #000; }
  .serie-item { border: 1px solid #ccc; break-inside: avoid; }
  .serie-thumb { width: 70px; height: 70px; }
  .campo input, .serie-obs { border: 1px solid #ccc; color: #000; }
  .serie-grupo-titulo { color: #000; }
}
