/* ─────────────────────────────────────────────
   Ficheiro: /instagram-report/assets/css/style.css
───────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --ig1: #833ab4; --ig2: #fd1d1d; --ig3: #fcb045;
  --grad: linear-gradient(135deg, var(--ig1), var(--ig2), var(--ig3));

  --bg:      #f5f6f8;
  --surface: #ffffff;
  --border:  #e8eaed;
  --border2: #f0f1f3;
  --text:    #1a1a2e;
  --muted:   #8a8fa8;
  --subtle:  #f8f9fb;

  --pink:   #e91e8c;
  --blue:   #2563eb;
  --green:  #16a34a;
  --yellow: #d97706;
  --red:    #dc2626;
  --purple: #7c3aed;

  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,.08), 0 8px 32px rgba(0,0,0,.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* ── Navbar ──────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--border);
}

.nav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
}

.nav-brand-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.nav-brand-name { font-weight: 700; font-size: 15px; }

.nav-links { display: flex; gap: 2px; }

.nav-link {
  padding: 6px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  color: var(--muted); text-decoration: none;
  transition: all .18s; position: relative;
}

.nav-link:hover {
  color: var(--text);
  background: var(--subtle);
}

.nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, #833ab4, #fd1d1d);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(131,58,180,.35);
}

.nav-link.active:hover {
  opacity: .92;
  background: linear-gradient(135deg, #833ab4, #fd1d1d);
}

.nav-user { display: flex; align-items: center; gap: 10px; }

.nav-conta-ativa {
  font-size: 12px; font-weight: 600; color: var(--green);
  background: #f0fdf4; border: 1px solid #bbf7d0;
  padding: 4px 10px; border-radius: 20px;
}

.nav-conta-vazia {
  font-size: 12px; color: var(--yellow);
  background: #fffbeb; border: 1px solid #fde68a;
  padding: 4px 10px; border-radius: 20px;
  text-decoration: none;
}

.nav-logout {
  color: var(--muted); text-decoration: none;
  font-size: 13px; padding: 5px 12px;
  border-radius: 8px; border: 1px solid var(--border);
  transition: all .15s;
}

.nav-logout:hover { color: var(--red); border-color: #fecaca; background: #fef2f2; }

/* ── Layout ──────────────────────────────────── */
.main-layout { display: flex; flex: 1; }

.sidebar {
  width: 280px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex; flex-direction: column; gap: 20px;
  height: calc(100vh - 58px);
  position: sticky; top: 58px;
  overflow-y: auto;
}

.content { flex: 1; padding: 24px; overflow: hidden; }

/* ── Section label ───────────────────────────── */
.section-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 10px;
}

