/* ===========================
   Reset básico
=========================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ===========================
   Tokens de tema (Notion-like Dark)
=========================== */
:root {
  /* Base */
  --bg: #191919;                 /* fundo geral */
  --bg-elev: #202020;            /* cartões / seções elevadas */
  --text: #f0efed;               /* texto principal */
  --text-2: #cfcfca;             /* texto secundário */
  --text-3: #9e9e97;             /* texto terciário/ícones */
  --border: #2a2a2a;             /* linhas e contornos */
  --shadow: 0 2px 10px rgba(0,0,0,.35);

  /* Acentos */
  --blue: #2b6fe2;
  --blue-weak: rgba(43,111,226,.14);
  --green: #3bb273;
  --yellow: #e3b341;
  --red: #e5534b;
  --indigo: #7b61ff;

  /* Alias para seu CSS antigo (evita quebrar nomes) */
  --primary-color: var(--green);
  --primary-dark: #2f945f;
  --secondary-color: var(--blue);
  --success-color: var(--green);
  --warning-color: var(--yellow);
  --danger-color: var(--red);
  --text-dark: var(--text);
  --text-gray: var(--text-2);
  --bg-white: var(--bg-elev);
  --bg-light: rgba(255,255,255,.04);
  --border-color: var(--border);
  --shadow-lg: var(--shadow);

  /* Layout */
  --radius-md: 12px;
  --radius-lg: 16px;
  --spacing: 16px;
  --container-w: 980px;

  /* Tabela */
  --table-head: var(--bg);
  --table-row: rgba(255,255,255,.02);
  --table-row-hover: rgba(255,255,255,.06);
}

/* ===========================
   Base tipográfica
=========================== */
html, body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 ui-sans-serif, -apple-system, BlinkMacSystemFont,
        "Segoe UI Variable Display","Segoe UI", Helvetica, "Apple Color Emoji",
        Arial, "Segoe UI Emoji","Segoe UI Symbol";
  -webkit-font-smoothing: antialiased;
}

body.notion { /* apenas marcador sem regras extras */ }

.container { max-width: var(--container-w); margin: 0 auto; padding: 24px 20px 60px; }

/* ===========================
   Header
=========================== */
.header {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-elev);
  padding: 18px 20px; border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}
.header h1 { font-size: 24px; font-weight: 700; margin: 0; }
.status {
  margin-left: auto;
  background: var(--blue-weak);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px; border-radius: 999px;
  font-size: 14px; font-weight: 600;
}
.status.online { background: rgba(59,178,115,.18); color: var(--success-color); }
.status.offline { background: rgba(229,83,75,.18); color: var(--danger-color); }

/* ===========================
   Main
=========================== */
.main { display: grid; grid-template-columns: 1fr; gap: 30px; }

