.user-header-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.user-header-title h2 {
  margin: 0;
}

:root {
  --brand-primary: #1b2567;
  --brand-accent: #ffb200;
  --brand-bg: #f5f7fb;
  --brand-surface: #ffffff;
  --brand-muted: #70799f;
  --brand-danger: #d93654;
  --brand-success: #2f9d5d;
  --shadow-soft: 0 10px 25px rgba(21, 35, 102, 0.12);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--brand-bg);
  color: #1a2233;
}

/* Prevent text selection and right-click on exam page */
body[oncontextmenu] {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
}

a {
  color: inherit;
  text-decoration: none;
}

.brand-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2.5rem;
  background: var(--brand-surface);
  box-shadow: var(--shadow-soft);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-navbar__logo {
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.12em;
  color: var(--brand-primary);
  cursor: pointer;
  transition: opacity 0.2s;
}

.brand-navbar__logo:hover {
  opacity: 0.8;
}

.brand-navbar__links {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.brand-navbar__button {
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  background: var(--brand-primary);
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-navbar__button.secondary {
  background: transparent;
  color: var(--brand-primary);
  border: 1px solid rgba(27, 37, 103, 0.2);
}

.brand-navbar__button.danger {
  background: var(--brand-danger);
  color: #fff;
}

.brand-navbar__button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(27, 37, 103, 0.16);
}

.brand-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  align-items: center;
  padding: 3rem 2.5rem 1rem;
}

.brand-hero__content h1 {
  font-size: 2.6rem;
  margin-bottom: 1rem;
  color: var(--brand-primary);
}

.brand-hero__content p {
  color: var(--brand-muted);
  line-height: 1.6;
}

.brand-hero__cta {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
}

.brand-badges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  padding: 2.5rem;
}

.badge-card {
  background: var(--brand-surface);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.badge-card h3 {
  margin: 0;
  color: var(--brand-primary);
}

.brand-footer {
  padding: 2rem 2.5rem;
  background: var(--brand-surface);
  text-align: center;
  color: var(--brand-muted);
  border-top: 1px solid rgba(112, 121, 159, 0.2);
  margin-top: 4rem;
}

.form-card {
  max-width: 640px;
  margin: 2.5rem auto;
  padding: 2.5rem;
  background: var(--brand-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.form-card h2 {
  margin-top: 0;
  color: var(--brand-primary);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.4rem;
  margin-top: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-weight: 600;
  color: var(--brand-primary);
}

.form-group input,
.form-group select {
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(27, 37, 103, 0.2);
  border-radius: var(--radius-sm);
  font-size: 1rem;
}

.form-actions {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.brand-alert {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
  margin-top: 1.2rem;
  display: none;
}

.brand-alert.show {
  display: block;
}

.brand-alert.success {
  background: rgba(47, 157, 93, 0.12);
  color: var(--brand-success);
  border: 1px solid rgba(47, 157, 93, 0.35);
}

.brand-alert.error {
  background: rgba(217, 54, 84, 0.12);
  color: var(--brand-danger);
  border: 1px solid rgba(217, 54, 84, 0.35);
}

.exam-wrapper {
  max-width: 1380px;
  margin: 2rem auto 3.5rem;
  padding: 3rem 4rem;
  background: var(--brand-surface);
  border-radius: var(--radius-lg);
  /* Prevent text selection and right-click */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  box-shadow: var(--shadow-soft);
}

.exam-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  color: var(--brand-muted);
}

.exam-question h2 {
  color: var(--brand-primary);
  margin-top: 0;
}

.options-list {
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
  display: grid;
  gap: 0.8rem;
}

.options-list li,
.options-list .option-item {
  border: 1px solid rgba(27, 37, 103, 0.15);
  border-radius: var(--radius-md);
  padding: 0; /* Remove padding from li, let label handle it */
  transition: border 0.2s ease, box-shadow 0.2s ease;
  background: rgba(27, 37, 103, 0.02);
  cursor: pointer; /* Make entire item clickable */
}

.options-list li:hover,
.options-list .option-item:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-soft);
}

/* Make the label fill the entire option area */
.options-list .option-label {
  display: block;
  width: 100%;
  padding: 1.1rem 1.3rem;
  cursor: pointer;
  user-select: none;
  margin: 0;
}

.options-list .option-label:hover {
  background: rgba(27, 37, 103, 0.05);
}

/* Style for selected option */
.options-list input[type="radio"]:checked + .option-text {
  font-weight: 600;
  color: var(--brand-primary);
}

.options-list li:has(input[type="radio"]:checked),
.options-list .option-item:has(input[type="radio"]:checked) {
  border-color: var(--brand-primary);
  background: rgba(27, 37, 103, 0.08);
  box-shadow: 0 0 0 2px rgba(27, 37, 103, 0.1);
}

.options-list input[type="radio"] {
  margin-right: 0.75rem;
  transform: scale(1.1);
  cursor: pointer;
}

.exam-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(27, 37, 103, 0.08);
  color: var(--brand-primary);
  font-weight: 600;
}

