/* ============================================================
   Compliance NS – Stylesheet Principal
   Baseado na identidade visual Nova Service
   Fontes: Aleo (títulos) + Outfit (corpo)
   Cores: #0023FF (primário), #14F0A0 (destaque), #0068FF (secundário)
   ============================================================ */

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Marca */
  --ns-primary:    #0023FF;
  --ns-primary-h:  #0012cc;
  --ns-secondary:  #0068FF;
  --ns-accent:     #14F0A0;
  --ns-accent-h:   #0dba7a;

  /* Dark mode (padrão) */
  --bg-body:       #080b1a;
  --bg-surface:    #0e1330;
  --bg-surface-2:  #131940;
  --bg-input:      #0a0e25;
  --border-color:  rgba(0, 35, 255, 0.25);
  --border-subtle: rgba(255,255,255,0.08);
  --text-primary:  #e8ecf8;
  --text-secondary:#8090b8;
  --text-muted:    #5a6a90;
  --shadow:        0 4px 24px rgba(0,0,0,0.5);
  --shadow-card:   0 2px 16px rgba(0, 35, 255, 0.12);

  /* Componentes */
  --header-bg:     rgba(8, 11, 26, 0.96);
  --footer-bg:     #060819;
  --radius:        12px;
  --radius-sm:     8px;
}

[data-theme="light"] {
  --bg-body:       #f0f2f8;
  --bg-surface:    #ffffff;
  --bg-surface-2:  #e8ecf6;
  --bg-input:      #f8f9ff;
  --border-color:  rgba(0, 35, 255, 0.18);
  --border-subtle: rgba(0,0,0,0.08);
  --text-primary:  #0a0d1e;
  --text-secondary:#3a4a70;
  --text-muted:    #6c7a9a;
  --shadow:        0 4px 24px rgba(0,0,0,0.08);
  --shadow-card:   0 2px 16px rgba(0, 35, 255, 0.08);
  --header-bg:     rgba(255,255,255,0.97);
  --footer-bg:     #0e1330;
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  scroll-padding-top: 90px; /* compensa o header fixo (70px) + margem */
}

body {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  background-color: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

main { flex: 1; }

h1, h2, h3, h4, h5 {
  font-family: 'Aleo', serif;
  font-weight: 600;
  color: var(--text-primary);
}

a { color: var(--ns-accent); text-decoration: none; }
a:hover { color: var(--ns-accent-h); }

/* ─── Header ────────────────────────────────────────────────── */
.ns-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 0;
  transition: background 0.3s ease;
}

.ns-logo { max-height: 40px; width: auto; transition: filter 0.3s ease; }
[data-theme="light"] .ns-logo { filter: invert(1) hue-rotate(180deg); }

.navbar-toggler {
  border-color: var(--border-subtle);
  color: var(--text-primary);
}
.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28232,236,248,0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
[data-theme="light"] .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2810,13,30,0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.nav-link {
  color: var(--text-secondary) !important;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 6px 10px !important;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}
.nav-link:hover,
.nav-link.active {
  color: var(--text-primary) !important;
  background: var(--border-subtle);
}
.nav-link.active { color: var(--ns-accent) !important; }

/* Dark mode toggle */
.btn-theme-toggle {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
}
.btn-theme-toggle:hover {
  background: var(--ns-primary);
  border-color: var(--ns-primary);
  color: #fff;
}

/* Padding do body para o header fixo */
body { padding-top: 70px; }

/* ─── Buttons ───────────────────────────────────────────────── */
.btn-ns-primary {
  background: var(--ns-primary);
  color: #fff !important;
  border: none;
  border-radius: 999px;
  padding: 8px 22px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.btn-ns-primary:hover {
  background: var(--ns-primary-h);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,35,255,0.4);
}

.btn-ns-accent {
  background: var(--ns-accent);
  color: #080b1a !important;
  border: none;
  border-radius: 999px;
  padding: 10px 28px;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.2s;
}
.btn-ns-accent:hover {
  background: var(--ns-accent-h);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(20,240,160,0.35);
}

.btn-ns-outline {
  background: transparent;
  color: var(--ns-accent) !important;
  border: 2px solid var(--ns-accent);
  border-radius: 999px;
  padding: 8px 22px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.btn-ns-outline:hover {
  background: var(--ns-accent);
  color: #080b1a !important;
}

/* ─── Hero / Banner ─────────────────────────────────────────── */
.ns-hero {
  background: linear-gradient(135deg, #0023FF 0%, #0068FF 60%, #0047cc 100%);
  padding: 60px 0 80px;
  position: relative;
  overflow: hidden;
}
.ns-hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--bg-body);
  clip-path: ellipse(55% 100% at 50% 100%);
}
.ns-hero-title {
  font-family: 'Aleo', serif;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}
