/* ── CertMint App Styles ── */
/* Matches the landing page design system */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --mint: #00D68F;
  --mint-light: #00F5A0;
  --mint-dim: rgba(0, 214, 143, 0.1);
  --mint-border: rgba(0, 214, 143, 0.2);
  --dark: #0A0E17;
  --dark-card: #111827;
  --dark-card-hover: #1a2235;
  --dark-border: #1F2937;
  --dark-input: #0D1117;
  --gray: #9CA3AF;
  --gray-light: #D1D5DB;
  --white: #F9FAFB;
  --accent-blue: #3B82F6;
  --accent-orange: #F59E0B;
  --red: #EF4444;
  --red-dim: rgba(239, 68, 68, 0.1);
  --green: #10B981;
  --green-dim: rgba(16, 185, 129, 0.1);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--dark);
  color: var(--white);
  overflow-x: hidden;
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; }

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* ── App Shell ── */
.app-nav {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--dark-border);
  max-width: 1100px;
  margin: 0 auto;
}

.app-nav .logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--white);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--mint), var(--mint-light));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-user span {
  color: var(--gray);
  font-size: 0.85rem;
}

.nav-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--dark-border);
  background: transparent;
  color: var(--gray);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}

.nav-btn:hover {
  border-color: var(--gray);
  color: var(--white);
}

.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ── Auth Screen ── */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 16px;
  padding: 40px;
}

.auth-card .logo-center {
  text-align: center;
  margin-bottom: 32px;
}

.auth-card .logo-center h2 {
  font-size: 1.5rem;
  margin-top: 12px;
}

.auth-card .logo-center p {
  color: var(--gray);
  font-size: 0.9rem;
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border: 1px solid var(--dark-border);
  border-radius: 8px;
  overflow: hidden;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  background: transparent;
  color: var(--gray);
  border: none;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--mint-dim);
  color: var(--mint);
}

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

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--gray);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  background: var(--dark-input);
  border: 1px solid var(--dark-border);
  border-radius: 8px;
  color: var(--white);
  font-size: 0.95rem;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--mint);
}

.form-group input::placeholder {
  color: #4B5563;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--mint), var(--mint-light));
  border: none;
  border-radius: 8px;
  color: var(--dark);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: opacity 0.2s, transform 0.1s;
  margin-top: 8px;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  padding: 10px 20px;
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 8px;
  color: var(--white);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}

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

.btn-danger {
  padding: 10px 20px;
  background: var(--red-dim);
  border: 1px solid var(--red);
  border-radius: 8px;
  color: var(--red);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}

.error-msg {
  color: var(--red);
  font-size: 0.85rem;
  margin-top: 8px;
  text-align: center;
}

/* ── Dashboard ── */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.dash-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
}

.dash-header h1 .highlight {
  background: linear-gradient(135deg, var(--mint), var(--mint-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cert-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--mint-dim);
  border: 1px solid var(--mint-border);
  border-radius: 999px;
  color: var(--mint);
  font-size: 0.8rem;
  font-weight: 500;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.stat-card .stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--mint), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card .stat-label {
  color: var(--gray);
  font-size: 0.8rem;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-title {
  font-size: 0.8rem;
  color: var(--mint);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* Domain Scores */
.domain-scores {
  margin-bottom: 32px;
}

.domain-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.domain-name {
  width: 200px;
  font-size: 0.85rem;
  color: var(--gray-light);
  flex-shrink: 0;
}

.domain-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--dark-border);
  border-radius: 4px;
  overflow: hidden;
}

.domain-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--mint), var(--mint-light));
  transition: width 0.6s ease;
}

.domain-bar-fill.low { background: linear-gradient(90deg, var(--red), var(--accent-orange)); }
.domain-bar-fill.mid { background: linear-gradient(90deg, var(--accent-orange), var(--accent-blue)); }

.domain-percent {
  width: 42px;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--white);
}

/* Recent Exams Table */
.recent-exams {
  margin-bottom: 32px;
}

