/* ═══════════════════════════════════════════════════════════════════════════
   HCM-AO v2.0 — "Angolan Digital" Design System
   Dark mode · Deep blues · Cyan accents · Glassmorphism
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Design Tokens ───────────────────────────────────────────────────────── */
:root {
  --bg-primary: #060b18;
  --bg-secondary: #0a1025;
  --bg-card: #111a32;
  --bg-card-alt: #0d1528;
  --bg-input: #0f1a30;
  --bg-hover: #162040;

  --border-primary: #1a2744;
  --border-accent: #1e3a5f;
  --border-glow: rgba(0, 180, 255, 0.15);

  --accent-cyan: #00c8ff;
  --accent-blue: #2563eb;
  --accent-red: #e63946;
  --accent-green: #22c55e;
  --accent-yellow: #f59e0b;
  --accent-orange: #f97316;

  --text-primary: #e8ecf4;
  --text-secondary: #8896b3;
  --text-muted: #556380;
  --text-white: #ffffff;

  --gradient-card: linear-gradient(145deg, #111a32 0%, #0d152a 100%);
  --gradient-accent: linear-gradient(135deg, #00c8ff 0%, #2563eb 100%);
  --gradient-green: linear-gradient(135deg, #22c55e 0%, #10b981 100%);
  --gradient-red: linear-gradient(135deg, #e63946 0%, #dc2626 100%);

  --glass-bg: rgba(17, 26, 50, 0.7);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-blur: blur(20px);

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(0, 200, 255, 0.08);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ── Background Ambient Effect ───────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  top: -200px;
  left: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0, 200, 255, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── App Shell ───────────────────────────────────────────────────────────── */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
}

/* ── Tab Navigation ──────────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid var(--border-primary);
}

.tab-btn {
  flex: 1;
  padding: 12px 24px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tab-btn.active {
  background: var(--gradient-accent);
  color: var(--text-white);
  box-shadow: 0 4px 15px rgba(0, 200, 255, 0.2);
}

.tab-btn .tab-icon {
  font-size: 1.1rem;
}

/* ── Split Layout ────────────────────────────────────────────────────────── */
.split-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  min-height: calc(100vh - 120px);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel.hidden {
  display: none;
}

@media (max-width: 900px) {
  .split-view {
    grid-template-columns: 1fr;
  }
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--gradient-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 200, 255, 0.15), transparent);
}

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* ── Panel Headers ───────────────────────────────────────────────────────── */
.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.panel-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-white) 0%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.panel-header .flag-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.panel-header .flag-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.panel-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--gradient-accent);
  color: var(--text-white);
  box-shadow: 0 4px 15px rgba(0, 200, 255, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 6px 25px rgba(0, 200, 255, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-accent);
}

.btn-accent-green {
  background: var(--gradient-green);
  color: var(--text-white);
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.2);
}

.btn-accent-green:hover {
  box-shadow: 0 6px 25px rgba(34, 197, 94, 0.35);
  transform: translateY(-1px);
}

.btn-accent-red {
  background: linear-gradient(135deg, #e63946 0%, #b91c1c 50%, #22c55e 100%);
  color: var(--text-white);
  box-shadow: 0 4px 15px rgba(230, 57, 70, 0.2);
}

.btn-accent-red:hover {
  box-shadow: 0 6px 25px rgba(230, 57, 70, 0.35);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Upload Zones ────────────────────────────────────────────────────────── */
.upload-zone {
  padding: 14px 20px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.upload-zone:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-hover);
}

.upload-zone.drag-over {
  border-color: var(--accent-cyan);
  background: rgba(0, 200, 255, 0.05);
  box-shadow: inset 0 0 20px rgba(0, 200, 255, 0.05);
}

.upload-zone.has-file {
  border-color: var(--accent-green);
}

.upload-zone .icon {
  font-size: 1.2rem;
  color: var(--accent-cyan);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 200, 255, 0.08);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.upload-zone .label {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.upload-zone .file-name {
  font-size: 0.75rem;
  color: var(--accent-green);
  margin-top: 2px;
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* ── JD Preview ──────────────────────────────────────────────────────────── */
.preview-card {
  background: #f8f9fb;
  border-radius: var(--radius-md);
  padding: 20px;
  min-height: 140px;
  color: #333;
  font-size: 0.85rem;
  line-height: 1.7;
  position: relative;
}

.preview-card .placeholder {
  color: #999;
  font-style: italic;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.preview-header .icon {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.preview-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.preview-header p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Bell Curve Canvas ───────────────────────────────────────────────────── */
.bell-curve-container {
  position: relative;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, transparent 100%);
  border-radius: var(--radius-md);
  padding: 16px 8px;
}

.bell-curve-container canvas {
  width: 100%;
  height: 200px;
  display: block;
}

/* ── Sliders ─────────────────────────────────────────────────────────────── */
.slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.slider-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 20px;
  font-weight: 600;
}

.slider-group .value-display {
  color: var(--accent-cyan);
  font-weight: 700;
  font-size: 1.1rem;
  min-width: 40px;
  text-align: right;
}

.slider-group input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 200, 255, 0.4);
  cursor: pointer;
  transition: var(--transition);
}

.slider-group input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 20px rgba(0, 200, 255, 0.6);
  transform: scale(1.15);
}

