/* Orionnex Client Preview — portal.css
   Tokens exatos do Global V3.4 (:root de styles.css). Nada de nova identidade.
   Fontes AUTO-HOSPEDADAS (assets/fonts/): as páginas do portal usavam o CDN
   do Google Fonts, mas a CSP do portal é `style-src 'self'; font-src 'self'`
   — o navegador bloqueava o stylesheet externo (violação de CSP real,
   encontrada pelo teste de navegador). Mesmas fontes (DM Sans e Space
   Grotesk, subset latin, variáveis), agora servidas da própria origem. */
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("/assets/fonts/dm-sans-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/assets/fonts/space-grotesk-latin.woff2") format("woff2");
}
:root {
  --bg: #050713;
  --bg2: #090c1d;
  --surface: #0d1022;
  --surface2: #10152b;
  --text: #f6f8ff;
  --muted: #a8adca;
  --cyan: #20deef;
  --blue: #2e6bff;
  --purple: #8f4bf8;
  --pink: #cc39ed;
  --radius: 20px;
  --grad: linear-gradient(108deg, #2875ff, #5349e7, #8135de);
  --grad-text: linear-gradient(95deg, #2ee8f4, #3c8dff, #8d51ff, #bc53fa);
  --border: rgba(246, 248, 255, 0.09);
  --danger: #ff5c7a;
  --ok: #2ee8a4;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image: radial-gradient(circle at 1px 1px, rgba(246, 248, 255, 0.05) 1px, transparent 0);
  background-size: 28px 28px;
}
h1, h2, h3, .brand-name { font-family: "Space Grotesk", "DM Sans", sans-serif; letter-spacing: -0.01em; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; color: var(--text); }
.muted { color: var(--muted); }
.grad-text { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Botões (mesmo padrão do site institucional) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: 15px; transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 28px rgba(46, 107, 255, 0.35); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--cyan); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(255, 92, 122, 0.4); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* Formulários */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  background: var(--bg2); border: 1px solid var(--border); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(32, 222, 239, 0.15); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.error-box, .success-box {
  display: none; padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 16px;
}
.error-box { background: rgba(255, 92, 122, 0.1); border: 1px solid rgba(255, 92, 122, 0.4); color: #ffb3c0; }
.success-box { background: rgba(46, 232, 164, 0.1); border: 1px solid rgba(46, 232, 164, 0.4); color: #a9f5d6; }
.error-box.show, .success-box.show { display: block; }

/* Visualizador de prévia (portal/p.html + gate.js): o site do cliente
   abre isolado num iframe sandboxed em tela cheia, abaixo de uma barra
   do portal. O iframe ocupa o resto da viewport; a barra fica fora do
   iframe, então o conteúdo embutido nunca a alcança. */
.viewer { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); z-index: 10; }
.viewer[hidden] { display: none; }
.viewer-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--bg2); border-bottom: 1px solid var(--border);
}
.viewer-logo { width: 120px; height: auto; }
.viewer-title { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 2px; }
.viewer-title strong { font-size: 15px; color: var(--cyan); }
.viewer-title span { font-size: 12px; }
.viewer-actions { display: flex; gap: 8px; }
.viewer-note { padding: 8px 16px; font-size: 12px; color: var(--muted); background: var(--surface); border-bottom: 1px solid var(--border); }
#preview-frame { flex: 1; width: 100%; border: 0; background: #fff; }
@media (max-width: 800px) {
  .viewer-logo { width: 96px; }
  .viewer-title span { display: none; }
}

/* Telas de acesso (login / gate) */
.center-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; overflow: hidden; }
.center-wrap::before {
  content: ""; position: absolute; width: 560px; height: 560px; border-radius: 50%;
  background: radial-gradient(circle, rgba(46, 107, 255, 0.28), transparent 65%);
  top: -180px; right: -120px; filter: blur(10px); pointer-events: none;
}
.center-wrap::after {
  content: ""; position: absolute; width: 480px; height: 480px; border-radius: 50%;
  background: radial-gradient(circle, rgba(204, 57, 237, 0.2), transparent 65%);
  bottom: -200px; left: -140px; filter: blur(10px); pointer-events: none;
}
.auth-card {
  position: relative; z-index: 1; width: 100%; max-width: 440px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 36px 32px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.auth-card .logo { width: 180px; height: auto; display: block; margin: 0 auto 8px; }
.auth-card h1 { font-size: 24px; text-align: center; margin-bottom: 6px; }
.auth-card p.sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.auth-card .btn { width: 100%; }
.auth-card .foot { text-align: center; margin-top: 20px; font-size: 13px; color: var(--muted); }

/* Layout administrativo */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--bg2); border-right: 1px solid var(--border);
  padding: 24px 16px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .logo { width: 150px; height: auto; margin: 4px 8px 20px; }