.exam-table {
  width: 100%;
  border-collapse: collapse;
}

.exam-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.75rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--dark-border);
  font-weight: 500;
}

.exam-table td {
  padding: 12px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--dark-border);
}

.exam-table tr:hover td {
  background: var(--dark-card-hover);
}

.score-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.score-badge.pass {
  background: var(--green-dim);
  color: var(--green);
}

.score-badge.fail {
  background: var(--red-dim);
  color: var(--red);
}

.link-btn {
  color: var(--mint);
  cursor: pointer;
  font-size: 0.85rem;
  background: none;
  border: none;
  font-family: 'DM Sans', sans-serif;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-btn:hover { color: var(--mint-light); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray);
}

.empty-state h3 {
  font-size: 1.2rem;
  color: var(--white);
  margin-bottom: 8px;
}

.empty-state p {
  margin-bottom: 24px;
  font-size: 0.95rem;
}

/* ── Exam Config ── */
.config-card {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 16px;
  padding: 32px;
  max-width: 600px;
  margin: 0 auto;
}

.config-card h2 {
  font-size: 1.4rem;
  margin-bottom: 24px;
}

.config-group {
  margin-bottom: 24px;
}

.config-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  font-weight: 500;
}

.option-row {
  display: flex;
  gap: 10px;
}

.option-btn {
  flex: 1;
  padding: 12px;
  text-align: center;
  background: var(--dark-input);
  border: 1px solid var(--dark-border);
  border-radius: 8px;
  color: var(--gray);
  font-size: 0.95rem;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}

.option-btn.selected {
  border-color: var(--mint);
  background: var(--mint-dim);
  color: var(--mint);
  font-weight: 600;
}

.option-btn:hover:not(.selected) {
  border-color: var(--gray);
}

.domain-checkboxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.domain-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--dark-input);
  border: 1px solid var(--dark-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
  color: var(--gray-light);
}

.domain-check.checked {
  border-color: var(--mint);
  background: var(--mint-dim);
  color: var(--mint);
}

.domain-check input { display: none; }

/* ── Exam Taking ── */
.exam-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--dark-border);
}

.exam-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--gray);
}

.progress-bar-bg {
  width: 200px;
  height: 4px;
  background: var(--dark-border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--mint-light));
  border-radius: 2px;
  transition: width 0.3s ease;
}

.timer {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--white);
}

.timer.warning { color: var(--accent-orange); }
.timer.danger { color: var(--red); }

.question-card {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 24px;
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.question-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  color: var(--gray);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.domain-tag {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--mint-dim);
  color: var(--mint);
  font-weight: 500;
}

.question-text {
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 24px;
  color: var(--white);
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--dark-input);
  border: 1px solid var(--dark-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.option-card:hover {
  border-color: var(--gray);
  background: var(--dark-card-hover);
}

.option-card.selected {
  border-color: var(--mint);
  background: var(--mint-dim);
}

.option-card.correct {
  border-color: var(--green);
  background: var(--green-dim);
}

.option-card.wrong {
  border-color: var(--red);
  background: var(--red-dim);
}

.option-letter {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
  background: var(--dark-border);
  color: var(--gray-light);
  font-family: 'Space Grotesk', sans-serif;
}

.option-card.selected .option-letter {
  background: var(--mint);
  color: var(--dark);
}

.option-card.correct .option-letter {
  background: var(--green);
  color: var(--dark);
}

.option-card.wrong .option-letter {
  background: var(--red);
  color: white;
}

.option-text {
  font-size: 0.95rem;
  line-height: 1.5;
  padding-top: 2px;
}

/* Question Navigation */
.exam-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.exam-nav button {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}

.btn-prev, .btn-next {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  color: var(--white);
}

.btn-prev:hover, .btn-next:hover {
  border-color: var(--mint);
}

.btn-prev:disabled, .btn-next:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-submit-exam {
  background: linear-gradient(135deg, var(--mint), var(--mint-light));
  border: none;
  color: var(--dark);
  font-weight: 600;
  padding: 10px 28px;
}

.btn-submit-exam:hover { opacity: 0.9; }

/* Question dots navigator */
.question-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 24px;
}