/* ── Controls Row ────────────────────────────────────────────────────────── */
.control-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.control-row label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.control-row .icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  transition: var(--transition);
}

.control-row .icon-btn:hover {
  color: var(--accent-cyan);
}

.select-styled {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.select-styled:focus {
  border-color: var(--accent-cyan);
}

/* ── Audit Metrics ───────────────────────────────────────────────────────── */
.audit-section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.metric-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.metric-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-green);
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.metric-label {
  font-size: 0.85rem;
  color: var(--text-primary);
  min-width: 120px;
  font-weight: 500;
}

.metric-bar-wrapper {
  flex: 1;
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.metric-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.metric-bar.green {
  background: var(--gradient-green);
}

.metric-bar.red {
  background: var(--gradient-red);
}

.metric-bar.mixed {
  background: linear-gradient(90deg, var(--accent-green) 0%, var(--accent-red) 100%);
}

/* ── Dashboard / Results Table ───────────────────────────────────────────── */
.results-container {
  margin-top: 16px;
}

.results-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.results-table thead th {
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  text-align: left;
  border-bottom: 1px solid var(--border-primary);
}

.results-table tbody tr {
  transition: var(--transition);
}

.results-table tbody tr:hover {
  background: var(--bg-hover);
}

.results-table tbody td {
  padding: 12px 14px;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
}

.rank-badge.gold {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
}

.rank-badge.silver {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  color: #000;
}

.rank-badge.bronze {
  background: linear-gradient(135deg, #c2785a, #a3603f);
  color: #000;
}

.rank-badge.normal {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.score-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.score-pill.high {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
}

.score-pill.medium {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-yellow);
}

.score-pill.low {
  background: rgba(230, 57, 70, 0.15);
  color: var(--accent-red);
}

/* ── SEO Warning Badges ──────────────────────────────────────────────────── */
.seo-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 600;
}

.seo-badge.danger {
  background: rgba(230, 57, 70, 0.15);
  color: var(--accent-red);
}

.seo-badge.warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-yellow);
}

.seo-badge.safe {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
}

/* ── Warning Banner ──────────────────────────────────────────────────────── */
.warning-banner {
  padding: 10px 16px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  color: var(--accent-yellow);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.3s ease;
}

.warning-banner.hidden {
  display: none;
}

/* ── Certificate Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.modal-overlay.hidden {
  display: none;
}

.certificate-card {
  background: linear-gradient(145deg, #fdf8f0 0%, #f5efe5 50%, #ede7d9 100%);
  border-radius: var(--radius-xl);
  max-width: 920px;
  width: 100%;
  padding: 40px;
  position: relative;
  color: #1a1a2e;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  max-height: 90vh;
  overflow-y: auto;
}

/* Gold border accents */
.certificate-card::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  bottom: 8px;
  border: 2px solid #c7a84e;
  border-radius: calc(var(--radius-xl) - 4px);
  pointer-events: none;
}

.certificate-card::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  bottom: 14px;
  border: 1px solid rgba(199, 168, 78, 0.3);
  border-radius: calc(var(--radius-xl) - 8px);
  pointer-events: none;
}

.cert-header {
  text-align: center;
  margin-bottom: 28px;
}

.cert-header .ticnes-logo {
  color: #1a365d;
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

.cert-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: #1a365d;
  line-height: 1.2;
}

.cert-header .cert-meta {
  font-size: 0.8rem;
  color: #555;
  margin-top: 8px;
  line-height: 1.6;
}

.cert-body {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 700px) {
  .cert-body {
    grid-template-columns: 1fr;
  }
}

.cert-params {
  background: #e8edf5;
  border-radius: var(--radius-md);
  padding: 16px;
}

.cert-params h4 {
  font-size: 0.85rem;
  color: #333;
  margin-bottom: 12px;
  font-weight: 700;
}

.param-item {
  margin-bottom: 10px;
}

.param-item .param-label {
  font-size: 0.75rem;
  color: #666;
  font-weight: 500;
}

.param-item .param-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1a365d;
}

