/* Catalyst Drainage Training Portal — branded styles */
:root {
  --navy: #1d0a42;
  --navy-dark: #110527;
  --navy-light: #2a1560;
  --pink: #ee3087;
  --pink-dark: #c91d72;
  --pink-glow: rgba(238, 48, 135, 0.35);
  --bg: #f5f3f8;
  --surface: #ffffff;
  --surface-2: #faf8fc;
  --text: #1a1a2e;
  --text-muted: #595972;
  --text-light: #8888a0;
  --border: #e3deef;
  --success: #2e9d5f;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow-sm: 0 1px 3px rgba(29, 10, 66, 0.08);
  --shadow: 0 4px 12px rgba(29, 10, 66, 0.10);
  --shadow-lg: 0 12px 32px rgba(29, 10, 66, 0.16);
  --radius: 12px;
  --radius-sm: 6px;
  --radius-lg: 20px;
  --transition: 0.2s ease-out;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

/* ================ NAVIGATION ================ */
.nav {
  background: var(--navy);
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.nav-brand { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 1.1rem; text-decoration: none; color: white; }
.nav-brand-mark { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--pink); display: flex; align-items: center; justify-content: center; font-weight: 800; box-shadow: 0 0 16px var(--pink-glow); }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { color: rgba(255,255,255,0.85); text-decoration: none; font-size: 0.95rem; transition: var(--transition); }
.nav-links a:hover { color: var(--pink); }
.nav-progress { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: rgba(255,255,255,0.7); }
.nav-progress-bar { width: 80px; height: 6px; background: rgba(255,255,255,0.15); border-radius: 3px; overflow: hidden; }
.nav-progress-fill { height: 100%; background: var(--pink); transition: width 0.4s ease; }

/* ================ HERO ================ */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 70%, var(--pink-dark) 130%);
  color: white;
  padding: 4rem 2rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(238,48,135,0.18), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(238,48,135,0.12), transparent 40%);
  pointer-events: none;
}
.hero-inner { max-width: 1100px; margin: 0 auto; position: relative; z-index: 1; }
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; line-height: 1.15; margin-bottom: 1rem; }
.hero h1 .accent { color: var(--pink); }
.hero p.lead { font-size: 1.15rem; max-width: 720px; opacity: 0.92; margin-bottom: 2rem; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 2rem; margin-top: 2.5rem; }
.hero-stat { }
.hero-stat-value { font-size: 2rem; font-weight: 800; color: var(--pink); }
.hero-stat-label { font-size: 0.85rem; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.05em; }

/* ================ MAIN ================ */
main { max-width: 1100px; margin: 0 auto; padding: 3rem 2rem; }
section { margin-bottom: 3rem; }
h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: 1.25rem; color: var(--navy); border-left: 4px solid var(--pink); padding-left: 1rem; }
h3 { font-size: 1.25rem; font-weight: 700; margin: 1.5rem 0 0.75rem; color: var(--navy); }
h4 { font-size: 1.05rem; font-weight: 700; margin: 1rem 0 0.5rem; color: var(--navy-light); }
p { margin-bottom: 1rem; }
ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { margin-bottom: 0.4rem; }
strong { color: var(--navy); }

a { color: var(--pink-dark); text-decoration: none; border-bottom: 1px solid transparent; transition: var(--transition); }
a:hover { border-bottom-color: var(--pink-dark); }

/* ================ MODULE CARDS (landing) ================ */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
.module-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.module-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--navy), var(--pink));
}
.module-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.module-card-num { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: white; font-weight: 800; margin-bottom: 1rem; }
.module-card.completed .module-card-num { background: var(--success); }
.module-card.completed .module-card-num::after { content: ' ✓'; }
.module-card-title { font-size: 1.2rem; font-weight: 700; color: var(--navy); margin-bottom: 0.5rem; }
.module-card-desc { color: var(--text-muted); font-size: 0.95rem; flex: 1; margin-bottom: 1rem; }
.module-card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: var(--text-light); margin-bottom: 1rem; }
.module-card-cta { display: inline-block; background: var(--pink); color: white; padding: 0.6rem 1.2rem; border-radius: var(--radius-sm); font-weight: 600; text-align: center; transition: var(--transition); border-bottom: none; }
.module-card-cta:hover { background: var(--pink-dark); border-bottom: none; }
.module-card.completed .module-card-cta { background: var(--success); }
.module-card.locked { opacity: 0.55; }
.module-card.locked .module-card-cta { background: var(--text-light); pointer-events: none; }