/* ── Add Post ────────────────────────────────── */
.add-post-card {
  background: var(--subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.input-url {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.input-url:focus {
  border-color: #c084fc;
  box-shadow: 0 0 0 3px #f3e8ff;
}

.input-url::placeholder { color: var(--muted); }

.btn-add {
  margin-top: 8px; width: 100%;
  padding: 9px;
  background: linear-gradient(135deg, #833ab4, #fd1d1d);
  color: #fff; border: none;
  border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: opacity .15s, transform .1s;
}

.btn-add:hover  { opacity: .9; }
.btn-add:active { transform: scale(.98); }
.btn-add:disabled { opacity: .5; cursor: not-allowed; }

.add-status { margin-top: 8px; font-size: 12px; min-height: 16px; }
.add-status.ok  { color: var(--green); }
.add-status.err { color: var(--red); }

/* ── Stats mini ──────────────────────────────── */
.stats-summary {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}

.stat-mini {
  background: var(--subtle);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 12px;
}

.stat-mini-label { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.stat-mini-value { font-size: 17px; font-weight: 700; font-family: 'DM Mono', monospace; line-height: 1; }

/* ── Report buttons ──────────────────────────── */
.report-actions { display: flex; flex-direction: column; gap: 6px; }

.btn-report {
  padding: 9px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border);
  font-family: inherit; text-decoration: none;
  display: flex; align-items: center; gap: 8px;
  transition: all .15s; color: var(--text);
  background: var(--surface);
}

.btn-report:hover  { background: var(--subtle); }
.btn-report.full   { background: linear-gradient(135deg,#833ab4,#fd1d1d); color:#fff; border:none; }
.btn-report.full:hover { opacity: .9; }
.btn-report.csv    { color: var(--green); }
.btn-report.pdf    { color: var(--blue); }

/* ── Table header ────────────────────────────── */
.table-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 14px; flex-wrap: wrap; gap: 10px;
}

.table-title { font-size: 16px; font-weight: 700; }

.table-count {
  font-size: 12px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 20px;
}

/* ── Table wrapper (sticky header) ──────────── */
.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
  max-height: calc(100vh - 200px);
}

/* ── Posts table ─────────────────────────────── */
.posts-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}

.posts-table thead th {
  position: sticky; top: 0; z-index: 10;
  text-align: left; padding: 10px 14px;
  background: #fafbfc;
  color: var(--muted); font-size: 11px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 var(--border);
  white-space: nowrap;
}

.posts-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border2);
  vertical-align: middle;
}

.posts-table tbody tr:last-child td { border-bottom: none; }
.posts-table tbody tr:hover td { background: #fafbfc; }

.post-thumb {
  width: 40px; height: 40px;
  object-fit: cover; border-radius: 7px;
  background: var(--subtle); display: block;
  border: 1px solid var(--border);
}

.post-caption {
  max-width: 200px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  color: var(--muted); font-size: 12px; margin-top: 3px;
}

.badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 20px; font-size: 11px; font-weight: 600;
}

.badge-image    { background: #eff6ff; color: #2563eb; }
.badge-video    { background: #f5f3ff; color: #7c3aed; }
.badge-carousel { background: #f0fdf4; color: #16a34a; }

.num { font-family: 'DM Mono', monospace; }

.eng-bar {
  width: 52px; height: 4px;
  border-radius: 2px; background: var(--border);
  overflow: hidden; display: inline-block;
  vertical-align: middle; margin-left: 6px;
}

.eng-fill { height: 100%; border-radius: 2px; background: var(--grad); }

.btn-del {
  background: none; border: none; color: var(--muted);
  cursor: pointer; padding: 4px 6px; border-radius: 6px;
  font-size: 13px; transition: all .15s;
}

.btn-del:hover { color: var(--red); background: #fef2f2; }

/* ── Checkbox ────────────────────────────────── */
.cb-wrap { display: flex; align-items: center; justify-content: center; }
input[type=checkbox] { width: 15px; height: 15px; accent-color: #833ab4; cursor: pointer; }

/* ── Selection bar ───────────────────────────── */
.selection-bar {
  display: none; align-items: center; gap: 10px;
  background: #faf5ff; border: 1px solid #e9d5ff;
  border-radius: 10px; padding: 8px 14px;
  margin-bottom: 12px; font-size: 13px;
  animation: slideDown .2s ease;
}

.selection-bar.visible { display: flex; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sel-count { font-weight: 600; color: var(--purple); }

.btn-del-sel {
  background: #fff; color: var(--red);
  border: 1px solid #fecaca; padding: 5px 12px;
  border-radius: 7px; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: all .15s; margin-left: auto;
}

.btn-del-sel:hover { background: #fef2f2; }

.btn-desel {
  background: none; border: none; color: var(--muted);
  font-size: 12px; cursor: pointer; font-family: inherit; padding: 4px 6px;
}

.btn-desel:hover { color: var(--text); }

tr.selected td { background: #faf5ff !important; }

/* ── Empty state ─────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--muted);
}

.empty-state-icon { font-size: 48px; margin-bottom: 14px; display: block; opacity: .4; }
.empty-state h3   { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.empty-state p    { font-size: 13px; }

/* ── Login ───────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px; padding: 44px 36px;
  width: 100%; max-width: 400px;
  text-align: center; box-shadow: var(--shadow-md);
}

.login-icon {
  width: 64px; height: 64px; border-radius: 18px;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; margin: 0 auto 20px;
}

.login-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-card > p { color: var(--muted); font-size: 13px; line-height: 1.6; margin-bottom: 24px; }

.login-erro {
  background: #fef2f2; border: 1px solid #fecaca;
  color: var(--red); padding: 9px 12px;
  border-radius: 8px; font-size: 13px;
  margin-bottom: 14px; text-align: left;
}

.form-group { text-align: left; margin-bottom: 12px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 5px; }
.login-note { font-size: 11px; color: var(--muted); margin-top: 18px; line-height: 1.6; }

/* ── Contas page ─────────────────────────────── */
.conta-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  display: flex; align-items: center;
  justify-content: space-between; gap: 14px;
  box-shadow: var(--shadow); transition: border-color .15s;
}

.conta-card.ativa { border-color: #bbf7d0; background: #f0fdf4; }

.conta-info { display: flex; align-items: center; gap: 12px; }

.conta-avatar {
  width: 40px; height: 40px; background: var(--subtle);
  border: 1px solid var(--border); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}

.conta-nome  { font-size: 14px; font-weight: 600; }
.conta-user  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.conta-id    { font-size: 11px; color: var(--border); font-family: 'DM Mono', monospace; margin-top: 2px; }
.conta-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.badge-ativa {
  background: #f0fdf4; color: var(--green);
  border: 1px solid #bbf7d0;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}

.btn-ativar {
  background: #eff6ff; color: var(--blue);
  border: 1px solid #bfdbfe;
  padding: 4px 12px; border-radius: 7px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all .15s;
}

.btn-ativar:hover { background: #dbeafe; }

.btn-editar {
  background: none; border: none; color: var(--muted);
  cursor: pointer; padding: 4px 7px; border-radius: 6px;
  font-size: 13px; transition: all .15s;
}

.btn-editar:hover { color: var(--yellow); background: #fffbeb; }

/* ── Modal ───────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
  backdrop-filter: blur(2px);
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px; width: 100%; max-width: 480px;
  box-shadow: var(--shadow-md);
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 15px; font-weight: 700; }
.modal-body   { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ── Spinner / Toast ─────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

#toast {
  position: fixed; bottom: 20px; right: 20px;
  padding: 10px 18px; border-radius: 9px;
  font-size: 13px; font-weight: 500;
  z-index: 999; opacity: 0;
  transform: translateY(6px); transition: all .25s;
  pointer-events: none; box-shadow: var(--shadow-md);
}

#toast.show { opacity: 1; transform: translateY(0); }
#toast.ok   { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--green); }
#toast.err  { background: #fef2f2; border: 1px solid #fecaca; color: var(--red); }

/* ── Scrollbar ───────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Import page ─────────────────────────────── */
.import-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 36px;
  width: 100%; max-width: 540px; margin: 0 auto;
  box-shadow: var(--shadow);
}

.drop-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: all .2s; position: relative;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: #c084fc; background: #faf5ff;
}

.drop-zone input[type=file] {
  position: absolute; inset: 0; opacity: 0;
  cursor: pointer; width: 100%; height: 100%;
}

.drop-icon   { font-size: 40px; margin-bottom: 10px; display: block; }
.drop-label  { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.drop-sub    { font-size: 12px; color: var(--muted); }
.file-selected { font-size: 12px; color: var(--green); margin-top: 8px; font-family: 'DM Mono', monospace; }

.result-box    { border-radius: 12px; padding: 20px; margin-top: 20px; }
.result-box.ok  { background: #f0fdf4; border: 1px solid #bbf7d0; }
.result-box.err { background: #fef2f2; border: 1px solid #fecaca; }

.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }

.result-stat {
  background: var(--surface); border-radius: 9px;
  padding: 12px; text-align: center; border: 1px solid var(--border);
}

.result-stat-val   { font-size: 26px; font-weight: 700; font-family: 'DM Mono', monospace; }
.result-stat-label { font-size: 11px; color: var(--muted); margin-top: 3px; }

.col-list {
  font-size: 11px; color: var(--muted);
  background: var(--subtle); border-radius: 9px;
  padding: 12px; margin-top: 14px; line-height: 1.9;
  font-family: 'DM Mono', monospace;
  border: 1px solid var(--border);
}

/* ── Pass page ───────────────────────────────── */
.pass-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 36px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow);
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 900px) {
  .main-layout  { flex-direction: column; }
  .sidebar      { width: 100%; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--border); }
  .content      { padding: 16px; }
  .navbar       { padding: 0 14px; }
  .post-caption { max-width: 120px; }
  .nav-links    { display: none; }
}