.param-item .param-sub {
  font-size: 0.7rem;
  color: #888;
  font-style: italic;
}

.cert-chart {
  position: relative;
}

.cert-chart canvas {
  width: 100%;
  height: 180px;
}

.cert-chart h4 {
  text-align: center;
  font-size: 0.85rem;
  color: #333;
  margin-bottom: 8px;
  font-weight: 700;
}

.cert-audit-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cert-audit-results h4 {
  font-size: 0.85rem;
  color: #333;
  font-weight: 700;
  margin-bottom: 4px;
}

.cert-audit-item {
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}

.cert-audit-item.pass {
  background: rgba(34, 197, 94, 0.1);
  border-left: 3px solid #22c55e;
}

.cert-audit-item.warning {
  background: rgba(245, 158, 11, 0.1);
  border-left: 3px solid #f59e0b;
}

.cert-audit-item.fail {
  background: rgba(230, 57, 70, 0.1);
  border-left: 3px solid #e63946;
}

.cert-audit-item .audit-title {
  font-weight: 700;
  color: #333;
}

.cert-audit-item .audit-desc {
  color: #666;
  margin-top: 2px;
}

.cert-audit-item .audit-score {
  font-size: 1.1rem;
  font-weight: 800;
  float: right;
}

/* Benchmarks Table */
.cert-benchmarks {
  margin-bottom: 20px;
}

.cert-benchmarks h4 {
  font-size: 0.85rem;
  color: #333;
  font-weight: 700;
  margin-bottom: 10px;
}

.cert-benchmarks table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.cert-benchmarks th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid #ddd;
  color: #555;
  font-weight: 600;
}

.cert-benchmarks td {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  color: #333;
}

.cert-benchmarks .check {
  color: #22c55e;
}

/* Signatory */
.cert-signatory {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #ddd;
}

.cert-signatory .sig-name {
  font-weight: 800;
  font-size: 1rem;
  color: #1a365d;
}

.cert-signatory .sig-statement {
  font-size: 0.75rem;
  color: #555;
  line-height: 1.5;
  max-width: 500px;
  font-style: italic;
}

.cert-seal {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a365d, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 0.7rem;
  text-align: center;
  line-height: 1.2;
  padding: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.cert-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #555;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 10;
}

.cert-close-btn:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* ── Loading States ──────────────────────────────────────────────────────── */
.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.processing-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}

.processing-bar .fill {
  height: 100%;
  background: var(--gradient-accent);
  border-radius: 2px;
  transition: width 0.5s ease;
  animation: shimmer 1.5s infinite;
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }

  100% {
    opacity: 1;
  }
}

@keyframes pulseGlow {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(0, 200, 255, 0.2);
  }

  50% {
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.4);
  }
}

/* ── Toasts ──────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  animation: slideIn 0.3s ease;
  max-width: 350px;
  box-shadow: var(--shadow-lg);
}

.toast.success {
  background: #166534;
  color: #bbf7d0;
  border: 1px solid #22c55e44;
}

.toast.error {
  background: #7f1d1d;
  color: #fecaca;
  border: 1px solid #e6394644;
}

.toast.info {
  background: #1e3a5f;
  color: #bae6fd;
  border: 1px solid #00c8ff44;
}

.toast.warning {
  background: #713f12;
  color: #fef3c7;
  border: 1px solid #f59e0b44;
}

/* ── Assessment Detail Modal ─────────────────────────────────────────────── */
.assessment-modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xl);
  max-width: 960px;
  width: 100%;
  padding: 32px 36px;
  position: relative;
  color: var(--text-primary);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 200, 255, 0.06);
  max-height: 92vh;
  overflow-y: auto;
  animation: slideIn 0.3s ease;
}

.assessment-modal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-accent);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.assess-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg-hover);
  border: 1px solid var(--border-primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 10;
}

.assess-close-btn:hover {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
}

/* Header */
.assess-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.assess-title h2 {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-white) 0%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.assess-title p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.assess-decision-badge {
  padding: 8px 20px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.assess-decision-badge.selected {
  background: rgba(34, 197, 94, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.assess-decision-badge.rejected {
  background: rgba(230, 57, 70, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(230, 57, 70, 0.3);
}

/* Tabs */
.assess-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 24px;
  border: 1px solid var(--border-primary);
}

.assess-tab {
  flex: 1;
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.assess-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.assess-tab.active {
  background: var(--gradient-accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 200, 255, 0.2);
}

/* Panels */
.assess-panel.hidden {
  display: none;
}

/* Scoring Matrix */
.assess-section {
  margin-bottom: 28px;
}

.assess-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
}

.assess-matrix-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-primary);
}

.assess-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.assess-matrix thead th {
  padding: 12px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-align: left;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-primary);
  white-space: nowrap;
}