.timer-display {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--brand-danger);
}

.warning-banner {
  margin-top: 1rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-md);
  background: rgba(217, 54, 84, 0.12);
  color: var(--brand-danger);
  border: 1px solid rgba(217, 54, 84, 0.3);
  display: none;
}

.warning-banner.show {
  display: block;
}

.calculator-panel {
  position: fixed;
  top: 120px;
  right: 40px;
  width: 260px;
  background: var(--brand-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(27, 37, 103, 0.18);
  display: none;
  z-index: 110;
}

.calculator-header {
  padding: 0.7rem 1rem;
  background: var(--brand-primary);
  color: #fff;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
}

.calculator-display {
  padding: 1rem;
  background: rgba(27, 37, 103, 0.05);
  font-size: 1.4rem;
  text-align: right;
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
  padding: 1rem;
}

.calculator-grid button {
  padding: 0.9rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 1rem;
  font-weight: 600;
  background: rgba(27, 37, 103, 0.08);
  cursor: pointer;
  transition: background 0.2s ease;
}

.calculator-grid button.operator {
  background: rgba(255, 178, 0, 0.18);
  color: var(--brand-primary);
}

.calculator-grid button.equal {
  grid-column: span 2;
  background: var(--brand-primary);
  color: #fff;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.progress-card {
  padding: 1rem 1.2rem;
  border-radius: var(--radius-md);
  background: rgba(27, 37, 103, 0.06);
}

.progress-card h4 {
  margin: 0 0 0.6rem;
  color: var(--brand-primary);
}

.result-card {
  max-width: 1280px;
  margin: 3rem auto;
  padding: 3rem 3.5rem;
  background: linear-gradient(135deg, #ffffff 0%, #f5f8ff 55%, #fef7ff 100%);
  border-radius: 28px;
  box-shadow: 0 30px 60px rgba(27, 37, 103, 0.18);
  display: grid;
  gap: 2.5rem;
}

.result-banner {
  text-align: center;
  display: grid;
  gap: 0.8rem;
}

.result-banner h1 {
  margin: 0;
  font-size: 2.3rem;
  color: var(--brand-primary);
}

.result-banner p {
  color: var(--brand-muted);
}

.result-badge {
  display: inline-block;
  margin: 0 auto;
  padding: 0.4rem 1.2rem;
  border-radius: 999px;
  background: rgba(27, 37, 103, 0.12);
  color: var(--brand-primary);
  font-weight: 700;
  letter-spacing: 0.05em;
  font-size: 0.85rem;
}

.result-score-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: stretch;
}

.result-score-card {
  flex: 1 1 300px;
  min-width: 280px;
  background: rgba(27, 37, 103, 0.08);
  border-radius: 24px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
  position: relative;
  overflow: hidden;
}

.result-score-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(255, 178, 0, 0.4), transparent 55%);
  z-index: 0;
}

.result-score-ring {
  --progress: 0deg;
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #ffffff 68%, transparent 70%),
    conic-gradient(var(--brand-accent) var(--progress), rgba(27, 37, 103, 0.18) var(--progress));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  z-index: 1;
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.65);
  animation: pulseGlow 4s ease-in-out infinite alternate;
}

