/* ======================================
   Malta Education Advisor — EXPO 2026
   Born Digital | Gamified AI Advisor
   ====================================== */

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

:root {
  --bg-deep: #0a0e1a;
  --bg-surface: #111827;
  --bg-card: #1e293b;
  --bg-card-hover: #263349;
  --border: #334155;
  --border-active: #eab308;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #eab308;
  --accent-light: #fde047;
  --accent-dark: #ca8a04;
  --success: #10b981;
  --danger: #ef4444;
  --malta-red: #CF142B;
  --malta-white: #ffffff;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.4);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ── Particle Canvas ── */
#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── Screens ── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  z-index: 1;
  padding: 2rem;
  overflow-y: auto;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  z-index: 2;
}

/* ── Welcome Screen ── */
.welcome-content {
  text-align: center;
  max-width: 600px;
  animation: fadeUp 0.8s ease;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.malta-crest {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
}

.welcome-tag {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 1rem;
}

.welcome-title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent-light), var(--accent), var(--accent-dark));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.welcome-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

/* ── Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 2rem;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  letter-spacing: 0.01em;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(234, 179, 8, 0.3);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

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

.btn-glow {
  box-shadow: 0 0 20px rgba(234, 179, 8, 0.2), 0 4px 15px rgba(234, 179, 8, 0.15);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-secondary:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* ── Wizard Screen ── */
.wizard-container {
  width: 100%;
  max-width: 800px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
}

.wizard-top-bar {
  flex-shrink: 0;
  padding-bottom: 1.5rem;
}

.progress-section {
  width: 100%;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.progress-label span:first-child {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.xp-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(234, 179, 8, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  border: 1px solid rgba(234, 179, 8, 0.2);
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent), var(--accent-light));
  border-radius: 10px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.wizard-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
  -ms-overflow-style: none;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-card) transparent;
}

.wizard-body::-webkit-scrollbar {
  width: 4px;
}

.wizard-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.wizard-nav {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(51, 65, 85, 0.5);
}

/* ── Question Area ── */
.question-title {
  font-size: clamp(1.4rem, 3.5vw, 1.8rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.question-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.question-hint {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 1rem;
}

.question-subtitle + .question-hint {
  margin-top: 0;
}

.question-title + .options-grid,
.question-subtitle + .options-grid,
.question-hint + .options-grid {
  margin-top: 1.5rem;
}

/* ── Option Cards ── */
.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.option-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  text-align: left;
  color: var(--text-primary);
  width: 100%;
}

.option-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

.option-card.selected {
  border-color: var(--accent);
  background: rgba(234, 179, 8, 0.08);
  box-shadow: 0 0 0 1px var(--accent), 0 4px 20px rgba(234, 179, 8, 0.1);
}

.option-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(234, 179, 8, 0.08);
  border-radius: 12px;
  color: var(--accent);
}

.option-card.selected .option-icon {
  background: rgba(234, 179, 8, 0.15);
}

.option-text {
  flex: 1;
  min-width: 0;
}

.option-label {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.15rem;
}

.option-desc {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.option-check {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
  border-radius: 50%;
  color: transparent;
  transition: all var(--transition);
}

.option-card.selected .option-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

/* Compact grid for many options */
@media (min-width: 600px) {
  .options-grid-compact {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Analyzing Screen ── */
.analyzing-content {
  text-align: center;
  max-width: 480px;
  animation: fadeUp 0.6s ease;
}

.ai-orb {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 2rem;
}

.orb-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 40px rgba(234, 179, 8, 0.5), 0 0 80px rgba(234, 179, 8, 0.2);
  animation: orbPulse 2s ease-in-out infinite;
}

.orb-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 2px solid rgba(234, 179, 8, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.orb-ring-1 {
  width: 70px;
  height: 70px;
  animation: orbSpin 3s linear infinite;
  border-top-color: var(--accent);
}

.orb-ring-2 {
  width: 95px;
  height: 95px;
  animation: orbSpin 5s linear infinite reverse;
  border-right-color: var(--accent);
}

.orb-ring-3 {
  width: 120px;
  height: 120px;
  animation: orbSpin 7s linear infinite;
  border-bottom-color: var(--accent);
}

.analyzing-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.analyzing-status {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  min-height: 1.5em;
}

.analyzing-steps {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  text-align: left;
}

.a-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.a-step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.4s ease;
}

.a-step-icon.pending {
  background: var(--bg-card);
  color: var(--text-muted);
}

.a-step-icon.active {
  background: rgba(234, 179, 8, 0.15);
  color: var(--accent);
  animation: stepPulse 1s ease-in-out infinite;
}

.a-step-icon.done {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

/* ── Results Screen ── */
.results-container {
  width: 100%;
  max-width: 800px;
  padding: 2rem 0;
  text-align: center;
}

.results-header {
  margin-bottom: 2rem;
}

.results-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: rgba(234, 179, 8, 0.1);
  border: 2px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  margin-bottom: 1rem;
  animation: bounceIn 0.6s ease;
}

.results-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.results-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto;
}

.results-xp-final {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

#final-xp {
  font-weight: 700;
  color: var(--accent);
  font-size: 1rem;
}

.badge-pill {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #000;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.results-summary {
  text-align: left;
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}

/* ── Recommendation Cards ── */
.recommendations-list {
  text-align: left;
}

.rec-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  animation: slideInRight 0.5s ease backwards;
  transition: border-color var(--transition), background var(--transition);
}

