/* =============================================
   Cadê o Jogo — Admin Panel
   ============================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-2: #22273a;
  --border: #2e3347;
  --accent: #4f8ef7;
  --accent-hover: #3b76e0;
  --danger: #e05252;
  --success: #4caf82;
  --warning: #e0a952;
  --text: #e8eaf0;
  --text-muted: #7a8099;
  --radius: 8px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

/* NAVBAR */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand { font-size: 16px; font-weight: 700; color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a { color: var(--text); text-decoration: none; }
.nav-links a:hover { color: var(--accent); }
.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}
.btn-link:hover { color: var(--danger); }

/* CONTAINER */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 24px; }

/* SECTIONS */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.section h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: var(--text); }
.section h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }

/* TABS */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 8px 16px;
  margin-bottom: -1px;
  transition: all 0.15s;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* TABLE */
.match-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.match-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.match-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.match-table tr:last-child td { border-bottom: none; }
.match-table tr:hover td { background: var(--surface-2); }
.match-teams { font-weight: 600; }

/* TAGS */
.tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  margin: 1px;
}
.tag-free { background: #1a3a2a; color: #4caf82; border: 1px solid #2a5a3a; }
.tag-paid { background: #2a2a1a; color: #e0c052; border: 1px solid #3a3a1a; }
.tag-manual { background: #2a1a3a; color: #b052e0; border: 1px solid #3a1a5a; }

/* BADGES */
.badge { font-size: 11px; padding: 2px 6px; border-radius: 4px; }
.badge-ok { background: #1a3a2a; color: #4caf82; }
.badge-pending { background: #2a2a1a; color: #e0c052; }
.badge-empty { background: var(--surface-2); color: var(--text-muted); }

/* ALERTS */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
}
.alert-success { background: #1a3a2a; color: #4caf82; border: 1px solid #2a5a3a; }
.alert-error { background: #3a1a1a; color: #e05252; border: 1px solid #5a2a2a; }

/* FORMS */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 120px; }
input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; font-family: var(--font); }
.hint { color: var(--text-muted); font-size: 11px; margin-top: 4px; display: block; }

.checkbox-group { display: flex; flex-direction: column; gap: 8px; }
.checkbox-group label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); font-weight: 400; cursor: pointer; }
.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn:hover { background: var(--border); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.85; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* SETTINGS GRID */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .settings-grid { grid-template-columns: 1fr; } }
.settings-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/* DISPATCH FORM */
.dispatch-form { max-width: 640px; }

/* LOGIN */
.login-box {
  max-width: 360px;
  margin: 80px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.login-box h1 { font-size: 28px; text-align: center; margin-bottom: 4px; }
.login-box h2 { font-size: 14px; color: var(--text-muted); text-align: center; margin-bottom: 24px; font-weight: 400; }

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 480px;
}
.modal-box h3 { margin-bottom: 8px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }

.text-muted { color: var(--text-muted); font-size: 12px; }

/* RESPONSIVE LAYOUT */
html { min-width: 320px; }
body { overflow-x: hidden; }
.tab-content { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.match-table { min-width: 820px; }

/* Wrapper interno de cada célula. Em desktop é transparente (inline);
   em mobile vira flex-wrap para nunca furar o grid da célula, mesmo
   quando a célula tem vários elementos-irmãos (ex: várias tags). */
.match-table td .cell-content { display: contents; }

@media (max-width: 700px) {
  html,
  body { width: 100%; max-width: 100%; overflow-x: clip; }

  .navbar {
    min-height: 56px;
    height: auto;
    padding: 10px 16px;
    gap: 8px 16px;
    flex-wrap: wrap;
  }
  .nav-brand { font-size: 15px; }
  .nav-links { gap: 14px; margin-left: auto; }

  .container { width: 100%; padding: 18px 14px; }
  .page-title { font-size: 22px; margin-bottom: 18px; }
  .section { padding: 16px; margin-bottom: 16px; }
  .section h2 { font-size: 15px; }

  .tabs { gap: 4px; }
  .tab-btn { flex: 1; padding: 9px 8px; }

  .settings-grid { grid-template-columns: 1fr; gap: 14px; }
  .form-row { flex-direction: column; gap: 0; }
  .form-row .form-group { width: 100%; min-width: 0; }
  .dispatch-form { max-width: none; }

  .btn { min-height: 40px; justify-content: center; }
  .btn-sm { min-height: 36px; }
  .dispatch-form > .btn,
  .settings-card form > .btn { width: 100%; }

  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="datetime-local"],
  textarea,
  select { font-size: 16px; }

  .login-box { width: calc(100% - 28px); margin: 36px auto; padding: 24px 20px; }
  .modal { padding: 12px; }
  .modal-box { max-height: calc(100dvh - 24px); overflow-y: auto; padding: 20px; }

  /* Render each match as a labeled card instead of a wide table row. */
  .match-table { display: block; width: 100%; min-width: 0; table-layout: fixed; }
  .match-table thead { display: none; }
  .tab-content,
  .match-table,
  .match-table tbody,
  .match-table tr,
  .match-table td { min-width: 0; max-width: 100%; }
  .tab-content.active { overflow-x: clip; }
  .match-table tbody { display: block; width: 100%; }
  .match-table tr {
    display: block;
    width: 100%;
    margin-bottom: 12px;
    overflow: hidden;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .match-table td {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
    width: 100%;
    padding: 9px 10px;
    border-bottom: 1px solid var(--border);
    overflow-wrap: anywhere;
  }
  .match-table td::before {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .match-table td:nth-child(1)::before { content: "Partida"; }
  .match-table td:nth-child(2)::before { content: "Competi\00e7\00e3o"; }
  .match-table td:nth-child(3)::before { content: "Hor\00e1rio (GMT-3)"; }
  .match-table td:nth-child(4)::before { content: "Situa\00e7\00e3o do jogo"; }
  .match-table td:nth-child(5)::before { content: "Transmiss\00f5es"; }
  .match-table td:nth-child(6)::before { content: "Status da transmiss\00e3o"; }
  .match-table td:nth-child(7)::before { content: "A\00e7\00e3o"; }
  .match-table td .cell-content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .match-table td .cell-content > * { min-width: 0; max-width: 100%; }
  .match-table .tag { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .match-table tr:hover td { background: transparent; }

  /* Correção do vazamento: em mobile o .cell-content vira o único
     item de grid da célula (junto com ::before) e ele mesmo se
     encarrega, via flex-wrap, de acomodar múltiplos filhos (tags,
     badges, botões) sem nunca invadir a coluna do rótulo. */
  .match-table td .cell-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-width: 0;
  }
}

@media (max-width: 420px) {
  .navbar { align-items: flex-start; }
  .nav-links { width: 100%; justify-content: space-between; margin-left: 0; }
  .container { padding: 14px 10px; }
  .section { padding: 14px 12px; }
  .tabs { width: 100%; }
  .tab-btn { font-size: 13px; }
  .alert { padding: 10px 12px; overflow-wrap: anywhere; }
}