.assess-matrix tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  vertical-align: top;
}

.assess-matrix tbody tr:hover {
  background: var(--bg-hover);
}

/* Score indicators */
.score-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.85rem;
}

.score-indicator.score-0 {
  background: rgba(230, 57, 70, 0.2);
  color: var(--accent-red);
}

.score-indicator.score-1 {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-yellow);
}

.score-indicator.score-2 {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

.score-indicator.score-3 {
  background: rgba(34, 197, 94, 0.25);
  color: var(--accent-green);
}

.weight-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
}

.weight-tag.alto {
  background: rgba(230, 57, 70, 0.12);
  color: #fca5a5;
}

.weight-tag.medio {
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
}

/* Matrix footer */
.assess-matrix tfoot td {
  padding: 14px;
  font-weight: 700;
  border-top: 2px solid var(--border-accent);
  background: var(--bg-card);
  color: var(--text-primary);
}

.total-percentage {
  font-size: 1.3rem;
  font-weight: 800;
}

.total-percentage.pass {
  color: var(--accent-green);
}

.total-percentage.fail {
  color: var(--accent-red);
}

/* Summary */
.assess-summary {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 20px;
  line-height: 1.8;
  color: var(--text-primary);
  font-size: 0.88rem;
  white-space: pre-line;
}

/* Reasons */
.assess-reasons-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reason-item {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-primary);
}

.reason-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gradient-accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.reason-content .reason-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.reason-content .reason-detail {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Email Preview */
.assess-email-preview {
  background: #fdf8f0;
  border-radius: var(--radius-md);
  border: 1px solid #e5ddd0;
  overflow: hidden;
}

.email-field {
  padding: 12px 20px;
  border-bottom: 1px solid #e5ddd0;
  font-size: 0.85rem;
  color: #444;
}

.email-label {
  font-weight: 700;
  color: #333;
  margin-right: 8px;
}

.email-body {
  padding: 24px 20px;
  font-size: 0.88rem;
  line-height: 1.9;
  color: #333;
  white-space: pre-line;
  background: #fff;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .app-container {
    padding: 12px;
  }

  .card {
    padding: 16px;
  }

  .panel-header h2 {
    font-size: 1.2rem;
  }

  .btn {
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  .certificate-card {
    padding: 20px;
  }

  .assessment-modal-card {
    padding: 20px 16px;
  }

  .assess-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

.results-table tbody tr.clickable-row {
  cursor: pointer;
  transition: var(--transition);
}

.results-table tbody tr.clickable-row:hover {
  background: var(--bg-hover);
  box-shadow: inset 3px 0 0 var(--accent-cyan);
}

/* ── Sigma Stress Indicator ───────────────────────────────────────────────── */

.stress-indicator {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-primary);
  background: var(--bg-card-alt);
  transition: border-color 0.4s ease, background 0.4s ease;
}

.stress-indicator-bar {
  height: 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  margin-bottom: 8px;
}

.stress-fill {
  height: 100%;
  border-radius: 4px;
  width: 0%;
  transition: width 0.4s ease, background 0.4s ease;
  background: var(--accent-green);
}

.stress-label {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stress-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 20px;
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.3);
  transition: all 0.4s ease;
  white-space: nowrap;
}

.stress-detail {
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: color 0.4s ease;
}

.stress-hint {
  margin-top: 7px;
  font-size: 0.73rem;
  color: var(--accent-yellow);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* State: moderate */
.stress-indicator.moderate {
  border-color: rgba(249, 115, 22, 0.3);
  background: rgba(249, 115, 22, 0.05);
}
.stress-indicator.moderate .stress-badge {
  background: rgba(249, 115, 22, 0.15);
  color: var(--accent-orange);
  border-color: rgba(249, 115, 22, 0.3);
}
.stress-indicator.moderate .stress-fill {
  background: var(--accent-orange);
}

/* State: high (stress test eligible) */
.stress-indicator.high {
  border-color: rgba(230, 57, 70, 0.4);
  background: rgba(230, 57, 70, 0.06);
  box-shadow: 0 0 12px rgba(230, 57, 70, 0.08);
}
.stress-indicator.high .stress-badge {
  background: rgba(230, 57, 70, 0.18);
  color: #ff6b6b;
  border-color: rgba(230, 57, 70, 0.4);
}
.stress-indicator.high .stress-fill {
  background: linear-gradient(90deg, var(--accent-orange), var(--accent-red));
}
.stress-indicator.high .stress-detail {
  color: #ff9999;
}
