/* ============================================================
   AI Registry Wizard — Stylesheet
   Extracted and adapted from index.html
   ============================================================ */

:root {
  --primary: #1a3a5c;
  --primary-light: #2a5a8c;
  --accent: #0d7377;
  --accent-light: #14a3a8;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e2e8f0;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #2563eb;
  --risk-low: #059669;
  --risk-medium: #d97706;
  --risk-high: #ea580c;
  --risk-critical: #dc2626;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* ── Site Header ────────────────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-lg);
}
.site-header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
  height: 60px;
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: white;
  flex-shrink: 0;
}
.site-logo-icon { font-size: 1.6rem; }
.site-logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.site-logo-title { font-size: 0.95rem; font-weight: 700; }
.site-logo-sub { font-size: 0.7rem; opacity: 0.75; }

/* Desktop Nav */
.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 24px;
  flex: 1;
}
.nav-link {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,0.12); color: #fff; }
.nav-link.nav-accent { color: #fbbf24; }
.nav-link.nav-accent:hover { background: rgba(251,191,36,0.15); }

/* Dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.2s;
}
.nav-dropdown-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.caret { font-size: 0.65rem; opacity: 0.7; }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  min-width: 200px;
  padding: 6px 0;
  z-index: 300;
}
.nav-dropdown-right { left: auto; right: 0; }
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: block;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.15s;
}
.nav-dropdown-menu a:hover { background: #f0f9ff; }
.dropdown-label {
  display: block;
  padding: 6px 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.dropdown-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

/* User badge */
.site-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Nav action badges (inline) */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  background: rgba(255,255,255,0.25);
  color: #fff;
  margin-left: 4px;
  vertical-align: middle;
}
.nav-badge-red { background: #dc2626; }
.nav-badge-orange { background: #ea580c; }
.nav-badge-blue { background: #2563eb; }

/* Bell notification badge (absolute) */
.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #dc2626;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}
.user-name { font-size: 0.85rem; }
.login-link {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 6px 16px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 6px;
  font-size: 0.85rem;
  transition: background 0.2s;
}
.login-link:hover { background: rgba(255,255,255,0.12); }

/* Hamburger */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 5px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Mobile menu */
.mobile-menu {
  display: none;
  background: var(--primary);
  padding: 0 32px 16px;
}
.mobile-menu.open { display: block; }
.mobile-nav { display: flex; flex-direction: column; gap: 2px; }
.mobile-nav a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: background 0.15s;
}
.mobile-nav a:hover { background: rgba(255,255,255,0.1); }
.mobile-nav hr { border: none; border-top: 1px solid rgba(255,255,255,0.15); margin: 4px 0; }

@media (max-width: 768px) {
  .site-nav { display: none; }
  .user-name { display: none; }
  .hamburger { display: flex; }
  .site-header-inner { padding: 0 16px; }
  .mobile-menu { padding: 0 16px 16px; }
}

/* ── Site Footer ───────────────────────────────────────────── */
.site-footer {
  background: var(--primary);
  color: rgba(255,255,255,0.8);
  margin-top: auto;
}
.site-footer-inner {
  padding: 32px 32px 16px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 24px;
}
.footer-col { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; }
.footer-col h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.6;
  margin-bottom: 4px;
}
.footer-col a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-col a:hover { color: #fff; }
.footer-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.footer-brand strong { font-size: 0.95rem; color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 16px;
  font-size: 0.75rem;
  opacity: 0.5;
  text-align: center;
}
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .site-footer-inner { padding: 24px 16px 12px; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ── Progress Bar ───────────────────────────────────────────── */
.progress-bar {
  display: flex;
  gap: 4px;
  margin-top: 16px;
  width: 100%;
}
.progress-step {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.25);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.3s;
  position: relative;
}
.progress-step.completed { background: var(--accent-light); }
.progress-step.active { background: white; }
.progress-step:hover::after {
  content: attr(data-label);
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: white;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
}

/* ── Main Layout ────────────────────────────────────────────── */
.main {
  width: 100%;
  padding: 24px 32px;
  flex: 1;
}

/* Constrained width for forms (wizard, login, public pages) */
.main-narrow {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

/* ── Step Header ────────────────────────────────────────────── */
.step-header {
  margin-bottom: 24px;
}
.step-number {
  display: inline-block;
  background: var(--accent);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  text-align: center;
  line-height: 32px;
  font-weight: 700;
  font-size: 0.9rem;
  margin-right: 12px;
}
.step-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  display: inline;
  vertical-align: middle;
}
.step-desc {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-style: italic;
}

/* ── Field Group ────────────────────────────────────────────── */
.field-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.field-label {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.field-label .required {
  color: var(--danger);
  font-size: 0.8rem;
}
.field-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-style: italic;
}

/* ── Inputs ─────────────────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
select,
textarea,
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
  background: white;
  color: var(--text);
}
input:focus,
select:focus,
textarea:focus,
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,115,119,0.1);
}
textarea,
textarea.form-control { resize: vertical; min-height: 80px; }
.char-count {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Two-column input grid */
.input-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.input-grid-2 label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* ── Checkboxes & Radio ─────────────────────────────────────── */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.options-grid.single { grid-template-columns: 1fr; }
.option-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}
.option-item:hover { border-color: var(--accent); background: #f0fafa; }
.option-item.selected,
.option-item input:checked ~ div { /* fallback highlight */ }
.option-item input[type="checkbox"]:checked ~ .option-label,
.option-item input[type="radio"]:checked ~ .option-label { font-weight: 600; }
/* Selected state via JS class */
.option-item.selected {
  border-color: var(--accent);
  background: #e6f7f7;
}
.option-item input[type="checkbox"],
.option-item input[type="radio"] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.option-label { font-size: 0.9rem; }
.option-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Annex III inline yes/no */
.annex-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.annex-row:last-child { border-bottom: none; }
.annex-question { flex: 1; font-size: 0.9rem; }
.annex-answers { display: flex; gap: 8px; flex-shrink: 0; }
.annex-answers .option-item { padding: 6px 14px; margin: 0; }

/* ── Help Panel ─────────────────────────────────────────────── */
.help-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 0.75rem;
  color: var(--info);
  cursor: pointer;
  transition: all 0.2s;
}
.help-toggle:hover { background: #eff6ff; border-color: var(--info); }
.help-panel {
  display: none;
  background: #f0f9ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
  font-size: 0.85rem;
  line-height: 1.7;
}
.help-panel.open { display: block; }
.help-panel table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 0.82rem;
}
.help-panel th {
  background: #dbeafe;
  padding: 8px;
  text-align: left;
  font-weight: 600;
}
.help-panel td {
  padding: 8px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}
.help-panel ul { padding-left: 20px; }
.help-panel li { margin-bottom: 4px; }

/* ── Decision Tree ──────────────────────────────────────────── */
.decision-tree {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.82rem;
  line-height: 1.8;
  white-space: pre-line;
}

/* ── Banners ────────────────────────────────────────────────── */
.banner {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-top: 10px;
  font-size: 0.85rem;
  display: none;
}
.banner.visible { display: flex; gap: 8px; align-items: flex-start; }
.banner-icon { flex-shrink: 0; font-size: 1.1rem; }
.banner.warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.banner.danger  { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.banner.info    { background: #f0f9ff; border: 1px solid #bfdbfe; color: #1e40af; }
.banner.tip     { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }

/* ── Navigation Buttons ─────────────────────────────────────── */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.btn {
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-light); }
.btn-secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }
.btn-export {
  background: var(--primary);
  color: white;
  margin: 4px;
}
.btn-export:hover { background: var(--primary-light); }
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #b91c1c; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Summary (Step 7) ───────────────────────────────────────── */
.summary-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.summary-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.summary-section-header .edit-btn {
  font-size: 0.8rem;
  color: var(--accent);
  cursor: pointer;
  background: none;
  border: 1px solid var(--accent);
  padding: 4px 12px;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.2s;
}
.summary-section-header .edit-btn:hover { background: #e6f7f7; }
.summary-row {
  display: flex;
  padding: 10px 20px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
}
.summary-row:last-child { border-bottom: none; }
.summary-label {
  width: 40%;
  color: var(--text-muted);
  flex-shrink: 0;
}
.summary-value { font-weight: 500; }

/* ── Risk Result ────────────────────────────────────────────── */
.risk-result {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 20px 0;
  text-align: center;
}
.risk-result h3 { margin-bottom: 16px; font-size: 1.1rem; }
.risk-badge {
  display: inline-block;
  padding: 8px 24px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 1.1rem;
  margin: 8px 0;
}
.risk-badge.low      { background: #d1fae5; color: #065f46; border: 2px solid var(--risk-low); }
.risk-badge.medium   { background: #fef3c7; color: #92400e; border: 2px solid var(--risk-medium); }
.risk-badge.high     { background: #ffedd5; color: #9a3412; border: 2px solid var(--risk-high); }
.risk-badge.critical { background: #fee2e2; color: #991b1b; border: 2px solid var(--risk-critical); }
.risk-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
  text-align: left;
}
.risk-detail-item {
  padding: 12px;
  background: #f8fafc;
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.risk-detail-item .label { color: var(--text-muted); font-size: 0.8rem; }
.risk-detail-item .value { font-weight: 600; font-size: 1rem; margin-top: 2px; }

/* ── Required Actions Checklist ─────────────────────────────── */
.actions-list {
  text-align: left;
  margin-top: 20px;
  padding: 16px;
  background: #f8fafc;
  border-radius: var(--radius);
}
.actions-list h4 { margin-bottom: 10px; font-size: 0.95rem; }
.action-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 0.88rem;
}
.action-icon { width: 20px; text-align: center; }

/* ── Export Buttons ─────────────────────────────────────────── */
.export-buttons {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ── Conditional Visibility ─────────────────────────────────── */
.conditional { display: none; }
.conditional.visible { display: block; }

/* ── Validation Errors ──────────────────────────────────────── */
.field-group.error { border-color: var(--danger); }
.field-group.error .field-label { color: var(--danger); }
.error-msg {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 4px;
  display: none;
}
.field-group.error .error-msg { display: block; }
/* Django form error list */
.errorlist {
  list-style: none;
  padding: 0;
  margin-top: 4px;
}
.errorlist li {
  color: var(--danger);
  font-size: 0.82rem;
}

/* ── Page/List tables (my_submissions, detail) ──────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.page-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.data-table th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafafa; }

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
}
.status-draft     { background: #f1f5f9; color: var(--text-muted); }
.status-submitted { background: #d1fae5; color: #065f46; }
.status-review    { background: #fef3c7; color: #92400e; }

/* ── Login form ─────────────────────────────────────────────── */
.login-container {
  max-width: 420px;
  margin: 60px auto;
  padding: 0 24px;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.login-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}
.login-card .login-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.login-field { margin-bottom: 16px; }
.login-field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state h3 { font-size: 1.1rem; margin-bottom: 8px; }
.empty-state p  { font-size: 0.9rem; margin-bottom: 20px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .options-grid        { grid-template-columns: 1fr; }
  .risk-details        { grid-template-columns: 1fr; }
  .summary-row         { flex-direction: column; }
  .summary-label       { width: 100%; margin-bottom: 2px; }
  .header h1           { font-size: 1.1rem; }
  .input-grid-2        { grid-template-columns: 1fr; }
  .annex-row           { flex-direction: column; align-items: flex-start; }
  .annex-answers       { margin-top: 6px; }
  .data-table th,
  .data-table td       { padding: 8px 10px; font-size: 0.82rem; }
}