.rec-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.rec-rank {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(234, 179, 8, 0.1);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.8rem;
  border-radius: 8px;
}

.rec-icon {
  flex-shrink: 0;
  color: var(--text-muted);
  display: none;
}

.rec-body {
  flex: 1;
  min-width: 0;
}

.rec-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  line-height: 1.3;
}

.rec-type {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(234, 179, 8, 0.08);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

.rec-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.rec-match {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.match-ring {
  position: relative;
  width: 50px;
  height: 50px;
}

.match-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.match-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent);
}

.match-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ── Tips ── */
.tips-section {
  margin-top: 2rem;
}

.tips-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-align: left;
}

.tips-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 600px) {
  .tips-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.tip-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: left;
}

.tip-icon {
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.tip-card h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.tip-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Lead Capture ── */
.lead-capture-card {
  background: var(--bg-surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 2rem;
  margin-top: 2rem;
  text-align: left;
}

.lead-capture-card h3 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
}

.lead-capture-card > p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.lead-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

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

@media (max-width: 500px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-group input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.1);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.4;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  accent-color: var(--accent);
}

/* ── Thank You Screen ── */
.thankyou-content {
  text-align: center;
  max-width: 500px;
  animation: fadeUp 0.6s ease;
}

.thankyou-check {
  margin-bottom: 1.5rem;
  animation: bounceIn 0.8s ease;
}

.thankyou-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.thankyou-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.thankyou-summary {
  text-align: left;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  border: 1px solid var(--border);
}

.summary-row {
  padding: 0.4rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-row strong {
  color: var(--text-primary);
  font-weight: 600;
  margin-right: 0.4rem;
}

/* ── XP Popup ── */
.xp-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(234, 179, 8, 0.5);
  pointer-events: none;
  z-index: 100;
  opacity: 0;
  transition: none;
}

.xp-popup.hidden {
  display: none;
}

.xp-popup.show {
  display: block;
  animation: xpFloat 1.2s ease forwards;
}

/* ── Footer ── */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 0.75rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: linear-gradient(transparent, var(--bg-deep));
  pointer-events: none;
}

.footer-dot {
  width: 3px;
  height: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  display: inline-block;
}

/* ── Animations ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes orbPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.15); }
}

@keyframes orbSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes stepPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes xpFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  30% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, calc(-50% - 30px)) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 60px)) scale(0.8);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .screen {
    padding: 1rem;
  }

  .wizard-container {
    padding: 0.5rem 0;
  }

  .option-card {
    padding: 0.9rem 1rem;
    gap: 0.75rem;
  }

  .option-icon {
    width: 40px;
    height: 40px;
  }

  .option-icon svg {
    width: 24px;
    height: 24px;
  }

  .lead-capture-card {
    padding: 1.25rem;
  }

  .rec-card {
    flex-wrap: wrap;
  }

  .rec-match {
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
  }

  .match-ring {
    width: 36px;
    height: 36px;
  }
}

/* ── Kiosk optimizations (large touch targets) ── */
@media (min-width: 1024px) {
  html {
    font-size: 18px;
  }

  .option-card {
    padding: 1.4rem 1.5rem;
    min-height: 80px;
  }

  .btn-primary {
    padding: 1.15rem 2.5rem;
    font-size: 1.1rem;
  }

  .options-grid:not(.options-grid-compact) {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Scrollbar for results ── */
#screen-results {
  overflow-y: auto;
}

#screen-results::-webkit-scrollbar {
  width: 6px;
}

#screen-results::-webkit-scrollbar-track {
  background: transparent;
}

#screen-results::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}