.result-score-ring span {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.result-score-ring small {
  color: var(--brand-muted);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.result-highlight-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
  z-index: 1;
  width: 100%;
}

.result-highlight-list li {
  color: #1f2650;
  background: rgba(255, 255, 255, 0.6);
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  font-size: 0.95rem;
  box-shadow: 0 10px 20px rgba(27, 37, 103, 0.08);
}

.result-score-metrics {
  flex: 2 1 420px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1.2rem;
}

.result-metric {
  background: #fff;
  border-radius: 18px;
  padding: 1.4rem 1.6rem;
  box-shadow: 0 18px 35px rgba(27, 37, 103, 0.15);
  display: grid;
  gap: 0.45rem;
}

.result-metric__label {
  font-size: 0.95rem;
  color: var(--brand-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.result-metric__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.result-breakdown h2 {
  margin: 0 0 0.6rem;
  color: var(--brand-primary);
}

.result-breakdown p {
  color: var(--brand-muted);
  margin: 0 0 1.5rem;
}

.result-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
}

.result-category-card {
  background: #fff;
  border-radius: 18px;
  padding: 1.4rem 1.6rem;
  box-shadow: 0 18px 32px rgba(27, 37, 103, 0.12);
  display: grid;
  gap: 1rem;
}

.result-category-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-category-label {
  font-weight: 700;
  color: var(--brand-primary);
  letter-spacing: 0.08em;
}

.result-category-score {
  font-weight: 700;
  color: var(--brand-accent);
  font-size: 1.2rem;
}

.result-category-bars {
  display: grid;
  gap: 0.8rem;
}

.result-bar span {
  font-size: 0.85rem;
  color: var(--brand-muted);
  font-weight: 600;
  display: inline-block;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
}

.result-bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(27, 37, 103, 0.15);
  overflow: hidden;
}

.result-bar-fill {
  height: 100%;
  border-radius: inherit;
  width: 0;
  transition: width 0.6s ease;
}

.result-bar-fill.success {
  background: linear-gradient(135deg, #33d69f, #1bb978);
}

.result-bar-fill.danger {
  background: linear-gradient(135deg, #ff9c9c, #ff5c5c);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.result-footer-note {
  text-align: center;
  color: var(--brand-primary);
  font-weight: 600;
}

.certificate {
  max-width: 960px;
  margin: 2.5rem auto;
  padding: 4rem 4.5rem;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 244, 252, 0.92));
  position: relative;
  box-shadow: 0 40px 70px rgba(27, 37, 103, 0.18);
  overflow: hidden;
}

.certificate::before,
.certificate::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(0);
  opacity: 0.35;
  animation: floatDrift 14s ease-in-out infinite alternate;
}

.certificate::before {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle at center, rgba(27, 37, 103, 0.18), transparent 65%);
  top: -120px;
  left: -80px;
  animation-delay: -4s;
}

.certificate::after {
  width: 360px;
  height: 360px;
  background: radial-gradient(circle at center, rgba(255, 178, 0, 0.25), transparent 70%);
  bottom: -150px;
  right: -120px;
}

.certificate-content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: grid;
  gap: 1.4rem;
}

.certificate h1 {
  margin: 0;
  font-size: 3rem;
  color: var(--brand-primary);
  letter-spacing: 0.3em;
}

.certificate h2 {
  color: var(--brand-accent);
  margin: 0.5rem 0;
  font-size: 1.8rem;
}

.certificate-details {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  text-align: left;
  font-weight: 600;
  color: #1f2650;
}

.certificate-footer {
  margin-top: 2.8rem;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #1f2650;
}

@keyframes pulseGlow {
  from {
    box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.75), 0 0 0 0 rgba(255, 178, 0, 0.0);
  }
  to {
    box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.55), 0 0 35px 0 rgba(255, 178, 0, 0.4);
  }
}

@keyframes floatDrift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(30px, -20px, 0) scale(1.1);
  }
}

