/* Homepage — the purchase-access page (/, /es/, ...).
   Mobile-first single column, no horizontal scroll. Design tokens follow the
   page spec: royal blue #3D6FE8 for hero + primary buttons, near-black #1A1A1A
   headings, dark gray #333 body text, light gray #F2F2F2 section bg, black
   footer. */

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

/* Load-bearing (same as admin.css): the modal backdrop and error <p>s toggle the
   `hidden` attribute, and several display rules below would otherwise override
   it. */
[hidden] { display: none !important; }

:root {
  --brand-blue: #3D6FE8;
  --brand-purple: #6B5CE7;
  --near-black: #1A1A1A;
  --dark-gray: #333333;
  --medium-gray: #777777;
  --light-gray: #F2F2F2;
  --border: #e0e0e0;
  --white: #FFFFFF;
  --black: #000000;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #F5F5F5;
  color: var(--dark-gray);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.home {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER (logo + language switch) ── */
.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
}

.brand-logo {
  height: 26px;
  width: auto;
  display: block;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--medium-gray);
}

.lang-select {
  font-family: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--near-black);
  cursor: pointer;
}

/* ── SECTION 1 — HERO ── */
.hero {
  background: var(--brand-blue);
  color: var(--white);
  text-align: center;
  padding: 28px 24px;
}

.hero-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

/* ── SECTIONS 2 & 3 ── */
.access,
.help {
  padding: 24px;
  text-align: center;
}

.access { background: var(--light-gray); }
.help   { background: var(--white); }

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--near-black);
  margin-bottom: 8px;
}

.section-body {
  font-size: 15px;
  color: var(--dark-gray);
  max-width: 34em;
  margin: 0 auto 18px;
}

/* ── PRIMARY PILL BUTTON (shared) ── */
.btn-primary {
  display: inline-block;
  width: 70%;
  max-width: 300px;
  padding: 12px 20px;
  background: var(--brand-blue);
  color: var(--white);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover { background: #2f5cd0; }
.btn-primary:active { transform: translateY(1px); }

/* ── FOOTER ── */
.home-footer {
  margin-top: auto;
  background: var(--black);
  color: var(--white);
  text-align: center;
  padding: 14px 16px;
  font-size: 12px;
}

.footer-copy { margin-bottom: 6px; }

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-links a {
  color: #cfd6e4;
  text-decoration: none;
}

.footer-links a:hover { color: var(--white); text-decoration: underline; }

/* ══ FIND YOUR PURCHASE MODAL ══ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-card {
  position: relative;
  width: 85%;
  max-width: 400px;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  padding: 24px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--medium-gray);
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover { color: var(--near-black); }

.modal-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-step[hidden] { display: none; }

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--near-black);
  margin: 0;
}

.modal-body {
  font-size: 14px;
  color: var(--dark-gray);
  margin: 0;
  overflow-wrap: anywhere;
}

.modal-input {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--near-black);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
}

.modal-input:focus { border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(61, 111, 232, 0.15); }

.modal-input::placeholder { color: #999; }

.modal-error {
  font-size: 13px;
  color: #d0021b;
  margin: -4px 0 0;
}

.modal-error[hidden] { display: none; }

.btn-modal-primary {
  width: 100%;
  padding: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
  background: var(--brand-blue);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-modal-primary:hover { background: #2f5cd0; }
.btn-modal-primary:disabled { opacity: 0.6; cursor: default; }

.modal-trouble {
  font-size: 12px;
  color: var(--medium-gray);
  text-align: center;
  margin: 0;
}

.btn-modal-ghost {
  display: block;
  width: 100%;
  padding: 11px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--dark-gray);
  background: #ececec;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-modal-ghost:hover { background: #e0e0e0; }

.modal-links {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.btn-link {
  background: none;
  border: none;
  padding: 4px;
  font-family: inherit;
  font-size: 13px;
  color: var(--brand-blue);
  text-decoration: underline;
  cursor: pointer;
}

.btn-link:hover { color: #2f5cd0; }

/* ── ORDERS LIST (modal step 3) ── */
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 4px;
}

.order-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--white);
}

.order-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.order-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--near-black);
}

.order-date {
  font-size: 12px;
  color: var(--medium-gray);
  white-space: nowrap;
}

.order-course {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid #f0f0f0;
}

.order-course-name {
  font-size: 13px;
  color: var(--dark-gray);
}

.order-course-sub {
  font-size: 12px;
  color: var(--medium-gray);
}

.order-course-link {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-blue);
  text-decoration: none;
}

.order-course-link:hover { text-decoration: underline; }

.orders-empty {
  font-size: 14px;
  color: var(--dark-gray);
  text-align: center;
  padding: 8px 0;
}

/* ── RESPONSIVE: cap the page width on larger screens ── */
@media (min-width: 640px) {
  .home-header,
  .hero,
  .access,
  .help,
  .home-footer {
    padding-left: max(16px, calc((100vw - 640px) / 2 + 16px));
    padding-right: max(16px, calc((100vw - 640px) / 2 + 16px));
  }
}
