/* ============================================
   TESSA Training Platform: Stylesheet
   Palette: teal/navy/cyan for tessa-tools.co.uk
   ============================================ */

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #001321;
  color: #B8E3E9;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: #24ACC3;
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover { color: #ffffff; }

h1, h2, h3, h4 {
  font-family: 'Poppins', sans-serif;
  color: #ffffff;
  font-weight: 700;
  line-height: 1.2;
}

h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }

/* --- Accent gradient text (cyan shimmer) --- */
.accent {
  color: #24ACC3;
  background: linear-gradient(90deg, #24ACC3, #B8E3E9, #24ACC3);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 200% center; }
}

/* --- Label (uppercase tag) --- */
.label {
  display: inline-block;
  font-family: 'Poppins', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #24ACC3;
  margin-bottom: 0.75rem;
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.container--wide {
  max-width: 900px;
}

/* --- Header bar --- */
.t-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: rgba(0, 19, 33, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1000;
  border-bottom: 1px solid rgba(79, 124, 130, 0.25);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.t-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
}

.t-header__logo {
  font-family: 'Poppins', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #C4A565;
}

.t-header__logo span {
  color: #93B1B5;
  font-weight: 400;
}

.t-header__right {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
}

.t-header__user {
  color: #B8E3E9;
}

.t-header__badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: rgba(36, 172, 195, 0.2);
  color: #24ACC3;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.t-header__link {
  color: #93B1B5;
  font-size: 0.85rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.t-header__link:hover { color: #fff; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn--primary {
  background: linear-gradient(135deg, #4F7C82, #24ACC3);
  color: #001321;
}
.btn--primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #24ACC3, #4F7C82);
  color: #001321;
}

.btn--secondary {
  background-color: transparent;
  color: #24ACC3;
  border: 1px solid rgba(36, 172, 195, 0.4);
}
.btn--secondary:hover:not(:disabled) {
  border-color: #24ACC3;
  color: #ffffff;
}

.btn--large {
  padding: 1rem 2rem;
  font-size: 1rem;
}

.btn--full {
  width: 100%;
}

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

/* --- Cards --- */
.card {
  border: 0.8px solid rgba(79, 124, 130, 0.25);
  border-radius: 16px;
  padding: 1.5rem;
  background: rgba(11, 46, 51, 0.5);
  transition: border-color 0.2s ease;
}
.card:hover {
  border-color: rgba(79, 124, 130, 0.5);
}

/* ═══════════════════════════════════════════
   AUTH PAGES (Login, Callback, Profile)
   ═══════════════════════════════════════════ */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  max-width: 440px;
  width: 100%;
  border: 0.8px solid rgba(79, 124, 130, 0.25);
  border-radius: 16px;
  padding: 2.5rem;
  background: rgba(11, 46, 51, 0.6);
}

.auth-card--wide {
  max-width: 520px;
}

.auth-card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: #B8E3E9;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #B8E3E9;
  margin-bottom: 0.4rem;
}

.form-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(79, 124, 130, 0.4);
  border-radius: 8px;
  background: rgba(0, 19, 33, 0.6);
  color: #ffffff;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: #24ACC3;
  box-shadow: 0 0 0 3px rgba(36, 172, 195, 0.12);
}

.form-input::placeholder {
  color: rgba(184, 227, 233, 0.35);
}

.form-hint {
  display: block;
  font-size: 0.8rem;
  color: rgba(147, 177, 181, 0.6);
  margin-top: 0.3rem;
}

.form-readonly {
  padding: 0.65rem 0.85rem;
  background: rgba(0, 19, 33, 0.4);
  border: 1px solid rgba(79, 124, 130, 0.2);
  border-radius: 8px;
  color: rgba(147, 177, 181, 0.6);
  font-size: 0.95rem;
}