.sidebar a.nav {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px;
  color: var(--muted); font-weight: 600; font-size: 15px;
}
.sidebar a.nav:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.sidebar a.nav.active { color: var(--text); background: var(--surface2); border: 1px solid var(--border); }
.sidebar a.nav .ico { font-size: 17px; width: 22px; text-align: center; }
.sidebar .spacer { flex: 1; }
.main { flex: 1; min-width: 0; padding: 28px 32px 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.topbar h1 { font-size: 28px; }
.topbar p { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* Indicadores */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; position: relative; overflow: hidden;
}
.stat::after { content: ""; position: absolute; inset: auto -30px -46px auto; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, rgba(32, 222, 239, 0.14), transparent 70%); }
.stat .num { font-family: "Space Grotesk", sans-serif; font-size: 34px; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* Seções e cards */
.section { margin-bottom: 28px; }
.section h2 { font-size: 20px; margin-bottom: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 14px;
}
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input, .toolbar select {
  padding: 11px 14px; border-radius: 12px; background: var(--bg2);
  border: 1px solid var(--border); outline: none; min-width: 200px;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--cyan); }
.toolbar .grow { flex: 1; }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.project-card { display: flex; flex-direction: column; gap: 10px; }
.project-card h3 { font-size: 18px; }
.project-card .slug { font-size: 13px; color: var(--cyan); word-break: break-all; }
.project-card .meta { font-size: 13px; color: var(--muted); }
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.badge-ativo { background: rgba(46, 232, 164, 0.14); color: var(--ok); }
.badge-expirado { background: rgba(255, 190, 80, 0.14); color: #ffcf7d; }
.badge-desativado { background: rgba(168, 173, 202, 0.14); color: var(--muted); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.card-actions .btn { flex: 1; min-width: 110px; }
.link-row { display: flex; gap: 8px; align-items: center; }
.link-row code {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; color: var(--muted);
}
.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty .big { font-size: 40px; margin-bottom: 10px; }
.activity { list-style: none; }
.activity li {
  display: flex; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--border); font-size: 14px;
}
.activity li:last-child { border-bottom: none; }
.activity .when { color: var(--muted); font-size: 12px; white-space: nowrap; padding-top: 2px; }

/* Modal */
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(5, 7, 19, 0.8);
  backdrop-filter: blur(4px); z-index: 50; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.modal-backdrop.show { display: flex; }
.modal {
  width: 100%; max-width: 620px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 28px;
}
.modal h2 { font-size: 22px; margin-bottom: 4px; }
.modal p.sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.dropzone {
  border: 2px dashed var(--border); border-radius: 14px; padding: 22px; text-align: center;
  color: var(--muted); font-size: 14px; cursor: pointer; transition: border-color 0.15s ease;
}
.dropzone:hover, .dropzone.over { border-color: var(--cyan); color: var(--text); }
.progress { display: none; height: 8px; background: var(--bg2); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress.show { display: block; }
.progress i { display: block; height: 100%; width: 0; background: var(--grad); transition: width 0.2s ease; }
.msg-box { width: 100%; padding: 10px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--border); font-size: 13px; }
textarea.msg-box { min-height: 120px; resize: vertical; }

/* Responsividade: mesmos pontos do site institucional (1090 / 800px) */
@media (max-width: 1090px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 14px; }
  .sidebar .logo { width: 120px; margin: 0 12px 0 0; }
  .sidebar a.nav { padding: 9px 10px; font-size: 14px; }
  .sidebar .spacer { display: none; }
  .main { padding: 20px 16px 40px; }
  .topbar h1 { font-size: 23px; }
  .field-row { grid-template-columns: 1fr; }
  .projects { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
}
@media (max-width: 390px) {
  .stats { grid-template-columns: 1fr; }
  .toolbar input, .toolbar select { min-width: 0; width: 100%; }
  .card-actions .btn { min-width: 100%; }
}
