/* ============================================
   SENTINELA v2.0 - Design System Modernizado
   ============================================ */

:root {
  --bg: #0a0d12;
  --bg-elev: #111520;
  --bg-card: #161b28;
  --bg-card-hover: #1c2235;
  --fg: #e8eaf0;
  --fg-muted: #7a849a;
  --border: #242a3a;
  --border-light: #2d3448;
  
  /* Cores semânticas */
  --primary: #4c8bf5;
  --primary-hover: #6aa1ff;
  --primary-glow: rgba(76,139,245,.12);
  --danger: #e25c5c;
  --danger-glow: rgba(226,92,92,.12);
  --warning: #e0a64c;
  --warning-glow: rgba(224,166,76,.12);
  --success: #4cb47a;
  --success-glow: rgba(76,180,122,.12);
  --pink: #ff0fcb;
  --purple: #a855f7;
  
  /* Layout */
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px -8px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 48px -12px rgba(0,0,0,.6);
  
  /* Tipografia */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ============ LAYOUT ============ */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; width: 100%; }
main.container { flex: 1; padding-top: 28px; padding-bottom: 48px; }

/* ============ TOPBAR ============ */
.topbar {
  background: rgba(17,21,32,.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar__inner {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; padding-bottom: 12px; gap: 24px;
}
.brand {
  font-weight: 700; font-size: 18px; color: var(--fg);
  text-decoration: none; display: inline-flex; align-items: center; gap: 10px;
  white-space: nowrap;
}
.brand__mark { 
  color: var(--primary); 
  background: var(--primary-glow);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 16px;
}
.brand small {
  font-size: 11px; color: var(--fg-muted); font-weight: 400;
  display: block; margin-top: -2px;
}

.nav { display: flex; gap: 2px; align-items: center; }
.nav a {
  color: var(--fg-muted); text-decoration: none; font-size: 13px; font-weight: 500;
  padding: 8px 12px; border-radius: var(--radius-sm);
  transition: all .15s; white-space: nowrap;
}
.nav a:hover { color: var(--fg); background: rgba(255,255,255,.05); }
.nav a.active { color: var(--primary); background: var(--primary-glow); }

/* ============ NAV DROPDOWN ============ */
.nav__group { position: relative; }
.nav__group::after { content: ''; position: absolute; top: 100%; left: 0; right: 0; height: 8px; }
.nav__group-toggle {
  color: var(--fg-muted); text-decoration: none; font-size: 13px; font-weight: 500;
  padding: 8px 12px; border-radius: var(--radius-sm);
  transition: all .15s; white-space: nowrap; display: flex; align-items: center; gap: 4px;
  cursor: pointer; user-select: none;
}
.nav__group-toggle::after { content: '\25BE'; font-size: 10px; opacity: .5; }
.nav__group:hover .nav__group-toggle,
.nav__group-toggle:hover { color: var(--fg); background: rgba(255,255,255,.05); }
.nav__dropdown {
  display: none; position: absolute; top: 100%; left: 0; z-index: 200;
  min-width: 200px; padding: 6px; margin-top: 4px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.nav__group:hover > .nav__dropdown { display: block; }
.nav__dropdown a {
  display: block; padding: 8px 12px; font-size: 13px; font-weight: 400;
  color: var(--fg-muted); text-decoration: none; border-radius: var(--radius-sm);
  transition: all .12s; white-space: nowrap;
}
.nav__dropdown a:hover { color: var(--fg); background: rgba(255,255,255,.06); }
.nav__dropdown a.active { color: var(--primary); background: var(--primary-glow); }

[data-theme="light"] .nav__group-toggle:hover { background: rgba(0,0,0,.04); }
[data-theme="light"] .nav__dropdown { background: #fff; border-color: var(--border); }
[data-theme="light"] .nav__dropdown a:hover { background: rgba(0,0,0,.04); }

.user { display: flex; align-items: center; gap: 12px; font-size: 13px; white-space: nowrap; }
.user span { color: var(--fg-muted); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  text-decoration: none; font-weight: 500; font-size: 14px; font-family: var(--font);
  border: 1px solid transparent; cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn--primary:hover { background: var(--primary-hover); box-shadow: 0 0 20px rgba(76,139,245,.3); }
.btn--ghost { background: transparent; color: var(--fg-muted); border-color: var(--border); }
.btn--ghost:hover { color: var(--fg); border-color: var(--fg-muted); background: rgba(255,255,255,.03); }
.btn--danger { background: var(--danger); color: white; }
.btn--danger:hover { background: #cc4444; }
.btn--success { background: var(--success); color: white; }
.btn--success:hover { background: #3da06a; }
.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--xs { padding: 4px 8px; font-size: 11px; border-radius: 4px; }
.btn--lg { padding: 14px 28px; font-size: 16px; }

.btn--gradient-pink {
  background: linear-gradient(135deg, #c30099, #ff0fcb);
  border: 0; color: white;
}
.btn--gradient-pink:hover { box-shadow: 0 0 24px rgba(255,15,203,.35); }

.btn--gradient-green {
  background: linear-gradient(135deg, #00a86b, #22d39a);
  border: 0; color: white;
}
.btn--gradient-green:hover { box-shadow: 0 0 24px rgba(34,211,154,.3); }

/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  transition: border-color .2s;
}
.card:hover { border-color: var(--border-light); }
.card h2 { margin-top: 0; font-size: 16px; font-weight: 600; }
.card h3 { margin-top: 0; font-size: 15px; }

/* ============ FORMS ============ */
.form { max-width: 420px; margin: 40px auto; }
.form .card { padding: 32px; }
label { display: block; margin-bottom: 14px; font-size: 14px; }
label span { display: block; margin-bottom: 6px; color: var(--fg-muted); font-weight: 500; }

input[type=text], input[type=email], input[type=password], input[type=url],
input[type=number], input[type=date], textarea, select {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--fg);
  font-family: var(--font); font-size: 14px; transition: all .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
textarea { resize: vertical; min-height: 80px; }
select { cursor: pointer; }

.form-actions { margin-top: 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* ============ TABLES ============ */
table.data {
  width: 100%; border-collapse: collapse;
  background: var(--bg-card); border-radius: var(--radius); overflow: hidden;
}
table.data th, table.data td {
  padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
table.data th {
  background: var(--bg-elev); color: var(--fg-muted);
  font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: rgba(255,255,255,.02); }

/* ============ BADGES ============ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.badge--nova       { background: rgba(76,139,245,.15); color: var(--primary); }
.badge--em-triagem { background: rgba(224,166,76,.15); color: var(--warning); }
.badge--aprovada   { background: rgba(76,180,122,.15); color: var(--success); }
.badge--dmca       { background: rgba(168,85,247,.15); color: var(--purple); }
.badge--dmca-enviado { background: rgba(168,85,247,.2); color: var(--purple); }
.badge--removida   { background: rgba(76,180,122,.25); color: var(--success); }
.badge--falso      { background: rgba(122,132,154,.15); color: var(--fg-muted); }
.badge--rejeitada  { background: rgba(226,92,92,.15); color: var(--danger); }
.badge--reincidente { background: rgba(255,15,203,.15); color: var(--pink); }

/* ============ ALERTS ============ */
.alert {
  padding: 14px 18px; border-radius: var(--radius);
  margin-bottom: 16px; font-size: 14px; display: flex; align-items: flex-start; gap: 10px;
}
.alert--error   { background: var(--danger-glow); color: var(--danger); border: 1px solid rgba(226,92,92,.25); }
.alert--success { background: var(--success-glow); color: var(--success); border: 1px solid rgba(76,180,122,.25); }
.alert--info    { background: var(--primary-glow); color: var(--primary); border: 1px solid rgba(76,139,245,.25); }
.alert--warning { background: var(--warning-glow); color: var(--warning); border: 1px solid rgba(224,166,76,.25); }

/* ============ METRICS GRID ============ */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 24px; }
.metric {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  transition: all .2s;
}
.metric:hover { border-color: var(--border-light); transform: translateY(-1px); }
.metric__label {
  color: var(--fg-muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em; font-weight: 500;
}
.metric__value { font-size: 30px; font-weight: 700; margin-top: 6px; line-height: 1.1; }
.metric__delta {
  font-size: 12px; margin-top: 4px; font-weight: 500;
}
.metric__delta--up { color: var(--success); }
.metric__delta--down { color: var(--danger); }

/* ============ PIPELINE (Steps visual) ============ */
.pipeline {
  display: flex; gap: 0; margin-bottom: 24px; overflow-x: auto;
}
.pipeline__step {
  flex: 1; min-width: 140px;
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 18px 20px; position: relative; text-decoration: none; color: var(--fg);
  transition: all .2s;
}
.pipeline__step:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.pipeline__step:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.pipeline__step:hover { background: var(--bg-card-hover); border-color: var(--primary); z-index: 1; }
.pipeline__step.active { background: var(--primary-glow); border-color: var(--primary); }
.pipeline__step__num {
  font-size: 11px; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: .08em;
}
.pipeline__step__title { font-size: 15px; font-weight: 600; margin: 4px 0; }
.pipeline__step__count { font-size: 22px; font-weight: 700; color: var(--primary); }
.pipeline__step__desc { font-size: 12px; color: var(--fg-muted); margin-top: 4px; }

/* ============ PROGRESS BAR ============ */
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress__bar { height: 100%; border-radius: 3px; transition: width .3s ease; }
.progress__bar--primary { background: var(--primary); }
.progress__bar--success { background: var(--success); }
.progress__bar--warning { background: var(--warning); }
.progress__bar--danger { background: var(--danger); }

/* ============ STATUS DOT ============ */
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 6px;
}
.status-dot--active { background: var(--success); box-shadow: 0 0 8px rgba(76,180,122,.5); }
.status-dot--pending { background: var(--warning); }
.status-dot--error { background: var(--danger); }

/* ============ URL PREVIEW ============ */
.url-preview {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  font-family: var(--font-mono); font-size: 12px;
  word-break: break-all; color: var(--fg-muted);
  margin-top: 8px;
}
.url-preview a { color: var(--primary); text-decoration: none; }
.url-preview a:hover { text-decoration: underline; }

/* ============ TOOLTIP ============ */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: var(--fg); color: var(--bg);
  padding: 6px 10px; border-radius: 6px; font-size: 12px;
  white-space: nowrap; z-index: 50; pointer-events: none;
}

/* ============ MODAL ============ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  z-index: 200; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px;
  max-width: 560px; width: 90%; max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal h2 { margin-top: 0; }

/* ============ TIMELINE ============ */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline__item { position: relative; padding-bottom: 20px; }
.timeline__item::before {
  content: ''; position: absolute; left: -20px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); border: 2px solid var(--bg-card);
}
.timeline__item--done::before { background: var(--success); }
.timeline__item--active::before { background: var(--warning); box-shadow: 0 0 8px rgba(224,166,76,.5); }
.timeline__item--error::before { background: var(--danger); }
.timeline__time { font-size: 11px; color: var(--fg-muted); }
.timeline__text { font-size: 13px; margin-top: 2px; }

/* ============ FOOTER ============ */
.footer {
  background: var(--bg-elev); border-top: 1px solid var(--border);
  padding: 18px 0; color: var(--fg-muted); font-size: 13px;
}

/* ============ GRID LAYOUTS ============ */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.grid-2 > *:last-child > .card + .card { margin-top: 16px; }

/* ============ THEME TOGGLE ============ */
.theme-toggle {
  background: none; border: none; cursor: pointer; padding: 4px;
  font-size: 18px; line-height: 1; display: flex; align-items: center;
  border-radius: var(--radius-sm); transition: background .15s;
}
.theme-toggle:hover { background: rgba(255,255,255,.08); }

/* ============ LIGHT THEME ============ */
[data-theme="light"] {
  --bg: #f0f2f5;
  --bg-elev: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f7f8fa;
  --fg: #1a1d23;
  --fg-muted: #5f6577;
  --border: #dde0e6;
  --border-light: #c8ccd4;
  --primary: #3b78e7;
  --primary-hover: #2a65d4;
  --primary-glow: rgba(59,120,231,.10);
  --danger: #d94040;
  --danger-glow: rgba(217,64,64,.10);
  --warning: #c78a2a;
  --warning-glow: rgba(199,138,42,.10);
  --success: #2d9a5a;
  --success-glow: rgba(45,154,90,.10);
  --shadow: 0 4px 24px -8px rgba(0,0,0,.10);
  --shadow-lg: 0 12px 48px -12px rgba(0,0,0,.15);
}
[data-theme="light"] .topbar {
  background: rgba(255,255,255,.92);
  border-bottom-color: var(--border);
}
[data-theme="light"] .nav a:hover { background: rgba(0,0,0,.04); }
[data-theme="light"] table.data tr:hover td { background: rgba(0,0,0,.03); }
[data-theme="light"] .btn--ghost { background: transparent; color: var(--fg-muted); }
[data-theme="light"] .btn--ghost:hover { color: var(--fg); background: rgba(0,0,0,.04); }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .nav { display: none; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .pipeline { flex-direction: column; }
  .pipeline__step { border-radius: 0 !important; }
  .pipeline__step:first-child { border-radius: var(--radius) var(--radius) 0 0 !important; }
  .pipeline__step:last-child { border-radius: 0 0 var(--radius) var(--radius) !important; }
  table.data { font-size: 12px; }
  table.data th, table.data td { padding: 8px 10px; }
}

/* ============ ANIMATIONS ============ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn .3s ease; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.pulse { animation: pulse 2s infinite; }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-muted); }

/* ============ PRINT ============ */
@media print {
  .topbar, .nav, .btn, .fab { display: none !important; }
  body { background: white; color: black; }
  .card { border: 1px solid #ddd; box-shadow: none; }
}

/* Descrição da tela — explica a página logo abaixo do menu.
   Alimentada por includes/descricoes-telas.php via header.php. */
.tela-desc {
  margin: 18px 0 2px;
  padding: 11px 15px;
  background: var(--bg-elev);
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  color: var(--fg-muted);
  font-size: 13.5px;
  line-height: 1.6;
}
@media (max-width: 640px) {
  .tela-desc { font-size: 12.5px; padding: 9px 12px; }
}
