@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --navy:   #1D275A;
  --cyan:   #009BBE;
  --magenta:#DF1B79;
  --green:  #89BC3F;
  --bg:     #F8FAFC;
  --card:   #ffffff;
  --border: #e2e8f0;
  --text:   #1e293b;
  --muted:  #64748b;
  --radius: 16px;
}

html, body { height: 100%; }
body {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Prevent horizontal scroll on mobile */
  overflow-x: hidden;
}

/* ─── Navbar ───────────────────────────────────────────────────────────── */
.navbar {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.navbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.navbar-logo-img {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.navbar-name { font-weight: 800; font-size: 15px; color: var(--navy); white-space: nowrap; }
.navbar-cycle { font-size: 10px; font-weight: 600; color: var(--cyan); margin-top: -2px; white-space: nowrap; }
.navbar-right { display: flex; align-items: center; gap: 16px; }
.btn-logout {
  font-size: 12px; font-weight: 700; color: var(--muted);
  background: none; border: none; cursor: pointer;
  padding: 8px 4px; min-height: 44px;
}
.btn-logout:hover { color: var(--magenta); }

/* ─── Main ─────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 14px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  width: 100%;
}

/* ─── Views ────────────────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ─── Login ────────────────────────────────────────────────────────────── */
.login-wrap {
  max-width: 440px;
  margin: 24px auto 0;
}
.login-card {
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,.10);
  padding: 32px 24px;
  border-top: 6px solid var(--cyan);
  text-align: center;
}
.login-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.login-icon svg { width: 32px; height: 32px; color: var(--cyan); }
.login-title { font-size: 20px; font-weight: 900; color: var(--navy); margin-bottom: 6px; }
.login-sub { font-size: 13px; color: var(--muted); margin-bottom: 24px; font-weight: 500; line-height: 1.5; }

/* ─── Forms ─────────────────────────────────────────────────────────────── */
.form-group { text-align: left; margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 11px; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 6px; margin-left: 4px;
}
.form-input {
  width: 100%; padding: 14px 16px;
  border: 2px solid var(--border); border-radius: 12px;
  font-family: inherit; font-size: 18px; font-weight: 700;
  color: var(--navy); background: var(--bg);
  text-align: center; text-transform: uppercase; letter-spacing: 2px;
  outline: none; transition: border-color .2s;
  /* Prevent zoom on iOS when font-size < 16px — 18px here so fine */
}
.form-input:focus { border-color: var(--cyan); background: #fff; }
.form-input.error { border-color: var(--magenta); }
.form-input-plain {
  width: 100%; padding: 13px 14px;
  border: 2px solid var(--border); border-radius: 12px;
  font-family: inherit; font-size: 16px; color: var(--text);
  background: var(--bg); outline: none; transition: border-color .2s;
}
.form-input-plain:focus { border-color: var(--cyan); background: #fff; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 6px; margin-left: 4px; line-height: 1.4; }
.form-error { font-size: 13px; color: var(--magenta); margin-top: 6px; font-weight: 600; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn-primary {
  width: 100%; padding: 16px;
  background: var(--cyan); color: #fff;
  border: none; border-radius: 14px;
  font-family: inherit; font-size: 16px; font-weight: 900;
  cursor: pointer; transition: background .2s;
  min-height: 52px;
}
.btn-primary:hover:not(:disabled) { background: #0086a6; }
.btn-primary:disabled { background: #cbd5e1; cursor: not-allowed; }
.btn-secondary {
  padding: 12px 20px;
  background: #fff; color: var(--muted);
  border: 2px solid var(--border); border-radius: 10px;
  font-family: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all .2s;
  min-height: 48px;
}
.btn-secondary:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-success {
  width: 100%; padding: 16px;
  background: var(--green); color: #fff;
  border: none; border-radius: 16px;
  font-family: inherit; font-size: 16px; font-weight: 900;
  cursor: pointer; transition: background .2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px;
}
.btn-success:hover:not(:disabled) { background: #7aaa36; }
.btn-success:disabled { background: #cbd5e1; cursor: not-allowed; }
.btn-outline-cyan {
  padding: 12px 20px; background: #fff; color: var(--cyan);
  border: 2px solid var(--cyan); border-radius: 12px;
  font-family: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all .2s;
  display: flex; align-items: center; gap: 6px;
  min-height: 48px;
}
.btn-outline-cyan:hover { background: var(--cyan); color: #fff; }

/* ─── Student card ─────────────────────────────────────────────────────── */
.student-card {
  background: var(--card);
  border-left: 5px solid var(--cyan);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  flex-wrap: wrap;
}
.student-info { min-width: 0; flex: 1; }
.student-name { font-size: 16px; font-weight: 900; color: var(--navy); }
.student-meta { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.subtotal-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 14px; text-align: right;
  flex-shrink: 0;
}
.subtotal-label { font-size: 10px; font-weight: 700; color: #94a3b8; text-transform: uppercase; }
.subtotal-value { font-size: 20px; font-weight: 900; color: var(--magenta); }

/* ─── Workshop section headers ─────────────────────────────────────────── */
.workshop-section-header {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0 4px;
  flex-wrap: wrap;
}
.section-tag {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  padding: 4px 10px; border-radius: 20px;
}
.tag-included { background: rgba(0,155,190,.12); color: #006f88; }
.tag-extra    { background: rgba(223,27,121,.10); color: #b8135f; }
.section-desc { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ─── Workshop grid ────────────────────────────────────────────────────── */
.workshop-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 80px; /* space for sticky button */
}

.workshop-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 16px; padding: 16px;
  cursor: pointer; transition: all .15s; position: relative;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.workshop-card:active:not(.disabled) { transform: scale(.98); }
.workshop-card:hover:not(.disabled) { border-color: #94a3b8; }
.workshop-card.selected { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,155,190,.15); background: rgba(0,155,190,.04); }
.workshop-card.full    { opacity: .7; }
.workshop-card.disabled { cursor: not-allowed; opacity: .5; }

/* ─── Day pills ─────────────────────────────────────────────────────────── */
.workshop-card-days { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 6px; }
.day-pill {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  padding: 3px 8px; border-radius: 20px; letter-spacing: .3px;
}
.workshop-card-name { font-size: 17px; font-weight: 900; color: var(--navy); margin: 4px 0 4px; line-height: 1.2; }
.workshop-card-time { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.workshop-badge {
  position: absolute; top: 14px; right: 14px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 10px; font-weight: 800; color: #fff; text-transform: uppercase;
}
.badge-included { background: var(--cyan); }
.badge-extra    { background: var(--magenta); }
.badge-full     { background: #94a3b8; }
.check-overlay {
  position: absolute; top: 12px; right: 12px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--cyan); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900;
}

/* ─── Capacity bar ───────────────────────────────────────────────────────── */
.capacity-bar { margin-top: 10px; }
.capacity-track { height: 4px; background: #e2e8f0; border-radius: 2px; overflow: hidden; }
.capacity-fill  { height: 4px; background: var(--cyan); border-radius: 2px; transition: width .3s; }
.capacity-fill.full { background: var(--magenta); }
.capacity-text { font-size: 10px; color: #94a3b8; margin-top: 3px; font-weight: 600; }
.waitlist-option { margin-top: 8px; font-size: 12px; color: var(--magenta); font-weight: 700; }

/* ─── Conflict message ──────────────────────────────────────────────────── */
.conflict-msg {
  font-size: 11px; color: var(--magenta);
  margin-top: 8px; font-weight: 700; line-height: 1.3;
}

/* ─── Continue button sticky ───────────────────────────────────────────── */
.continue-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 30%);
  z-index: 30;
}
.continue-bar .btn-success {
  max-width: 900px;
  margin: 0 auto;
}

/* ─── Summary / Resumen ────────────────────────────────────────────────── */
.summary-card {
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  padding: 20px 16px;
  margin-bottom: 16px;
}
.summary-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding-bottom: 16px; border-bottom: 2px solid var(--bg);
  margin-bottom: 20px; gap: 12px;
}
.summary-brand { display: flex; align-items: center; gap: 10px; }
.schedule-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 20px; }
.schedule-col {}
.schedule-day {
  font-size: 9px; font-weight: 800; color: #64748b;
  text-align: center; background: var(--bg); border-radius: 6px;
  padding: 5px 2px; margin-bottom: 5px; text-transform: uppercase;
}
.schedule-block {
  padding: 7px 4px; border-radius: 8px;
  font-size: 9px; font-weight: 800; color: #fff;
  text-align: center; margin-bottom: 4px; line-height: 1.3;
}
.breakdown-section {
  border: 2px solid var(--bg); border-radius: 14px; overflow: hidden;
  margin-bottom: 20px;
}
.breakdown-header {
  background: var(--bg); padding: 10px 14px;
  font-size: 11px; font-weight: 800; color: var(--navy);
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 2px solid var(--border);
}
.breakdown-body { padding: 10px 14px; }
.breakdown-line {
  display: flex; justify-content: space-between; align-items: flex-start;
  font-size: 13px; color: var(--muted); padding: 7px 0;
  border-bottom: 1px solid var(--bg); gap: 8px;
}
.breakdown-total {
  display: flex; justify-content: space-between;
  font-size: 18px; font-weight: 900; color: var(--magenta);
  padding-top: 12px; margin-top: 6px;
  border-top: 2px dashed var(--border);
}
.email-section { margin-bottom: 20px; }
.email-section h3 { font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 12px; }

/* ─── Action bar (resumen) ───────────────────────────────────────────────── */
.action-bar {
  display: flex; gap: 10px; margin-bottom: 12px;
}
.action-bar .btn-secondary { flex-shrink: 0; }
.action-bar .btn-success   { flex: 1; width: auto; }

/* ─── Success view ─────────────────────────────────────────────────────── */
.success-wrap {
  max-width: 520px; margin: 24px auto;
  text-align: center;
}
.success-card {
  background: var(--card);
  border-radius: 28px;
  box-shadow: 0 8px 40px rgba(0,0,0,.12);
  padding: 36px 24px;
  border-top: 8px solid var(--green);
}
.success-icon {
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(137,188,63,.12);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.success-icon svg { width: 40px; height: 40px; color: var(--green); }
.success-title { font-size: 24px; font-weight: 900; color: var(--navy); margin-bottom: 10px; }
.success-subtitle { font-size: 14px; color: var(--muted); font-weight: 500; margin-bottom: 20px; line-height: 1.5; }
.folio-display {
  background: var(--bg); border: 2px solid var(--cyan);
  border-radius: 10px; padding: 12px 16px; text-align: center;
  margin-bottom: 16px;
}
.folio-display .folio-label { font-size: 10px; color: #94a3b8; font-weight: 700; text-transform: uppercase; }
.folio-display .folio-num { font-size: 22px; font-weight: 900; color: var(--navy); letter-spacing: 1px; }
.steps-box {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  text-align: left; margin-bottom: 20px;
}
.steps-box h4 { font-size: 11px; font-weight: 700; color: #94a3b8; text-transform: uppercase; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.steps-box ol { padding-left: 18px; font-size: 13px; color: var(--muted); line-height: 1.9; }
.waitlisted-notice {
  background: rgba(223,27,121,.06);
  border: 1px solid rgba(223,27,121,.2);
  border-radius: 10px; padding: 10px 14px;
  font-size: 12px; color: var(--magenta); font-weight: 600;
  margin-bottom: 16px;
}

/* ─── Utilities ────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); font-size: 13px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.flex  { display: flex; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.loading { text-align: center; padding: 40px; color: var(--muted); font-weight: 600; }

/* ─── Tablet & Desktop ──────────────────────────────────────────────────── */
@media (min-width: 540px) {
  .main { padding: 24px 20px; }
  .login-card { padding: 40px 36px; }
  .workshop-grid { grid-template-columns: 1fr 1fr; }
  .summary-card { padding: 28px 28px; }
  .continue-bar { position: sticky; bottom: 16px; background: none; padding: 0 0 8px; }
  .continue-bar .btn-success { max-width: none; }
}

@media (min-width: 768px) {
  .main { padding: 32px 24px; }
  .navbar { padding: 0 24px; height: 60px; }
  .navbar-logo-img { width: 40px; height: 40px; }
}
