/* ─── IMA Brand Variables ─────────────────────────────────────────────────── */
:root {
  --primary:       #8C1515;
  --primary-dark:  #6B1010;
  --primary-hover: #A01A1A;
  --primary-light: #f9eaea;
  --black:         #111111;
  --text:          #2d2d2d;
  --text-muted:    #666666;
  --bg:            #f5f5f5;
  --white:         #ffffff;
  --border:        #ddd;
  --success:       #1e6b2e;
  --success-bg:    #eaf5ec;
  --shadow-sm:     0 1px 4px rgba(0,0,0,.08);
  --shadow-md:     0 4px 16px rgba(0,0,0,.12);
  --radius:        8px;
  --radius-lg:     14px;
}

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

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Header ──────────────────────────────────────────────────────────────── */
.header-link {
  display: flex;
  align-items: center;
  gap: 18px;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius);
  transition: opacity .2s;
}

.header-link:hover { opacity: .8; text-decoration: none; }

.site-header {
  background: var(--white);
  border-bottom: 3px solid var(--primary);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  box-shadow: var(--shadow-sm);
}

.site-header .logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.site-header .brand-text h1 {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--black);
  letter-spacing: .5px;
  line-height: 1.2;
}

.site-header .brand-text p {
  font-size: .85rem;
  color: var(--primary);
  font-style: italic;
  margin-top: 2px;
}

/* ─── Page Banner ─────────────────────────────────────────────────────────── */
.page-banner {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: var(--white);
  text-align: center;
  padding: 36px 24px;
}

.page-banner h2 {
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.page-banner p {
  font-size: 1rem;
  opacity: .88;
  max-width: 540px;
  margin: 0 auto;
}

/* ─── Main Layout ─────────────────────────────────────────────────────────── */
.main-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ─── Step Indicator ──────────────────────────────────────────────────────── */
.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 36px;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  max-width: 160px;
  position: relative;
}

.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px;
  left: calc(50% + 18px);
  right: calc(-50% + 18px);
  height: 2px;
  background: var(--border);
}

.step.done:not(:last-child)::after,
.step.active:not(:last-child)::after {
  background: var(--primary);
}

.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  font-weight: 700;
  font-family: sans-serif;
  position: relative;
  z-index: 1;
  transition: background .2s, color .2s;
}

.step.active .step-num,
.step.done .step-num {
  background: var(--primary);
  color: var(--white);
}

.step-label {
  font-size: .75rem;
  color: var(--text-muted);
  font-family: sans-serif;
  text-align: center;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.step.active .step-label,
.step.done .step-label {
  color: var(--primary);
}

/* ─── Section Headings ────────────────────────────────────────────────────── */
.section-heading {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
}

/* ─── Course Cards ────────────────────────────────────────────────────────── */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.course-card {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .1s;
  position: relative;
  user-select: none;
}

.course-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.course-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(140,21,21,.18);
}

.course-card .popular-badge {
  position: absolute;
  top: -1px;
  left: -1px;
  background: linear-gradient(135deg, #d4a017, #f0c040);
  color: #5a3a00;
  font-size: .7rem;
  font-family: sans-serif;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-lg) 0 var(--radius) 0;
  text-transform: uppercase;
  letter-spacing: .5px;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.course-card .selected-badge {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--primary);
  color: var(--white);
  font-size: .7rem;
  font-family: sans-serif;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.course-card.selected .selected-badge { display: block; }

.course-card .course-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 8px;
}

.course-card .course-desc {
  font-size: .875rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
  font-family: sans-serif;
}

.course-card .price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.course-card .price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.klarna-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .76rem;
  font-family: sans-serif;
  color: var(--text-muted);
  background: #f0f0f0;
  border-radius: 99px;
  padding: 3px 9px;
}

.klarna-tag strong { color: var(--text); }

/* ─── Resource Links ──────────────────────────────────────────────────────── */
.resource-links {
  margin-bottom: 20px;
}