.ns-hero-text {
  color: rgba(255,255,255,0.85);
  font-size: 1rem;
  max-width: 640px;
  line-height: 1.7;
}
.ns-hero-icon {
  font-size: 4rem;
  color: var(--ns-accent);
  opacity: 0.9;
}
.ns-accent-dot {
  display: inline-block;
  width: 10px; height: 10px;
  background: var(--ns-accent);
  border-radius: 50%;
  margin-right: 8px;
}

/* ─── Cards ─────────────────────────────────────────────────── */
.ns-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-card);
  transition: background 0.3s, border 0.3s;
}
.ns-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.ns-card-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--ns-primary), var(--ns-secondary));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.ns-card-title {
  font-family: 'Aleo', serif;
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

/* ─── Forms ─────────────────────────────────────────────────── */
.form-label {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.form-label .badge-optional {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 6px;
}
.form-label .badge-required {
  color: #ff4f72;
  margin-left: 2px;
}

.form-control,
.form-select {
  background: var(--bg-input) !important;
  border: 1.5px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm) !important;
  padding: 10px 14px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--ns-accent) !important;
  box-shadow: 0 0 0 3px rgba(20,240,160,0.15) !important;
  outline: none;
}
.form-control::placeholder { color: var(--text-muted); }

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: #ff4f72 !important;
}

textarea.form-control { resize: vertical; min-height: 140px; }

/* ─── Status badges ─────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.status-badge::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ─── Protocol display ──────────────────────────────────────── */
.protocol-box {
  background: linear-gradient(135deg, rgba(0,35,255,0.15), rgba(0,104,255,0.1));
  border: 1px solid rgba(0,35,255,0.35);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.protocol-number {
  font-family: 'Outfit', monospace;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ns-accent);
  letter-spacing: 0.08em;
  word-break: break-all;
}
.protocol-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

/* ─── Alert / Feedback ──────────────────────────────────────── */
.ns-alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.ns-alert-success {
  background: rgba(20,240,160,0.1);
  border: 1px solid rgba(20,240,160,0.3);
  color: #14F0A0;
}
.ns-alert-danger {
  background: rgba(255,79,114,0.1);
  border: 1px solid rgba(255,79,114,0.3);
  color: #ff6b88;
}
.ns-alert-info {
  background: rgba(0,104,255,0.1);
  border: 1px solid rgba(0,104,255,0.3);
  color: #5599ff;
}
.ns-alert-warning {
  background: rgba(255,193,7,0.1);
  border: 1px solid rgba(255,193,7,0.3);
  color: #ffc107;
}

/* ─── Spinner ───────────────────────────────────────────────── */
.ns-spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Footer ────────────────────────────────────────────────── */
.ns-footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border-subtle);
  padding: 48px 0 32px;
  margin-top: 80px;
}
.footer-tagline {
  color: var(--ns-accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.footer-links {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: center;
}
.footer-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--ns-accent); }
.footer-copy {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.6;
}
.footer-compliance-note {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

/* ─── Sections ──────────────────────────────────────────────── */
.section-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ns-accent);
  margin-bottom: 8px;
}
.section-title {
  font-family: 'Aleo', serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.section-lead {
  color: var(--text-secondary);
  max-width: 540px;
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ─── Divider ───────────────────────────────────────────────── */
.ns-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color), transparent);
  border: none;
  margin: 16px 0;
}