.admin-dashboard {
  max-width: 1540px;
  margin: 2rem auto 3rem;
  background: var(--brand-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 3rem 3.5rem;
}

.tab-nav {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.tab-button {
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  border: none;
  background: rgba(27, 37, 103, 0.08);
  color: var(--brand-primary);
  font-weight: 600;
  cursor: pointer;
}

.tab-button.active {
  background: var(--brand-primary);
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Table wrapper for horizontal scrolling on mobile */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 1.5rem;
  position: relative;
  /* Add subtle shadow to indicate scrollability */
  box-shadow: inset -10px 0 10px -10px rgba(0, 0, 0, 0.1);
}

.table {
  width: 100%;
  min-width: 1200px; /* Minimum width to prevent cramping - increased for delete column */
  border-collapse: collapse;
  font-size: 1rem;
}

.table thead {
  background: rgba(27, 37, 103, 0.08);
}

.table th,
.table td {
  padding: 0.8rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid rgba(27, 37, 103, 0.12);
  white-space: nowrap; /* Prevent text wrapping in cells */
}

.table th:first-child,
.table td:first-child {
  padding-left: 1.1rem;
}

.table th:last-child,
.table td:last-child {
  padding-right: 1.1rem;
}

.table tbody tr {
  cursor: pointer;
}

.table tbody tr:hover {
  background: rgba(27, 37, 103, 0.06);
}

/* Allow some cells to wrap if needed (like prompts) */
.table td[data-wrap="true"] {
  white-space: normal;
  max-width: 300px;
  word-wrap: break-word;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.chip.success {
  background: rgba(47, 157, 93, 0.16);
  color: var(--brand-success);
}

.chip.warning {
  background: rgba(255, 178, 0, 0.2);
  color: var(--brand-primary);
}

.chip.danger {
  background: rgba(217, 54, 84, 0.2);
  color: var(--brand-danger);
}

.action-group {
  display: flex;
  gap: 0.6rem;
}

.small-button {
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-weight: 600;
  background: rgba(27, 37, 103, 0.08);
  color: var(--brand-primary);
}

.small-button.danger {
  background: rgba(217, 54, 84, 0.15);
  color: var(--brand-danger);
}

.small-button.success {
  background: rgba(47, 157, 93, 0.15);
  color: var(--brand-success);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.metric-card {
  padding: 1.2rem;
  border-radius: var(--radius-md);
  background: rgba(27, 37, 103, 0.06);
}

.admin-option-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.2rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  background: rgba(27, 37, 103, 0.08);
  color: var(--brand-primary);
  border: 1px solid rgba(27, 37, 103, 0.15);
}

.admin-option-pill small {
  font-size: 0.75rem;
  color: var(--brand-muted);
}

.admin-option-pill.selected {
  background: rgba(27, 37, 103, 0.2);
  border-color: rgba(27, 37, 103, 0.35);
  color: var(--brand-primary);
  font-weight: 600;
  box-shadow: 0 6px 12px rgba(27, 37, 103, 0.2);
}

.admin-option-pill.correct {
  border-color: rgba(47, 157, 93, 0.4);
  box-shadow: 0 6px 12px rgba(47, 157, 93, 0.2);
}

.responses-grid {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.response-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 22px 40px rgba(27, 37, 103, 0.12);
  padding: 1.8rem 2rem;
  display: grid;
  gap: 1.4rem;
}

.response-card__header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.response-card__header h4 {
  margin: 0;
  color: var(--brand-primary);
  font-size: 1.2rem;
}

.response-card__header p {
  margin: 0.35rem 0 0;
  color: var(--brand-muted);
  line-height: 1.5;
}

.response-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(27, 37, 103, 0.12);
  color: var(--brand-primary);
  font-weight: 700;
}

.response-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  color: var(--brand-muted);
  font-size: 0.95rem;
}

.response-options h5 {
  margin: 0 0 0.6rem;
  color: var(--brand-primary);
  font-size: 1rem;
}

.response-options div {
  display: flex;
  flex-wrap: wrap;
}

.response-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  font-weight: 600;
  color: var(--brand-primary);
}