/* ===========================
   Seções (cards)
=========================== */
.form-section, .pages-section {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.form-section h2, .pages-section h2 { font-size: 18px; margin-bottom: 12px; }

/* ===========================
   Formulário
=========================== */
.form {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr auto;
  gap: 12px;
  align-items: end;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
label { color: var(--text-2); font-size: 13px; }

.form-group input,
.form-group select,
textarea {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
  font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-weak);
}

/* ===========================
   Botões
=========================== */
.btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 10px 14px; border-radius: 10px;
  cursor: pointer; transition: all .2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 14px;
}
.btn:hover { background: #242424; }

.btn-primary { background: var(--blue); color: #fff; border: none; }
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-secondary { background: var(--secondary-color); color: #fff; border: none; font-size: 12px; padding: 8px 12px; }
.btn-secondary:hover { filter: brightness(1.05); }

.btn-danger { background: var(--danger-color); color: #fff; border: none; font-size: 12px; padding: 8px 12px; }
.btn-danger:hover { filter: brightness(1.05); }

.btn-check { background: #3498db; color:#fff; border:none; font-size:12px; padding:8px 12px; }
.btn-check:hover { filter: brightness(1.05); }
.btn-check:disabled { background: #95a5a6; cursor: not-allowed; opacity: .7; }

.import-export-buttons { display: flex; gap: 10px; margin-left: auto; }
.btn-export { background: var(--success-color); color:#fff; border:none; font-size:13px; padding:10px 16px; }
.btn-export:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-import { background: var(--indigo); color:#fff; border:none; font-size:13px; padding:10px 16px; }
.btn-import:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: var(--shadow); }

/* ===========================
   Tabela
=========================== */
.table-container { overflow-x: auto; border-radius: var(--radius-lg); border:1px solid var(--border); }
.pages-table {
  width: 100%; min-width: 900px;
  border-collapse: separate; border-spacing: 0;
  background: var(--bg-elev);
  font-size: 14px;
}
.pages-table thead th {
  position: sticky; top: 0;
  background: var(--table-head);
  color: var(--text-2);
  text-align: left; font-weight: 600; font-size: 14px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.pages-table td {
  padding: 12px; border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.pages-table tbody tr:hover { background: var(--table-row-hover); }
.pages-table .empty-state { text-align:center; color: var(--text-3); font-style: italic; }
.pages-table .empty-state:hover { background: transparent; }

.name-cell { font-size: 14px; color: var(--text); max-width: 150px; word-wrap: break-word; }
.url-cell  { font-family: 'Courier New', monospace; word-break: break-all; max-width: 220px; font-size: 11px; }
.link-cell { max-width: 200px; }

/* Link WhatsApp “pill” */
.whatsapp-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  text-decoration: none; font-size: 12px; font-weight: 600;
  color: #fff; background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  transition: transform .15s, box-shadow .15s;
}
.whatsapp-link:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(37,211,102,.35); }
.no-link { color: var(--text-3); font-size: 12px; font-style: italic; }

/* Badges */
.frequency-badge {
  display: inline-block; padding: 4px 8px; border-radius: 999px;
  background: var(--bg-light); color: var(--text-2); font-size: 12px; font-weight: 600;
}
.status-badge {
  display: inline-block; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
  border: 1px solid var(--border);
}
.status-badge.active   { background: rgba(59,178,115,.18); color: var(--success-color); }
.status-badge.inactive { background: rgba(229,83,75,.18);  color: var(--danger-color); }

.actions-cell { display: flex; gap: 8px; }

/* ===========================
   Modal
=========================== */
.modal {
  display: none; position: fixed; z-index: 1000; inset: 0;
  background: rgba(0,0,0,.5); animation: fadeIn .2s;
}
.modal.open { display: flex; align-items: center; justify-content: center; }

.modal-content {
  background: var(--bg-elev); color: var(--text);
  border-radius: var(--radius-lg);
  max-width: 600px; width: 90%;
  max-height: 80vh; overflow-y: auto;
  box-shadow: var(--shadow); animation: slideIn .2s;
  border: 1px solid var(--border);
}
.modal-header {
  display:flex; justify-content: space-between; align-items:center;
  padding: 18px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; }
.close { font-size: 26px; font-weight: 700; color: var(--text-3); cursor: pointer; }
.close:hover { color: var(--text); }
.modal-body { padding: 18px; }

/* Histórico */
.history-content { max-height: 500px; overflow-y: auto; padding: 5px; }
.history-entry {
  background: var(--bg-light); padding: 15px; margin-bottom: 15px;
  border-radius: 10px; border: 1px solid var(--border);
  transition: transform .15s, box-shadow .15s;
}
.history-entry:hover { transform: translateX(1px); box-shadow: var(--shadow); }
.history-entry.changed { border-left: 4px solid var(--yellow); background: rgba(227,179,65,.09); }
.history-entry.current-entry { border-left: 6px solid var(--green); background: rgba(59,178,115,.09); }
.history-header { display:flex; justify-content: space-between; align-items:center; gap:10px; margin-bottom:10px; }
.history-timestamp { font-size: 12px; color: var(--text-3); font-weight: 600; display:flex; align-items:center; gap:8px; }
.current-badge { display:inline-block; padding:3px 8px; background: var(--green); color:#fff; border-radius:12px; font-size:10px; text-transform:uppercase; font-weight:700; }
.history-changed { display:inline-block; padding:4px 8px; background: var(--yellow); color:#111; border-radius: 999px; font-size: 11px; font-weight: 700; }
.history-links { display:flex; flex-direction:column; gap:8px; }
.history-link {
  padding: 10px 12px; border-radius: 8px; background: var(--bg);
  border: 1px solid var(--border); font-family:'Courier New', monospace;
  font-size: 12px; word-break: break-all; color: var(--text); text-decoration: none;
}
.history-link:hover { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-weak); background:#1c1c1c; }
.no-link-found { background: rgba(229,83,75,.10); border:1px solid var(--danger-color); color: var(--danger-color); font-style: italic; }
.no-history { text-align:center; color: var(--text-3); padding: 30px; font-style: italic; }

/* ===========================
   Importação
=========================== */
.import-instructions {
  background: var(--bg-light); padding: 15px; border-radius: 10px; margin-bottom: 18px;
}
.import-instructions h3 { font-size: 16px; margin-bottom: 10px; color: var(--text); }
.import-instructions p { font-size: 13px; color: var(--text-3); margin: 10px 0; }
.code-example {
  background: var(--bg); padding: 10px; border-radius: 8px; margin: 10px 0;
  border-left: 3px solid var(--blue);
}
.code-example code { font-family:'Courier New', monospace; font-size: 12px; color: var(--text-2); display:block; margin:5px 0; }

.import-input-area { margin-bottom: 18px; }
.import-input-area label { display:block; font-size:14px; font-weight:600; margin-bottom:8px; color: var(--text-2); }
.import-input-area textarea {
  width:100%; padding:12px; border:1px solid var(--border); border-radius:10px;
  font-family:'Courier New', monospace; font-size:12px; resize: vertical;
  background: var(--bg); color: var(--text);
}
.import-input-area textarea:focus { outline:none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-weak); }

.import-actions { display:flex; gap:10px; justify-content:flex-end; margin-bottom: 10px; }
.import-result { margin-top: 10px; }
.import-summary { padding: 15px; border-radius: 10px; background: var(--bg-light); }
.import-success { padding:10px; background: rgba(59,178,115,.18); color: var(--success-color); border-radius: 8px; margin-bottom: 8px; font-weight: 700; }
.import-errors  { padding:10px; background: rgba(229,83,75,.18); color: var(--danger-color); border-radius: 8px; margin-bottom: 8px; font-weight: 700; }
.error-list { list-style:none; margin-top: 8px; }
.error-list li { padding: 10px; background: var(--bg); border-left: 3px solid var(--danger-color); margin-bottom: 8px; border-radius: 6px; font-size: 12px; }
.error-list code { display:block; margin-top:5px; padding:6px; background: var(--bg-light); border-radius:4px; color: var(--text-3); }

/* ===========================
   Edit Modal
=========================== */
.edit-form { display:flex; flex-direction:column; gap: 16px; }
.edit-form .form-group { display:flex; flex-direction:column; gap:6px; }
.edit-actions { display:flex; gap:10px; justify-content:flex-end; margin-top:6px; }

/* ===========================
   Animações
=========================== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===========================
   Responsivo
=========================== */
@media (max-width: 1024px) {
  .form { grid-template-columns: 1fr 1fr; }
  .form .btn { grid-column: span 2; }
}

@media (max-width: 768px) {
  .header { flex-direction: column; text-align: center; }
  .header h1 { font-size: 22px; }
  .form { grid-template-columns: 1fr; }
  .form .btn { grid-column: span 1; }
  .btn { width: 100%; }
  .pages-table { font-size: 12px; }
  .pages-table th, .pages-table td { padding: 10px 8px; }
  .name-cell { max-width: 120px; }
  .url-cell { max-width: 160px; }
  .link-cell { max-width: 140px; }
  .actions-cell { flex-direction: column; }
  .modal-content { width: 95%; }
}

@media (max-width: 480px) {
  .container { padding: 16px 12px 40px; }
  .header { padding: 16px; }
  .header h1 { font-size: 20px; }
  .form-section, .pages-section { padding: 16px; }
  .pages-table { font-size: 11px; }
  .pages-table th, .pages-table td { padding: 8px 6px; }
  .btn-secondary, .btn-danger { font-size: 11px; padding: 6px 10px; }
}

/* ===========================
   Loading
=========================== */
.spinner {
  border: 3px solid var(--bg-light);
  border-top: 3px solid var(--blue);
  border-radius: 50%;
  width: 20px; height: 20px;
  animation: spin 1s linear infinite;
  display: inline-block;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.loading { display:flex; align-items:center; gap:10px; color: var(--text-3); }
/* ---------- Notion-like Hero (full bleed) ---------- */
:root {
  /* largura igual ao Notion (aprox.) */
  --container-w: 1120px;
}

/* full-bleed: ocupa a largura total da janela, sem quebrar seu container */
.hero{
  position: relative;
  width: 100vw;
  height: 240px;             /* ajuste: 200–280 para variar a altura */
  left: 50%; right: 50%;
  margin-left: -50vw; margin-right: -50vw;
  overflow: hidden;
  background: #111;
}

.hero__image{
  position: absolute; inset: 0;
  background-image: var(--hero-url, none);
  background-size: cover; background-position: center;
  filter: saturate(1.15) contrast(1.05) brightness(.8);
}
.hero::after{
  content:"";
  position:absolute; inset:0;
  background: linear-gradient(180deg, rgba(0,0,0,.12), rgba(0,0,0,.45));
}

.hero__content{
  position: relative;
  max-width: var(--container-w);
  margin: 0 auto;
  height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; text-align: center;
}

.hero__icon{
  font-size: 44px;
  background: rgba(0,0,0,.35);
  padding: 6px 12px;
  border-radius: 12px;
  backdrop-filter: blur(4px);
}

.hero__title{
  font-size: 36px;           /* Notion usa títulos grandes e pesados */
  font-weight: 800;
  margin: 0;
}

.hero__subtitle{
  color: var(--text-3);
  font-weight: 600;
  margin: 0;
}

/* opcional: deixa a seção seguinte “grudar” no banner como no Notion */
.header { margin-top: 18px; }
/* Linhas verticais leves entre colunas */
.pages-table th + th,
.pages-table td + td { border-left: 1px solid rgba(255,255,255,.04); }

/* Truncamento elegante com ellipsis nas células longas */
.name-cell, .url-cell, .link-cell {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