/* --- Link button --- */
.link-btn {
  display: inline;
  background: none;
  border: none;
  color: #24ACC3;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  margin-bottom: 1rem;
}
.link-btn:hover { color: #fff; }

/* --- Track selector --- */
.track-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.track-option {
  padding: 1rem;
  border: 1px solid rgba(79, 124, 130, 0.3);
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
  color: #B8E3E9;
}

.track-option strong {
  display: block;
  font-size: 0.95rem;
  color: #ffffff;
  margin-bottom: 0.3rem;
}

.track-option span {
  display: block;
  font-size: 0.8rem;
  color: rgba(147, 177, 181, 0.6);
  line-height: 1.4;
}

.track-option.selected {
  border-color: #24ACC3;
  background: rgba(36, 172, 195, 0.12);
}

.track-option:hover:not(.selected) {
  border-color: rgba(36, 172, 195, 0.4);
}

/* --- Success / Error states --- */
.auth-success h2 { margin-bottom: 0.75rem; }
.auth-success p { line-height: 1.6; margin-bottom: 0.75rem; }

.error-msg {
  background: rgba(220, 38, 38, 0.1);
  color: #f87171;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.auth-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(79, 124, 130, 0.15);
}

.auth-footer p {
  font-size: 0.8rem;
  color: rgba(147, 177, 181, 0.4);
  line-height: 1.5;
  text-align: center;
}

/* ═══════════════════════════════════════════
   DASHBOARD (Module List)
   ═══════════════════════════════════════════ */

.dashboard {
  min-height: 100vh;
  padding-top: 70px;
}

.dashboard__main {
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1.25rem;
}

.dashboard__main h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.org-label {
  color: #93B1B5;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* --- Module cards --- */
.module-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.module-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem;
  border: 0.8px solid rgba(79, 124, 130, 0.25);
  border-radius: 16px;
  background: rgba(11, 46, 51, 0.4);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.module-card.available,
.module-card.complete {
  cursor: pointer;
}

.module-card.available:hover,
.module-card.next:hover {
  border-color: #24ACC3;
  box-shadow: 0 2px 16px rgba(36, 172, 195, 0.08);
}

.module-card.complete {
  border-color: rgba(36, 172, 195, 0.3);
}

.module-card.locked {
  opacity: 0.4;
}

.module-card.next {
  border-color: rgba(36, 172, 195, 0.5);
}

.module-num {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(79, 124, 130, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #93B1B5;
  flex-shrink: 0;
}

.module-card.complete .module-num {
  background: rgba(36, 172, 195, 0.25);
  color: #24ACC3;
}

.module-card.next .module-num {
  background: linear-gradient(135deg, #4F7C82, #24ACC3);
  color: #001321;
}

.module-info {
  flex: 1;
}

.module-info h3 {
  color: #ffffff;
  margin-bottom: 0.2rem;
}

.module-info p {
  font-size: 0.85rem;
  color: rgba(147, 177, 181, 0.6);
  margin-bottom: 0.4rem;
  line-height: 1.4;
}

.module-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
}

.module-duration {
  color: rgba(147, 177, 181, 0.4);
}

.module-status { font-weight: 600; }
.module-status.complete { color: #24ACC3; }
.module-status.available { color: #24ACC3; }
.module-status.locked { color: rgba(147, 177, 181, 0.3); }

.module-arrow {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.module-arrow .check { color: #24ACC3; }
.module-arrow .arrow { color: #24ACC3; }
.module-arrow .lock { color: rgba(147, 177, 181, 0.2); }

/* ═══════════════════════════════════════════
   MODULE SHELL (Content + Quiz)
   ═══════════════════════════════════════════ */

.module-page {
  min-height: 100vh;
  padding-top: 70px;
}

.module-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
  border-bottom: 1px solid rgba(79, 124, 130, 0.15);
}

.back-btn {
  background: none;
  border: none;
  color: #93B1B5;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
}
.back-btn:hover { color: #fff; background: rgba(79, 124, 130, 0.15); }

.module-title .label { margin-bottom: 0; }
.module-title h1 { font-size: 1.15rem; margin-bottom: 0; }

/* --- Progress bar --- */
.progress-bar {
  height: 3px;
  background: rgba(79, 124, 130, 0.2);
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4F7C82, #24ACC3);
  transition: width 0.3s ease;
}

.progress-label {
  position: absolute;
  right: 1.25rem;
  top: 8px;
  font-size: 0.75rem;
  color: rgba(147, 177, 181, 0.4);
}

/* --- Section tabs --- */
.section-nav {
  display: flex;
  gap: 0;
  padding: 0 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
  border-bottom: 1px solid rgba(79, 124, 130, 0.15);
  overflow-x: auto;
}

.section-tab {
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.85rem;
  color: rgba(147, 177, 181, 0.4);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.section-tab.active {
  color: #24ACC3;
  border-bottom-color: #24ACC3;
  font-weight: 600;
}

.section-tab.visited { color: #B8E3E9; }
.section-tab:disabled { cursor: not-allowed; opacity: 0.3; }

/* --- Content area --- */
.module-content {
  max-width: 680px;
  margin: 2rem auto;
  padding: 0 1.25rem;
}

.content-placeholder {
  border: 1px dashed rgba(79, 124, 130, 0.3);
  border-radius: 12px;
  padding: 2rem;
  color: rgba(147, 177, 181, 0.5);
  line-height: 1.6;
}

.sandbox-placeholder {
  text-align: center;
  padding: 3rem 2rem;
  border: 1px dashed rgba(36, 172, 195, 0.3);
  border-radius: 16px;
  background: rgba(36, 172, 195, 0.05);
}

.sandbox-placeholder h2 { color: #24ACC3; }

/* --- Rich content sections --- */
.section-content ul {
  margin: 0.75rem 0 0.75rem 1.25rem;
  list-style: none;
}

.section-content li {
  padding: 0.4rem 0;
  color: #B8E3E9;
  line-height: 1.6;
  position: relative;
  padding-left: 1rem;
}

.section-content li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #24ACC3;
}

.section-content p {
  margin-bottom: 0.75rem;
  color: #B8E3E9;
}

.section-content strong {
  color: #ffffff;
}

/* --- Flip cards (tap to reveal) --- */
.flip-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  align-items: start;
}

.flip-card {
  cursor: pointer;
  border-radius: 16px;
  background: rgba(11, 46, 51, 0.6);
  border: 0.8px solid rgba(79, 124, 130, 0.3);
  padding: 1.5rem;
  transition: border-color 0.3s ease;
}

.flip-card:hover {
  border-color: rgba(36, 172, 195, 0.4);
}

.flip-card.flipped {
  background: rgba(11, 46, 51, 0.85);
  border-color: rgba(36, 172, 195, 0.3);
}

.flip-card__front h3 {
  font-size: 1rem;
  color: #ffffff;
  margin-bottom: 0.75rem;
}

.flip-card__front p {
  font-size: 0.85rem;
  color: #93B1B5;
  line-height: 1.5;
}

.flip-hint {
  display: block;
  font-size: 0.75rem;
  color: rgba(36, 172, 195, 0.5);
  margin-top: 0.75rem;
}

.flip-card.flipped .flip-card__front {
  display: none;
}

.flip-card__back {
  display: none;
}

.flip-card.flipped .flip-card__back {
  display: block;
}

.flip-card__back h3 {
  font-size: 0.85rem;
  color: #24ACC3;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.flip-card__back ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.flip-card__back li {
  padding: 0.4rem 0;
  padding-left: 1rem;
  position: relative;
  font-size: 0.85rem;
  color: #B8E3E9;
  line-height: 1.5;
  border-bottom: 1px solid rgba(79, 124, 130, 0.12);
}

.flip-card__back li:last-child {
  border-bottom: none;
}

.flip-card__back li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.75rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #24ACC3;
}

.flip-back-hint {
  display: block;
  font-size: 0.75rem;
  color: rgba(36, 172, 195, 0.4);
  margin-top: 0.75rem;
}

@media (max-width: 640px) {
  .flip-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Module footer (prev/next) --- */
.module-footer {
  display: flex;
  justify-content: space-between;
  max-width: 680px;
  margin: 2rem auto;
  padding: 0 1.25rem 2rem;
}

/* ═══════════════════════════════════════════
   QUIZ
   ═══════════════════════════════════════════ */

.quiz-header h2 { margin-bottom: 0.5rem; }
.quiz-header p { color: #B8E3E9; font-size: 0.9rem; margin-bottom: 0.5rem; }

.quiz-progress {
  font-size: 0.8rem;
  color: rgba(147, 177, 181, 0.4);
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.quiz-q-text {
  font-size: 1.05rem;
  font-weight: 500;
  color: #ffffff;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(79, 124, 130, 0.3);
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  text-align: left;
  transition: border-color 0.2s;
  line-height: 1.4;
  color: #B8E3E9;
}

.quiz-option:hover {
  border-color: rgba(36, 172, 195, 0.4);
}

.quiz-option.selected {
  border-color: #24ACC3;
  background: rgba(36, 172, 195, 0.1);
}

.quiz-option .opt-label {
  font-weight: 700;
  color: rgba(147, 177, 181, 0.5);
  flex-shrink: 0;
}

.quiz-option.selected .opt-label {
  color: #24ACC3;
}

/* --- Quiz navigation --- */
.quiz-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
}

.quiz-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.quiz-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(79, 124, 130, 0.3);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(147, 177, 181, 0.4);
  cursor: pointer;
  font-family: inherit;
}

.quiz-dot.current {
  border-color: #24ACC3;
  color: #24ACC3;
}

.quiz-dot.answered {
  background: rgba(36, 172, 195, 0.2);
  border-color: rgba(36, 172, 195, 0.4);
  color: #24ACC3;
}

/* --- Quiz results --- */
.result-card {
  border-radius: 16px;
  padding: 2rem;
}

.result-card.passed {
  background: rgba(36, 172, 195, 0.1);
  border: 1px solid rgba(36, 172, 195, 0.3);
}

.result-card.failed {
  background: rgba(180, 130, 20, 0.08);
  border: 1px solid rgba(180, 130, 20, 0.3);
}

.result-card.passed h2 { color: #24ACC3; }
.result-card.failed h2 { color: #d4a843; }

.score-display {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.score-number {
  font-family: 'Poppins', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
}

.result-card.passed .score-number { color: #24ACC3; }
.result-card.failed .score-number { color: #d4a843; }

.score-detail {
  font-size: 0.9rem;
  color: rgba(147, 177, 181, 0.5);
}

.review-list {
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.review-item {
  padding: 1rem;
  border-radius: 10px;
  border-left: 4px solid;
}

.review-item.correct {
  background: rgba(36, 172, 195, 0.08);
  border-color: #24ACC3;
}

.review-item.incorrect {
  background: rgba(220, 38, 38, 0.06);
  border-color: #f87171;
}

.review-q { font-weight: 600; font-size: 0.9rem; color: #fff; margin-bottom: 0.4rem; }
.review-answer { font-size: 0.85rem; color: #B8E3E9; margin-bottom: 0.4rem; }
.review-correct { color: #24ACC3; }
.review-explanation { font-size: 0.8rem; color: rgba(147, 177, 181, 0.5); font-style: italic; }

/* ═══════════════════════════════════════════
   LOADING / SPINNER
   ═══════════════════════════════════════════ */

.loading {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: #B8E3E9;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(79, 124, 130, 0.2);
  border-top-color: #24ACC3;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 640px) {
  .auth-card { padding: 1.5rem; }
  .track-selector { grid-template-columns: 1fr; }
  .t-header__inner { padding: 0.6rem 1rem; }
  .module-card { padding: 1rem; gap: 0.75rem; }
  .module-header { padding: 0.75rem 1rem; }
  .section-nav { padding: 0 1rem; }
}