.badge {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.badge.success {
  background: rgba(47, 157, 93, 0.18);
  color: var(--brand-success);
}

.badge.danger {
  background: rgba(217, 54, 84, 0.18);
  color: var(--brand-danger);
}

.icon-button {
  background: rgba(27, 37, 103, 0.08);
  border: none;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s ease, transform 0.2s ease;
}

.icon-button.delete-question {
  background: rgba(217, 54, 84, 0.15);
  color: var(--brand-danger);
}

.delete-cell {
  text-align: right;
}

.icon-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(27, 37, 103, 0.16);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1.5rem;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--brand-surface);
  padding: 2rem 2.4rem;
  border-radius: 20px;
  box-shadow: 0 30px 55px rgba(27, 37, 103, 0.18);
  max-width: 460px;
  width: 100%;
  display: grid;
  gap: 1rem;
}

.modal-content h3 {
  margin: 0;
  color: var(--brand-primary);
}

.modal-content p {
  margin: 0;
  color: var(--brand-muted);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.delete-button {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 2px solid var(--brand-danger);
  cursor: pointer;
  background: var(--brand-danger);
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
  min-width: 110px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(217, 54, 84, 0.3);
  gap: 0.3rem;
}

.delete-cell {
  position: sticky;
  right: 0;
  background: var(--brand-surface);
  z-index: 10;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
}

.table th:last-child,
.table td.delete-cell {
  position: sticky;
  right: 0;
  background: var(--brand-surface);
  z-index: 10;
}

.table thead th:last-child {
  background: rgba(27, 37, 103, 0.08);
  z-index: 11;
}

.delete-button:hover {
  background: rgba(217, 54, 84, 0.9);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 16px rgba(217, 54, 84, 0.4);
}

.delete-button:active {
  transform: translateY(0) scale(1);
  box-shadow: 0 2px 6px rgba(217, 54, 84, 0.3);
}

/* Question table option styling */
.option-item {
  padding: 0.4rem 0.6rem;
  margin: 0.3rem 0;
  border-radius: 4px;
  background: rgba(27, 37, 103, 0.05);
  border-left: 3px solid transparent;
  font-size: 0.9rem;
  line-height: 1.4;
}

.option-item.correct-option {
  background: rgba(34, 197, 94, 0.15);
  border-left-color: #22c55e;
  font-weight: 600;
}

.option-item strong {
  color: var(--brand-primary);
  margin-right: 0.5rem;
}

.correct-option-badge {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  border: 2px solid #22c55e;
}

.category-badge {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  background: rgba(27, 37, 103, 0.1);
  color: var(--brand-primary);
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: capitalize;
}

.difficulty-badge {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 30px;
  text-align: center;
}

.status-badge {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.85rem;
}

.status-badge.active {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.status-badge.disabled {
  background: rgba(107, 114, 128, 0.15);
  color: #6b7280;
}

/* Responsive styles for tablets and mobile */
@media (max-width: 1024px) {
  .admin-dashboard {
    margin: 1.5rem 1rem;
    padding: 2rem 1.5rem;
  }

  .table {
    min-width: 700px;
    font-size: 0.9rem;
  }

  .table th,
  .table td {
    padding: 0.7rem 0.7rem;
  }
}

@media (max-width: 768px) {
  .brand-navbar {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .brand-navbar__logo {
    font-size: 1.2rem;
  }

  .brand-navbar__links {
    flex-direction: column;
    width: 100%;
    gap: 0.8rem;
  }

  .brand-navbar__button {
    width: 100%;
  }

  /* Adjust session ID display on mobile */
  .brand-navbar > div:last-child {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }

  #sessionIdDisplay {
    font-size: 0.8rem;
    text-align: center;
    width: 100%;
  }

  .form-card,
  .exam-wrapper,
  .result-card,
  .admin-dashboard {
    margin: 1rem 0.5rem;
    padding: 1.5rem 1rem;
    border-radius: var(--radius-md);
  }

  .admin-dashboard {
    margin: 1rem 0.5rem;
    padding: 1.5rem 1rem;
  }

  .tab-nav {
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
  }

  .tab-button {
    width: 100%;
    padding: 0.8rem 1rem;
    text-align: center;
  }

  .table-wrapper {
    margin-left: -1rem;
    margin-right: -1rem;
    padding: 0 1rem;
  }

  .table {
    min-width: 600px;
    font-size: 0.85rem;
  }

  .table th,
  .table td {
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
  }

  .table th:first-child,
  .table td:first-child {
    padding-left: 1rem;
  }

  .table th:last-child,
  .table td:last-child {
    padding-right: 1rem;
  }

  /* Stack action buttons on mobile */
  .action-group {
    flex-direction: column;
    gap: 0.4rem;
  }

  .small-button {
    width: 100%;
    padding: 0.5rem;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .result-score-row {
    flex-direction: column;
  }

  .result-score-card {
    width: 100%;
  }

  .result-score-ring {
    width: 160px;
    height: 160px;
  }

  .result-score-metrics {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .brand-hero {
    padding: 2rem 1.5rem;
  }

  /* Question form buttons */
  #tab-questions > div:first-of-type {
    flex-direction: column;
    gap: 0.8rem;
  }

  #tab-questions > div:first-of-type button {
    width: 100%;
    margin-left: 0 !important;
  }

  /* Admin user detail page */
  .progress-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .response-card {
    padding: 1.2rem 1rem;
  }

  .response-card__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .response-meta {
    flex-direction: column;
    gap: 0.5rem;
  }

  .response-summary {
    flex-direction: column;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .admin-dashboard {
    margin: 0.5rem 0.25rem;
    padding: 1rem 0.75rem;
  }

  .table {
    min-width: 500px;
    font-size: 0.8rem;
  }

  .table th,
  .table td {
    padding: 0.5rem 0.4rem;
    font-size: 0.8rem;
  }

  .chip {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.2rem;
  }
}

/* Feedback Page Styles */
.feedback-wrapper {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--brand-bg);
}

.feedback-card {
  background: var(--brand-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 3rem;
  max-width: 600px;
  width: 100%;
}

.feedback-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.feedback-header h1 {
  font-size: 2rem;
  color: var(--brand-primary);
  margin: 0 0 0.5rem 0;
  font-weight: 700;
}

.feedback-header p {
  color: var(--brand-muted);
  font-size: 1rem;
  margin: 0;
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.feedback-rating-section {
  text-align: center;
}

.feedback-label {
  display: block;
  font-weight: 600;
  color: var(--brand-primary);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.star-rating {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  transition: transform 0.2s ease, opacity 0.2s ease;
  color: #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
}

.star-btn:hover {
  transform: scale(1.1);
  opacity: 0.8;
}

.star-btn:active {
  transform: scale(0.95);
}

.star-btn.star-active {
  color: var(--brand-accent);
}

.star-btn svg {
  width: 40px;
  height: 40px;
  transition: fill 0.2s ease;
}

.star-btn.star-active svg {
  fill: var(--brand-accent);
}

.rating-text {
  font-size: 0.95rem;
  color: var(--brand-muted);
  margin: 0;
  min-height: 1.5rem;
  transition: color 0.2s ease;
}

.feedback-text-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.feedback-textarea {
  width: 100%;
  padding: 1rem;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  transition: border-color 0.2s ease;
  background: var(--brand-surface);
  color: #1a2233;
}

.feedback-textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.feedback-textarea::placeholder {
  color: var(--brand-muted);
}

.char-count {
  text-align: right;
  font-size: 0.85rem;
  color: var(--brand-muted);
  margin-top: -0.25rem;
}

.feedback-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.feedback-actions .brand-navbar__button {
  min-width: 150px;
  padding: 0.75rem 2rem;
  font-size: 1rem;
}

.feedback-actions .brand-navbar__button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.feedback-message {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  text-align: center;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}

.feedback-message--success {
  background: #d1fae5;
  color: var(--brand-success);
  border: 1px solid #a7f3d0;
}

.feedback-message--error {
  background: #fee2e2;
  color: var(--brand-danger);
  border: 1px solid #fecaca;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .feedback-card {
    padding: 2rem 1.5rem;
  }

  .feedback-header h1 {
    font-size: 1.75rem;
  }

  .star-btn svg {
    width: 35px;
    height: 35px;
  }

  .feedback-actions {
    flex-direction: column;
  }

  .feedback-actions .brand-navbar__button {
    width: 100%;
  }
}

/* Database Browser Styles */
.database-browser-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  align-items: flex-end;
}

.database-browser-controls > div {
  flex: 1;
  min-width: 200px;
}

.database-browser-controls label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--brand-primary);
  font-size: 0.9rem;
}

.database-browser-controls select,
.database-browser-controls input[type="text"] {
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1px solid rgba(27, 37, 103, 0.2);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--brand-surface);
  color: #1a2233;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.database-browser-controls select:focus,
.database-browser-controls input[type="text"]:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(27, 37, 103, 0.1);
}

