/* ============================================
   PhishGuard Design System
   Dark theme — orange accent — card-based
   ============================================ */

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

:root {
  --bg: #0d1117;
  --surface: #1e2530;
  --surface-secondary: #161b22;
  --border: #2a3342;
  --border-hover: #3a4556;
  --text: #d1d5db;
  --text-muted: #8a97a8;
  --accent: #f5a623;
  --link: #60a5fa;
  --success: #4ade80;
  --success-bg: #14532d;
  --warning: #fbbf24;
  --warning-bg: #451a03;
  --danger: #f87171;
  --danger-bg: #3b0f0f;
  --radius: 10px;
  --font: system-ui, 'Inter', -apple-system, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout --- */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--surface-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 16px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand .brand-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--bg);
  font-weight: 700;
}

.sidebar-brand .brand-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.sidebar-brand .brand-sub {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-group {
  padding: 8px 0;
}

.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 8px 16px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
}

.nav-item.active {
  color: var(--accent);
  background: var(--surface-secondary);
  border-left-color: var(--accent);
}

.nav-item .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  opacity: 0.7;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

.screen { display: none; }
.screen.active { display: block; }

/* --- Page Header --- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.page-header .header-actions {
  display: flex;
  gap: 10px;
}

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card:hover {
  border-color: var(--border-hover);
}

/* --- Metric Cards --- */
.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.metric-card .metric-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.metric-card .metric-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--accent);
}

.metric-card .metric-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Tables --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
}

.badge-orange {
  background: rgba(245,166,35,0.15);
  color: var(--accent);
}

.badge-green {
  background: var(--success-bg);
  color: var(--success);
}

.badge-red {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-amber {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-blue {
  background: rgba(96,165,250,0.15);
  color: var(--link);
}

.badge-muted {
  background: rgba(138,151,168,0.15);
  color: var(--text-muted);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  font-family: var(--font);
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  background: #e6991b;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  background: var(--surface-secondary);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(248,113,113,0.3);
}

.btn-danger:hover {
  background: rgba(59,15,15,0.8);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-input,
.form-select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* --- Checkbox --- */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.checkbox-row:hover {
  background: rgba(255,255,255,0.03);
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* --- Avatar --- */
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1a2a3a;
  color: var(--link);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-sm {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

/* --- Template Cards (campaign wizard) --- */
.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.template-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.template-card:hover {
  border-color: var(--border-hover);
}

.template-card.selected {
  border-color: var(--accent);
  background: rgba(245,166,35,0.05);
}

.template-card .template-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.template-card .template-from {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* --- Module Cards (training library) --- */
.module-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.module-card:hover {
  border-color: var(--border-hover);
}

.module-card .module-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 12px;
}

.module-card .module-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.module-card .module-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  flex: 1;
}

.module-card .module-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.module-card .module-duration {
  font-size: 11px;
  color: var(--text-muted);
}

/* --- Email Preview --- */
.email-preview {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  color: #1a1a1a;
  max-width: 560px;
}

.email-preview .email-from {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.email-preview .email-subject {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 16px;
}

.email-preview .email-body {
  font-size: 13px;
  color: #333;
  line-height: 1.6;
}

.email-preview .email-link {
  color: #1a73e8;
  text-decoration: underline;
  cursor: pointer;
}

/* --- Wizard Steps --- */
.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
}

.wizard-step {
  flex: 1;
  text-align: center;
  padding: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}

.wizard-step.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.wizard-step.completed {
  color: var(--success);
  border-bottom-color: var(--success);
}

.wizard-step .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  font-size: 11px;
  margin-right: 6px;
}

.wizard-step.active .step-num {
  border-color: var(--accent);
  color: var(--accent);
}

.wizard-step.completed .step-num {
  border-color: var(--success);
  background: var(--success);
  color: var(--bg);
}

.wizard-panel { display: none; }
.wizard-panel.active { display: block; }

.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* --- Quiz --- */
.quiz-progress {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-bottom: 20px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.quiz-question {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 16px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
}

.quiz-option:hover {
  border-color: var(--border-hover);
}

.quiz-option.selected {
  border-color: var(--accent);
  background: rgba(245,166,35,0.07);
}

.quiz-option.correct {
  border-color: var(--success);
  background: rgba(74,222,128,0.07);
}

.quiz-option.incorrect {
  border-color: var(--danger);
  background: rgba(248,113,113,0.07);
}

.quiz-option .option-marker {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}

.quiz-option.selected .option-marker {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}

.quiz-option.correct .option-marker {
  border-color: var(--success);
  background: var(--success);
  color: var(--bg);
}

.quiz-option.incorrect .option-marker {
  border-color: var(--danger);
  background: var(--danger);
  color: var(--bg);
}

.quiz-feedback {
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 12px;
  display: none;
}

.quiz-feedback.show { display: block; }

.quiz-feedback.correct {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(74,222,128,0.3);
}

.quiz-feedback.incorrect {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(248,113,113,0.3);
}

.quiz-score {
  text-align: center;
  padding: 40px;
}

.quiz-score .score-value {
  font-size: 48px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}

.quiz-score .score-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* --- Gotcha Page (within admin) --- */
.gotcha-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.gotcha-header {
  background: var(--warning-bg);
  border-bottom: 1px solid rgba(251,191,36,0.3);
  padding: 20px 24px;
  text-align: center;
}

.gotcha-header h2 {
  color: var(--warning);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.gotcha-header p {
  color: #d4a574;
  font-size: 13px;
}

.red-flag-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 20px 24px;
}

.red-flag-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.red-flag-item .flag-icon {
  font-size: 20px;
  margin-bottom: 6px;
}

.red-flag-item .flag-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--danger);
  margin-bottom: 4px;
}

.red-flag-item .flag-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.gotcha-tip {
  margin: 0 24px 20px;
  padding: 14px 16px;
  background: rgba(96,165,250,0.08);
  border: 1px solid rgba(96,165,250,0.2);
  border-radius: 8px;
}

.gotcha-tip .tip-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--link);
  font-weight: 600;
  margin-bottom: 4px;
}

.gotcha-tip .tip-text {
  font-size: 13px;
  color: var(--text);
}

/* --- Section headings --- */
.section-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 14px;
}

/* --- Campaign selector --- */
.campaign-selector {
  margin-bottom: 20px;
}

/* --- Staff roster add form --- */
.add-staff-form {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.add-staff-form .form-input {
  flex: 1;
}

/* --- Compliance footer --- */
.compliance-note {
  margin-top: 20px;
  padding: 12px 16px;
  background: rgba(96,165,250,0.06);
  border: 1px solid rgba(96,165,250,0.15);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* --- Status dot --- */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.status-dot.green { background: var(--success); }
.status-dot.red { background: var(--danger); }
.status-dot.amber { background: var(--warning); }

/* --- Utility --- */
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-10 { gap: 10px; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }
