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

:root {
  --brand: #9b4d8a;
  --brand-600: #823d73;
  --brand-700: #6a2f5e;
  --brand-50: #fbf3f9;
  --brand-100: #f4e4ef;
  --ring: rgba(155, 77, 138, 0.18);

  --ink: #1f1720;
  --muted: #6f6370;
  --line: #ebe3e9;
  --surface: #ffffff;
  --canvas: #f6f3f6;

  --success: #16a34a;
  --success-50: #ecfdf3;
  --danger: #dc2626;
  --danger-50: #fef2f2;

  --radius: 20px;
  --radius-sm: 12px;
  --shadow-card: 0 1px 2px rgba(31, 23, 32, 0.04), 0 12px 32px rgba(74, 28, 64, 0.08);

  /* Older names, still used by the forms pages */
  --primary: var(--brand);
  --primary-dark: var(--brand-600);
  --accent: var(--brand);
  --text: var(--ink);
  --border: var(--line);
  --bg: var(--brand-50);
  --card: var(--surface);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--canvas);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 28px 16px 64px;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Brand band behind the header; cards overlap its lower edge */
body::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 300px;
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.14) 0, transparent 40%),
    radial-gradient(circle at 85% 0%, rgba(255, 196, 235, 0.25) 0, transparent 45%),
    linear-gradient(135deg, var(--brand-700) 0%, var(--brand) 100%);
  z-index: -1;
}

.app {
  width: 100%;
  max-width: 560px;
}

.app-header {
  text-align: center;
  margin-bottom: 24px;
  color: #fff;
}

.church-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 12px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.app-header h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.subtitle {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  font-weight: 500;
}

/* --- Breadcrumb (step trail) --- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 14px;
  padding: 7px 14px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(74, 28, 64, 0.12);
}

.breadcrumb:empty {
  display: none;
}

.breadcrumb .crumb-sep {
  color: var(--muted);
  opacity: 0.5;
}

.breadcrumb button.crumb {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--brand);
  font-weight: 600;
  cursor: pointer;
}

.breadcrumb button.crumb:hover {
  text-decoration: underline;
}

.breadcrumb .crumb-current {
  color: var(--ink);
  font-weight: 700;
}

/* --- Cards / views --- */
.view {
  display: none;
  background: var(--surface);
  border: 1px solid rgba(235, 227, 233, 0.8);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow-card);
}

.view.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.view h2 {
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* --- Selection tiles --- */
.button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.class-btn {
  padding: 22px 12px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 16px;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.class-btn:hover {
  border-color: var(--brand);
  background: var(--brand-50);
  color: var(--brand-600);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(155, 77, 138, 0.14);
}

.class-btn:active {
  transform: scale(0.98);
}

.arm-btn {
  grid-column: 1 / -1;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 18px 48px 18px 20px;
  line-height: 1.4;
  position: relative;
}

.arm-btn::after {
  content: "›";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 26px;
  font-weight: 400;
  color: var(--muted);
}

.arm-btn .arm-name {
  display: block;
}

.arm-btn .arm-teacher {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

/* --- Buttons --- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  border-radius: 999px;
  color: var(--brand);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
  margin: -6px 0 14px -12px;
}

.back-btn:hover {
  background: var(--brand-50);
}

.okay-btn {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-600) 100%);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(155, 77, 138, 0.28);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.okay-btn:hover {
  filter: brightness(1.05);
  box-shadow: 0 10px 24px rgba(155, 77, 138, 0.34);
}

.okay-btn:active {
  transform: scale(0.99);
}

.okay-btn:disabled {
  background: #ece6eb;
  color: #a99ea7;
  box-shadow: none;
  filter: none;
  cursor: not-allowed;
}

.selected-label {
  color: var(--muted);
  font-size: 14px;
  margin: -12px 0 20px;
}

/* --- Form fields --- */
#reg-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.form-section:first-child {
  padding-top: 0;
  border-top: none;
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.form-section-title .step-num {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-100);
  color: var(--brand-600);
  font-size: 13px;
  font-weight: 800;
}

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

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

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-group label {
  font-size: 13px;
  font-weight: 600;
  color: #4a3f4a;
}

.field-group .optional {
  font-weight: 500;
  color: var(--muted);
}

.field-group input,
.field-group select,
.field-group textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 16px;
  outline: none;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-group select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236f6370' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.field-group textarea {
  resize: vertical;
}

.field-group input::placeholder,
.field-group textarea::placeholder {
  color: #b3a8b1;
}

.field-group input:hover,
.field-group select:hover,
.field-group textarea:hover {
  border-color: #dccfd8;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--ring);
}

.field-group input:disabled {
  background: var(--canvas);
  color: var(--muted);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.section-note {
  font-size: 13px;
  color: var(--muted);
  margin: -6px 0 0;
  font-weight: 500;
}

.form-error {
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  margin: 0;
  min-height: 0;
}

.form-error:not(:empty) {
  padding: 10px 14px;
  background: var(--danger-50);
  border-radius: var(--radius-sm);
}

/* --- Success screen --- */
.done-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 4px auto 16px;
  border-radius: 50%;
  background: var(--success-50);
  color: var(--success);
  font-size: 36px;
  box-shadow: 0 0 0 8px rgba(22, 163, 74, 0.06);
}

.done-icon svg {
  width: 36px;
  height: 36px;
}

#view-done {
  text-align: center;
}

#view-done h2 {
  margin-bottom: 8px;
}

#view-done .selected-label {
  margin: 0 0 8px;
  font-weight: 600;
  color: var(--brand-600);
}

.done-note {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 24px;
}

#start-over-btn,
#again-btn {
  margin: 0 auto;
}