.database-browser-controls .button-group {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.database-browser-controls .button-group button {
  white-space: nowrap;
  padding: 0.6rem 1.2rem;
}

.database-table-info {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(27, 37, 103, 0.05);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--brand-primary);
  font-size: 0.9rem;
  color: var(--brand-primary);
}

.database-table-info strong {
  font-weight: 700;
  margin-right: 0.5rem;
}

.database-table-info span {
  color: var(--brand-muted);
  margin: 0 0.5rem;
}

#databaseTable {
  width: 100%;
  min-width: 100%;
}

#databaseTable th {
  position: sticky;
  top: 0;
  background: var(--brand-primary);
  color: #fff;
  z-index: 10;
  user-select: none;
  transition: background-color 0.2s ease;
}

#databaseTable th:hover {
  background: rgba(27, 37, 103, 0.9);
  cursor: pointer;
}

#databaseTable th[style*="italic"] {
  background: rgba(27, 37, 103, 0.7);
  font-size: 0.85rem;
}

#databaseTable td {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.75rem 0.5rem;
  font-size: 0.9rem;
}

#databaseTable td[style*="italic"] {
  font-style: italic;
  color: var(--brand-muted);
  font-size: 0.85rem;
}

#databaseTable tr:hover {
  background: rgba(27, 37, 103, 0.03);
}