.q-dot {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--dark-border);
  background: var(--dark-input);
  color: var(--gray);
  font-family: 'Space Grotesk', sans-serif;
  transition: all 0.2s;
}

.q-dot.current {
  border-color: var(--mint);
  color: var(--mint);
  background: var(--mint-dim);
}

.q-dot.answered {
  background: var(--dark-card-hover);
  color: var(--white);
  border-color: var(--gray);
}

.q-dot:hover {
  border-color: var(--mint);
}

/* ── Results Screen ── */
.results-header {
  text-align: center;
  padding: 40px 0;
}

.score-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  border: 4px solid var(--dark-border);
  position: relative;
}

.score-circle.pass {
  border-color: var(--green);
  background: var(--green-dim);
}

.score-circle.fail {
  border-color: var(--red);
  background: var(--red-dim);
}

.score-circle .score-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
}

.score-circle.pass .score-num { color: var(--green); }
.score-circle.fail .score-num { color: var(--red); }

.score-circle .score-label {
  font-size: 0.8rem;
  color: var(--gray);
  margin-top: 4px;
}

.pass-fail-badge {
  display: inline-flex;
  padding: 6px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.pass-fail-badge.pass {
  background: var(--green-dim);
  color: var(--green);
}

.pass-fail-badge.fail {
  background: var(--red-dim);
  color: var(--red);
}

.results-summary {
  color: var(--gray);
  font-size: 0.95rem;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

.results-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

/* Explanation in review mode */
.explanation-box {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--mint-dim);
  border: 1px solid var(--mint-border);
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--gray-light);
  line-height: 1.6;
}

.explanation-box strong {
  color: var(--mint);
}

/* Source documentation link */
.source-link {
  margin-top: 10px;
  padding: 8px 14px;
  font-size: 0.82rem;
  color: var(--gray);
  display: flex;
  align-items: center;
}

.source-link a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.15s;
}

.source-link a:hover {
  color: var(--mint-light);
  text-decoration: underline;
}

/* ── Loading ── */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.loading-screen h2 {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.loading-screen p {
  color: var(--gray);
  font-size: 0.95rem;
  margin-bottom: 32px;
}

.mint-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--dark-border);
  border-top-color: var(--mint);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Confirm Modal ── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 16px;
  padding: 32px;
  max-width: 420px;
  width: 90%;
  text-align: center;
}

.modal-card h3 {
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.modal-card p {
  color: var(--gray);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ── Certification Selection ── */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.cert-card {
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  padding: 24px;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.cert-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.cert-card-selected {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.cert-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.cert-provider-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.cert-selected-check {
  font-size: 0.8rem;
  font-weight: 600;
}

.cert-card-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.3;
}

.cert-card-code {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
  opacity: 0.8;
}

.cert-card-desc {
  font-size: 0.85rem;
  color: var(--gray);
  line-height: 1.5;
  margin-bottom: 16px;
}

.cert-domains-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid rgba(0,0,0,0.06);
  padding-top: 14px;
}

.cert-domain-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}

.cert-domain-name {
  color: var(--text);
  font-weight: 500;
}

.cert-domain-weight {
  font-weight: 700;
  font-size: 0.78rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .results-grid { grid-template-columns: 1fr; }
  .domain-checkboxes { grid-template-columns: 1fr; }
  .domain-name { width: 140px; }
  .progress-bar-bg { width: 100px; }
  .exam-nav { flex-wrap: wrap; gap: 10px; }
  .auth-card { padding: 28px 20px; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .option-row { flex-direction: column; }
  .app-container { padding: 20px 16px; }
  .question-card { padding: 20px; }
  .dash-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .cert-grid { grid-template-columns: 1fr; }
}