/* ─── Consultar result ───────────────────────────────────────── */
.report-result {
  animation: fadeInUp 0.4s ease;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.report-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.report-meta-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.report-meta-value {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.report-message-box {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 20px;
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.report-response-box {
  background: rgba(20,240,160,0.05);
  border: 1px solid rgba(20,240,160,0.2);
  border-radius: var(--radius-sm);
  padding: 20px;
  font-size: 0.95rem;
  line-height: 1.7;
}
.report-response-box img { max-width: 100%; border-radius: var(--radius-sm); }

/* ─── Admin específico ──────────────────────────────────────── */
.admin-sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  min-height: calc(100vh - 70px);
  padding: 24px 16px;
  width: 240px;
  flex-shrink: 0;
}
.admin-layout {
  display: flex;
  min-height: calc(100vh - 70px);
}
.admin-content {
  flex: 1;
  padding: 32px;
  overflow-x: hidden;
}

.sidebar-nav { list-style: none; padding: 0; margin: 0; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.2s;
  text-decoration: none;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}
.sidebar-nav a.active { color: var(--ns-accent); }
.sidebar-nav .nav-icon { width: 18px; text-align: center; }

.admin-topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.admin-page-title {
  font-family: 'Aleo', serif;
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
}

/* Stat cards admin */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-value {
  font-family: 'Aleo', serif;
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
}
.stat-label {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-top: 2px;
}

/* Table */
.ns-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.ns-table th {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.ns-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.92rem;
  color: var(--text-primary);
}
.ns-table tbody tr {
  transition: background 0.15s;
}
.ns-table tbody tr:hover {
  background: var(--bg-surface-2);
}
.ns-table td a { color: var(--text-primary); text-decoration: none; }
.ns-table td a:hover { color: var(--ns-accent); }

/* Login page */
.login-wrapper {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
}
.login-logo { max-width: 160px; margin-bottom: 28px; }
.login-title {
  font-family: 'Aleo', serif;
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.login-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 28px;
}

/* File attachment preview */
.attachment-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 8px;
}
.attachment-icon { font-size: 1.4rem; color: var(--ns-secondary); }
.attachment-name { font-size: 0.9rem; color: var(--text-secondary); }

/* Custom file upload button */
.custom-file-wrapper {
  position: relative;
}
.custom-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: var(--bg-surface-2);
  border: 1.5px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.custom-file-btn:hover {
  border-color: var(--ns-primary);
  color: var(--text-primary);
}
.custom-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}
.custom-file-name {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Editor response area */
.tox-tinymce { border-color: var(--border-color) !important; border-radius: var(--radius-sm) !important; }

/* Pagination */
.ns-pagination { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.ns-pagination a,
.ns-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px; height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
}
.ns-pagination a:hover { border-color: var(--ns-primary); color: var(--ns-primary); }
.ns-pagination .current { background: var(--ns-primary); border-color: var(--ns-primary); color: #fff; }
.ns-pagination .disabled { opacity: 0.4; pointer-events: none; }

/* ─── Scrollbar custom ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ns-primary); }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 991px) {
  .admin-sidebar { display: none; }
  .admin-layout { flex-direction: column; }
  .admin-content { padding: 20px 16px; }
  .ns-card { padding: 20px; }
}

@media (max-width: 576px) {
  .ns-hero { padding: 40px 0 60px; }
  .login-card { padding: 28px 20px; }
  .protocol-number { font-size: 1.3rem; }
  .ns-table th, .ns-table td { padding: 10px 10px; }
}

/* ─── Ícones brancos no dark mode ────────────────────────────── */
[data-theme="dark"] .input-group-text {
  color: rgba(255, 255, 255, 0.8) !important;
}
[data-theme="dark"] .input-group-text .bi {
  color: #ffffff !important;
}
[data-theme="dark"] .form-label .bi,
[data-theme="dark"] .section-label .bi,
[data-theme="dark"] .report-meta-label .bi,
[data-theme="dark"] .report-meta-value .bi,
[data-theme="dark"] .ns-card-header .bi,
[data-theme="dark"] .ns-card .bi,
[data-theme="dark"] .sidebar-nav .bi,
[data-theme="dark"] .admin-topbar .bi,
[data-theme="dark"] td .bi,
[data-theme="dark"] .attachment-preview .bi,
[data-theme="dark"] .footer-links .bi,
[data-theme="dark"] .stat-label .bi,
[data-theme="dark"] .protocol-label .bi {
  color: #ffffff !important;
}
/* Exceções: ícones coloridos mantêm sua cor */
[data-theme="dark"] .ns-alert .bi,
[data-theme="dark"] .status-badge .bi,
[data-theme="dark"] .ns-card-icon .bi,
[data-theme="dark"] .stat-icon .bi,
[data-theme="dark"] .btn-ns-accent .bi,
[data-theme="dark"] .btn-ns-primary .bi,
[data-theme="dark"] .dstq .bi {
  color: inherit !important;
}

/* ─── Print ──────────────────────────────────────────────────── */
@media print {
  .ns-header, .ns-footer, .btn-theme-toggle { display: none !important; }
  body { padding-top: 0; background: #fff; color: #000; }
}