/* ================ INTERACTIVE COMPONENTS ================ */

/* Cards — flip on hover */
.flip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.flip-card { perspective: 1000px; height: 180px; cursor: pointer; }
.flip-card-inner { position: relative; width: 100%; height: 100%; transition: transform 0.6s; transform-style: preserve-3d; }
.flip-card.flipped .flip-card-inner { transform: rotateY(180deg); }
.flip-card-front, .flip-card-back {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: var(--radius); padding: 1rem; backface-visibility: hidden;
  text-align: center;
}
.flip-card-front {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: white;
  font-weight: 700;
  font-size: 1.05rem;
}
.flip-card-back {
  background: white;
  border: 2px solid var(--pink);
  transform: rotateY(180deg);
  font-size: 0.9rem;
  color: var(--text);
}
.flip-card-back strong { color: var(--pink-dark); }
.flip-card-hint { position: absolute; bottom: 0.5rem; right: 0.5rem; font-size: 0.7rem; opacity: 0.6; }

/* Info boxes */
.callout { background: var(--surface-2); border-left: 4px solid var(--pink); padding: 1rem 1.25rem; border-radius: var(--radius-sm); margin: 1.5rem 0; }
.callout.warning { border-left-color: var(--warning); background: #fef9f0; }
.callout.danger { border-left-color: var(--danger); background: #fef2f2; }
.callout.success { border-left-color: var(--success); background: #f0fdf4; }
.callout.info { border-left-color: var(--navy); background: var(--surface-2); }
.callout-title { font-weight: 700; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.callout.warning .callout-title { color: var(--warning); }
.callout.danger .callout-title { color: var(--danger); }
.callout.success .callout-title { color: var(--success); }
.callout.info .callout-title { color: var(--navy); }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 1rem 0; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm); }
th { background: var(--navy); color: white; padding: 0.75rem; text-align: left; font-weight: 600; font-size: 0.9rem; }
td { padding: 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: var(--surface-2); }

/* Decision tree */
.decision-tree { background: var(--surface); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); margin: 2rem 0; }
.decision-question { font-size: 1.1rem; font-weight: 700; color: var(--navy); margin-bottom: 1.5rem; padding: 1rem; background: var(--surface-2); border-radius: var(--radius-sm); border-left: 4px solid var(--pink); }
.decision-options { display: flex; flex-wrap: wrap; gap: 1rem; }
.decision-btn {
  padding: 0.85rem 1.5rem;
  border: 2px solid var(--navy);
  background: white;
  color: var(--navy);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
}
.decision-btn:hover { background: var(--navy); color: white; }
.decision-btn.yes { border-color: var(--success); color: var(--success); }
.decision-btn.yes:hover { background: var(--success); color: white; }
.decision-btn.no { border-color: var(--danger); color: var(--danger); }
.decision-btn.no:hover { background: var(--danger); color: white; }
.decision-result { padding: 1.25rem; border-radius: var(--radius-sm); margin-top: 1.5rem; display: none; }
.decision-result.public { background: var(--surface-2); border: 2px solid var(--navy); }
.decision-result.private { background: #fef2f2; border: 2px solid var(--danger); }
.decision-result.show { display: block; animation: slideUp 0.4s ease; }
.decision-back { background: transparent; border: none; color: var(--text-muted); padding: 0.5rem 0; cursor: pointer; font-size: 0.9rem; margin-top: 0.5rem; text-decoration: underline; }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Quiz */
.quiz { background: var(--surface); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); margin: 2rem 0; border: 2px solid var(--pink); }
.quiz-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; }
.quiz-header-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--pink); color: white; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.quiz-header h3 { color: var(--pink-dark); margin: 0; }
.quiz-question { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px dashed var(--border); }
.quiz-question:last-child { border-bottom: none; padding-bottom: 0; }
.quiz-question p { font-weight: 600; margin-bottom: 0.75rem; }
.quiz-question-num { color: var(--pink); font-weight: 700; margin-right: 0.5rem; }
.quiz-options { display: flex; flex-direction: column; gap: 0.5rem; }
.quiz-option {
  padding: 0.85rem 1rem;
  border: 2px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  text-align: left;
}
.quiz-option:hover:not(.disabled) { border-color: var(--pink); background: white; }
.quiz-option.selected { border-color: var(--navy); background: white; }
.quiz-option.correct { border-color: var(--success); background: #f0fdf4; color: var(--success); font-weight: 600; }
.quiz-option.incorrect { border-color: var(--danger); background: #fef2f2; color: var(--danger); }
.quiz-option.disabled { cursor: default; }
.quiz-feedback { display: none; margin-top: 0.75rem; padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.9rem; line-height: 1.55; }
.quiz-feedback.show { display: block; animation: slideUp 0.3s ease; }
.quiz-feedback.correct { background: #f0fdf4; color: #065f46; border-left: 3px solid var(--success); }
.quiz-feedback.incorrect { background: #fef2f2; color: #991b1b; border-left: 3px solid var(--danger); }
.quiz-actions { display: flex; gap: 1rem; align-items: center; margin-top: 1.5rem; }
.btn {
  padding: 0.75rem 1.5rem;
  background: var(--navy);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
}
.btn:hover:not(:disabled) { background: var(--navy-light); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.btn-pink { background: var(--pink); }
.btn.btn-pink:hover:not(:disabled) { background: var(--pink-dark); }
.btn.btn-outline { background: transparent; color: var(--navy); border: 2px solid var(--navy); }
.btn.btn-outline:hover:not(:disabled) { background: var(--navy); color: white; }
.quiz-score { font-weight: 700; color: var(--navy); }

/* Drag and drop matching */
.match-game { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin: 2rem 0; }
.match-col { background: var(--surface); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow-sm); }
.match-col-title { font-weight: 700; color: var(--navy); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--pink); }
.match-item {
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  cursor: grab;
  transition: var(--transition);
  font-size: 0.92rem;
}
.match-item:active { cursor: grabbing; }
.match-item.dragging { opacity: 0.4; }
.match-target {
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  min-height: 52px;
  transition: var(--transition);
  font-size: 0.92rem;
}
.match-target.drag-over { border-color: var(--pink); background: white; }
.match-target.matched-correct { border: 2px solid var(--success); background: #f0fdf4; }
.match-target.matched-incorrect { border: 2px solid var(--danger); background: #fef2f2; }
.match-target-label { font-weight: 700; color: var(--navy); }
.match-target-content { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Hotspots */
.hotspot-image { position: relative; max-width: 800px; margin: 1.5rem auto; }
.hotspot-image svg { width: 100%; height: auto; }
.hotspot {
  position: absolute;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--pink);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 0 0 var(--pink-glow);
  animation: pulse 2s infinite;
  border: 3px solid white;
  transform: translate(-50%, -50%);
  font-size: 0.85rem;
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--pink-glow); } 70% { box-shadow: 0 0 0 16px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.hotspot.viewed { background: var(--success); animation: none; }
.hotspot-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border: 2px solid var(--navy);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  width: 240px;
  box-shadow: var(--shadow-lg);
  z-index: 10;
  font-size: 0.85rem;
  text-align: left;
  color: var(--text);
  font-weight: normal;
}
.hotspot.active .hotspot-tooltip { display: block; animation: slideUp 0.2s ease; }
.hotspot-tooltip strong { color: var(--pink-dark); display: block; margin-bottom: 0.25rem; }

/* Calculator */
.calc-tool { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); border: 2px solid var(--navy); margin: 2rem 0; }
.calc-tool h4 { margin-top: 0; }
.calc-row { display: grid; grid-template-columns: 1fr 100px; gap: 1rem; align-items: center; margin-bottom: 0.75rem; }
.calc-row label { font-weight: 600; }
.calc-row input { padding: 0.5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 1rem; text-align: right; }
.calc-output { background: var(--surface-2); padding: 1rem; border-radius: var(--radius-sm); margin-top: 1rem; border-left: 4px solid var(--pink); }
.calc-output-value { font-size: 1.5rem; font-weight: 800; color: var(--pink-dark); }
.calc-output-note { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Navigation between modules */
.module-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border);
  gap: 1rem;
}
.module-nav-btn {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  flex: 1;
  max-width: 320px;
  transition: var(--transition);
  border-bottom: 2px solid var(--border);
}
.module-nav-btn:hover { border-color: var(--pink); transform: translateY(-2px); border-bottom-color: var(--pink); }
.module-nav-btn .label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.module-nav-btn .title { font-weight: 700; color: var(--navy); margin-top: 0.25rem; }
.module-nav-btn.next { text-align: right; margin-left: auto; }
.module-nav-btn.disabled { opacity: 0.4; pointer-events: none; }

/* Section progress */
.section-progress { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 2rem; }
.section-progress-label { font-size: 0.85rem; color: var(--text-muted); }
.section-progress-bar { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.section-progress-fill { height: 100%; background: linear-gradient(90deg, var(--navy), var(--pink)); transition: width 0.4s ease; }
.section-progress-pct { font-weight: 700; color: var(--navy); }

/* Footer */
footer { background: var(--navy); color: rgba(255,255,255,0.7); padding: 2rem; text-align: center; margin-top: 4rem; font-size: 0.9rem; }
footer .accent { color: var(--pink); font-weight: 700; }

/* Certificate */
.cert {
  max-width: 880px;
  margin: 2rem auto;
  background: white;
  padding: 4rem 3rem;
  border: 12px solid var(--navy);
  border-radius: var(--radius-lg);
  position: relative;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.cert::before { content: ''; position: absolute; inset: 12px; border: 2px solid var(--pink); border-radius: 12px; pointer-events: none; }
.cert-logo { font-size: 1rem; font-weight: 800; color: var(--pink); letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 0.5rem; }
.cert-title { font-size: 2.5rem; font-weight: 800; color: var(--navy); margin-bottom: 0.5rem; }
.cert-subtitle { color: var(--text-muted); margin-bottom: 2rem; }
.cert-name { font-size: 2rem; font-weight: 800; color: var(--pink-dark); margin: 1rem 0; padding-bottom: 0.5rem; border-bottom: 2px solid var(--pink); display: inline-block; min-width: 320px; }
.cert-body { font-size: 1.05rem; color: var(--text); margin: 1.5rem 0; line-height: 1.8; }
.cert-meta { display: flex; justify-content: space-around; margin-top: 3rem; font-size: 0.9rem; }
.cert-meta-block { text-align: left; }
.cert-meta-label { color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.75rem; }
.cert-meta-value { font-weight: 700; color: var(--navy); margin-top: 0.25rem; }
.cert-seal { position: absolute; bottom: 2rem; right: 2rem; width: 90px; height: 90px; border: 3px solid var(--pink); border-radius: 50%; display: flex; align-items: center; justify-content: center; transform: rotate(-12deg); color: var(--pink); font-weight: 800; font-size: 0.7rem; text-align: center; line-height: 1.2; }

/* Utility */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-4 { margin-top: 2rem; }
.mb-4 { margin-bottom: 2rem; }

@media (max-width: 768px) {
  .nav { padding: 1rem; }
  .nav-links { gap: 1rem; }
  .nav-links a { font-size: 0.85rem; }
  .hero { padding: 3rem 1.25rem; }
  main { padding: 2rem 1.25rem; }
  .module-grid { grid-template-columns: 1fr; }
  .match-game { grid-template-columns: 1fr; }
  .cert { padding: 2rem 1.25rem; border-width: 8px; }
  .cert-title { font-size: 1.75rem; }
  .cert-name { font-size: 1.5rem; }
  .module-nav { flex-direction: column; }
  .module-nav-btn { max-width: 100%; width: 100%; }
}