.resource-label {
  font-size: .75rem;
  font-family: sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.resource-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-resource {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  font-size: .875rem;
  font-weight: 600;
  font-family: sans-serif;
  color: var(--primary);
  background: var(--white);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background .2s, color .2s;
  cursor: pointer;
}

.btn-resource:hover {
  background: var(--primary-light);
  text-decoration: none;
  color: var(--primary-dark);
}

/* ─── Form ────────────────────────────────────────────────────────────────── */
.form-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group:last-child { margin-bottom: 0; }

label {
  font-size: .825rem;
  font-weight: 700;
  color: var(--text);
  font-family: sans-serif;
  text-transform: uppercase;
  letter-spacing: .4px;
}

label .required { color: var(--primary); margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="tel"] {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  font-family: sans-serif;
  color: var(--text);
  background: var(--white);
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(140,21,21,.12);
}

input.error { border-color: #c0392b; }

.field-error {
  font-size: .78rem;
  color: #c0392b;
  font-family: sans-serif;
  display: none;
}

.field-error.visible { display: block; }

/* ─── Course Note ─────────────────────────────────────────────────────────── */
.course-note {
  background: #eef4fb;
  border-left: 4px solid #3a85c7;
  color: #1a4a7a;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: sans-serif;
  font-size: .875rem;
  line-height: 1.5;
  margin-top: 16px;
}

.course-note a { color: #1a4a7a; font-weight: 700; text-decoration: underline; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  font-size: 1rem;
  font-weight: 700;
  font-family: sans-serif;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .2s, transform .1s, opacity .2s;
  letter-spacing: .3px;
}

.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: var(--white);
  width: 100%;
}

.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--primary-light);
}

/* ─── Payment Section ─────────────────────────────────────────────────────── */
.order-summary {
  background: var(--primary-light);
  border: 1.5px solid rgba(140,21,21,.2);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  font-family: sans-serif;
}

.order-summary .label { font-size: .8rem; color: var(--text-muted); margin-bottom: 4px; }
.order-summary .course-title { font-size: 1.1rem; font-weight: 700; color: var(--black); }
.order-summary .course-price { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.order-summary .klarna-info {
  margin-top: 8px;
  font-size: .82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

#stripe-payment-element {
  margin-bottom: 20px;
}

.payment-note {
  font-size: .8rem;
  color: var(--text-muted);
  font-family: sans-serif;
  text-align: center;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#payment-message {
  color: #c0392b;
  font-size: .875rem;
  font-family: sans-serif;
  text-align: center;
  margin-bottom: 12px;
  display: none;
}

#payment-message.visible { display: block; }

/* ─── Back Link ───────────────────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .875rem;
  color: var(--text-muted);
  font-family: sans-serif;
  margin-bottom: 20px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.back-link:hover { color: var(--primary); }

/* ─── Alert / Notice ──────────────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-family: sans-serif;
  font-size: .9rem;
  margin-bottom: 20px;
}

.alert-info {
  background: #eef4fb;
  border-left: 4px solid #3a85c7;
  color: #1a4a7a;
}

/* ─── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--black);
  color: rgba(255,255,255,.6);
  text-align: center;
  padding: 22px 20px;
  font-size: .82rem;
  font-family: sans-serif;
}

.site-footer a { color: rgba(255,255,255,.75); }
.site-footer a:hover { color: var(--white); }

/* ─── Hidden / Show ───────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Loading Spinner ─────────────────────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}

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

/* ─── Success Page ────────────────────────────────────────────────────────── */
.success-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  text-align: center;
  box-shadow: var(--shadow-md);
  max-width: 560px;
  margin: 40px auto;
}

.success-icon {
  width: 72px;
  height: 72px;
  background: var(--success-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 2rem;
}

.success-card h2 {
  font-size: 1.6rem;
  color: var(--success);
  margin-bottom: 12px;
}

.success-card p {
  color: var(--text-muted);
  font-family: sans-serif;
  font-size: .95rem;
  margin-bottom: 8px;
}

.confirmation-detail {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 20px 0;
  text-align: left;
  font-family: sans-serif;
  font-size: .875rem;
}

.confirmation-detail .row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}

.confirmation-detail .row:last-child { border-bottom: none; }
.confirmation-detail .row span:first-child { color: var(--text-muted); }
.confirmation-detail .row span:last-child { font-weight: 600; color: var(--text); }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .site-header { flex-direction: column; gap: 10px; text-align: center; }
  .site-header .logo { width: 64px; height: 64px; }
  .site-header .brand-text h1 { font-size: 1.25rem; }
  .form-row { grid-template-columns: 1fr; }
  .page-banner h2 { font-size: 1.4rem; }
  .form-section { padding: 20px; }
  .success-card { padding: 32px 20px; }
  .course-grid { grid-template-columns: 1fr; }
}