#databaseTable .danger {
  background: var(--brand-danger) !important;
  color: #fff !important;
  border: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#databaseTable .danger:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

#databaseTable .danger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.database-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.database-pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.database-pagination button:disabled:hover {
  transform: none;
}

.database-pagination span {
  font-weight: 600;
  color: var(--brand-primary);
  min-width: 100px;
  text-align: center;
}

.database-loading {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--brand-muted);
  font-size: 1rem;
}

.database-loading::before {
  content: "⏳ ";
  font-size: 1.2rem;
  margin-right: 0.5rem;
}

.database-error {
  text-align: center;
  padding: 2rem;
  color: var(--brand-danger);
  background: rgba(217, 54, 84, 0.1);
  border-radius: var(--radius-md);
  border: 1px solid rgba(217, 54, 84, 0.2);
  font-weight: 500;
}

.database-error::before {
  content: "⚠️ ";
  margin-right: 0.5rem;
}

/* Responsive Database Browser */
@media (max-width: 768px) {
  .database-browser-controls {
    flex-direction: column;
  }

  .database-browser-controls > div {
    width: 100%;
  }

  .database-browser-controls .button-group {
    width: 100%;
    justify-content: stretch;
  }

  .database-browser-controls .button-group button {
    flex: 1;
  }

  #databaseTable {
    font-size: 0.85rem;
  }

  #databaseTable th,
  #databaseTable td {
    padding: 0.5rem 0.3rem;
  }

  .database-pagination {
    flex-direction: column;
    gap: 0.75rem;
  }

  .database-pagination button {
    width: 100%;
    max-width: 200px;
  }
}

