:root {
  font-family: 'Tajawal', Arial, sans-serif;
  color: #12213f;
  background: #f6f8fc;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --blue: #1739ec;
  --blue-dark: #1028ad;
  --blue-soft: #eef2ff;
  --orange: #f66f1b;
  --ink: #12213f;
  --muted: #67738a;
  --line: #dde4ef;
  --surface: #ffffff;
  --danger: #b42318;
  --success: #16784b;
}

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

html,
body,
#root {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-x: none;
  background: #f6f8fc;
}

#root {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
}

main,
header,
section,
footer,
form,
fieldset,
div,
nav,
label,
a,
button,
input {
  min-inline-size: 0;
}

img,
svg {
  display: block;
  max-width: 100%;
}

svg {
  overflow: hidden;
}

body,
button,
input {
  font-family: 'Tajawal', Arial, sans-serif;
}

a {
  color: inherit;
}

button,
a,
input,
label {
  -webkit-tap-highlight-color: transparent;
}

.site-shell {
  width: min(100%, 760px);
  max-width: 100%;
  flex: 1 0 auto;
  margin-inline: auto;
  padding: 12px 12px 28px;
}

.brand-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.brand-link {
  display: inline-flex;
  width: 116px;
  max-width: 100%;
  align-items: center;
  text-decoration: none;
}

.brand-link img {
  width: 100%;
  height: auto;
}

.compact-header {
  display: grid;
  width: 100%;
  max-width: 100%;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
  padding: 15px 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(29, 54, 112, 0.055);
}

.compact-header__logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.compact-header__logo img {
  width: 88px;
  height: auto;
}

.compact-header__copy {
  min-width: 0;
  max-width: 100%;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 800;
}

.compact-header h1,
.thank-you-card h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.25rem, 3.2vw, 1.75rem);
  line-height: 1.38;
  letter-spacing: -0.02em;
}

.compact-header p,
.thank-you-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

.form-wrap {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.form-card,
.thank-you-card {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(29, 54, 112, 0.05);
}

.form-card {
  padding: 22px;
  border-radius: 16px;
}

.form-card form {
  width: 100%;
  max-width: 100%;
}

.form-card__heading {
  margin-bottom: 17px;
}

.form-card__heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.28rem;
}

.form-card__heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

.field-group,
.stage-fieldset {
  width: 100%;
  max-width: 100%;
  margin: 0 0 14px;
}

.field-group label,
.stage-fieldset legend {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 0.93rem;
  font-weight: 800;
}

.field-group input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 47px;
  padding: 0 13px;
  border: 1px solid #cfd8e8;
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font-size: 0.95rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field-group input[dir='ltr'] {
  direction: ltr !important;
  text-align: left !important;
  unicode-bidi: plaintext;
  letter-spacing: 0.035em;
}

.field-group input[dir='ltr']::placeholder {
  direction: ltr;
  text-align: left;
}

.field-group input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 57, 236, 0.09);
}

.field-group input[aria-invalid='true'] {
  border-color: var(--danger);
}

.stage-fieldset {
  padding: 0;
  border: 0;
}

.stage-options {
  display: grid;
  width: 100%;
  max-width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.stage-option {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-height: 49px;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  overflow: hidden;
  border: 1px solid #cfd8e8;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.91rem;
  font-weight: 700;
  transition: border-color 150ms ease, background 150ms ease;
}

.stage-option > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.stage-option:hover {
  border-color: #aebce0;
}

.stage-option.is-selected {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.stage-option input {
  position: fixed;
  inset: 0 auto auto 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.radio-dot {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 2px solid #aeb9ce;
  border-radius: 50%;
}

.stage-option.is-selected .radio-dot {
  border-color: var(--blue);
}

.stage-option.is-selected .radio-dot::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--blue);
}

.field-error {
  display: block;
  margin-top: 6px;
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 700;
}

.config-error,
.submit-error {
  margin: 0 0 13px;
  padding: 10px 12px;
  border: 1px solid rgba(180, 35, 24, 0.22);
  border-radius: 10px;
  background: rgba(180, 35, 24, 0.06);
  color: var(--danger);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.55;
}

.primary-link,
.secondary-link,
.submit-button {
  display: inline-flex;
  min-height: 47px;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 0.93rem;
  font-weight: 800;
  text-decoration: none;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.primary-link,
.submit-button {
  padding: 0 23px;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(23, 57, 236, 0.15);
}

.secondary-link {
  padding: 0 20px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.primary-link:hover,
.secondary-link:hover,
.submit-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.submit-button {
  width: 100%;
  border: 0;
  cursor: pointer;
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.spinner {
  width: 18px;
  height: 18px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

.floating-actions {
  position: static;
}

.floating-button {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 2147483000;
  display: flex !important;
  width: 52px;
  height: 52px;
  min-width: 0;
  max-width: calc(100vw - 28px);
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  color: #fff;
  visibility: visible !important;
  opacity: 1 !important;
  box-shadow: 0 12px 28px rgba(27, 47, 96, 0.25);
  pointer-events: auto;
  transform: none;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.floating-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 32px rgba(27, 47, 96, 0.29);
}

.floating-button svg,
.success-mark svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
}

.floating-button--whatsapp {
  right: max(14px, env(safe-area-inset-right));
  width: auto;
  height: 58px;
  padding: 7px 7px 7px 11px;
  justify-content: flex-start;
  gap: 8px;
  direction: rtl;
  text-decoration: none;
  background: #1aa765;
}

.floating-button--whatsapp svg {
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
}

.floating-button__text {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
  text-align: right;
  line-height: 1.22;
}

.floating-button__name,
.floating-button__school {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-button__name {
  font-size: 0.84rem;
  font-weight: 800;
}

.floating-button__school {
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.9;
}

.floating-button--location {
  left: max(14px, env(safe-area-inset-left));
  background: var(--blue);
}

.site-footer {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-height: 62px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 12px 86px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--blue-dark);
  font-weight: 800;
  text-decoration: none;
}

.footer-contact {
  display: flex;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.footer-contact__label {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 700;
}

.footer-phones {
  display: grid;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.footer-phone {
  display: inline-flex;
  min-width: 166px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fbff;
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.footer-phone svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: currentColor;
}

.honeypot {
  position: fixed !important;
  inset: 0 auto auto 0 !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  opacity: 0 !important;
  clip-path: inset(50%) !important;
  pointer-events: none !important;
}

.thank-you-shell {
  display: grid;
  width: min(640px, calc(100% - 24px));
  max-width: 100%;
  min-height: calc(100vh - 62px);
  min-height: calc(100dvh - 62px);
  align-content: center;
  margin: 0 auto;
  padding: 28px 0 90px;
}

.thank-you-card {
  padding: 36px;
  border-radius: 18px;
  text-align: center;
}

.thank-you-card h1 {
  font-size: clamp(1.7rem, 5vw, 2.5rem);
}

.thank-you-card p {
  margin-inline: auto;
}

.success-mark {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 19px;
  background: #e9f8f0;
  color: var(--success);
}

.success-mark svg {
  width: 35px;
  height: 35px;
}

.thank-you-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.compact-header h1,
.compact-header p,
.form-card__heading p,
.site-footer,
.field-error,
.config-error,
.submit-error,
.thank-you-card p {
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  .site-shell {
    padding: 8px 8px 22px;
  }

  .compact-header {
    grid-template-columns: 66px minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 8px;
    padding: 10px 11px;
    border-radius: 13px;
  }

  .compact-header__logo img {
    width: 63px;
  }

  .eyebrow {
    margin-bottom: 2px;
    font-size: 0.7rem;
  }

  .compact-header h1 {
    font-size: 1.05rem;
    line-height: 1.4;
  }

  .compact-header p {
    margin-top: 3px;
    font-size: 0.76rem;
    line-height: 1.48;
  }

  .form-card {
    padding: 17px 13px;
    border-radius: 13px;
  }

  .form-card__heading {
    margin-bottom: 13px;
  }

  .form-card__heading h2 {
    font-size: 1.12rem;
  }

  .form-card__heading p {
    font-size: 0.82rem;
  }

  .field-group,
  .stage-fieldset {
    margin-bottom: 12px;
  }

  .field-group input {
    height: 45px;
  }

  .stage-options {
    grid-template-columns: 1fr;
  }

  .stage-option {
    min-height: 45px;
  }

  .floating-button {
    bottom: max(12px, env(safe-area-inset-bottom));
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

  .floating-button--whatsapp {
    width: auto;
    height: 54px;
    padding: 6px 6px 6px 10px;
    gap: 7px;
  }

  .floating-button--whatsapp svg {
    width: 25px;
    height: 25px;
    flex-basis: 25px;
  }

  .floating-button__name {
    font-size: 0.8rem;
  }

  .floating-button__school {
    font-size: 0.69rem;
  }

  .floating-button--whatsapp {
    right: max(10px, env(safe-area-inset-right));
  }

  .floating-button--location {
    left: max(10px, env(safe-area-inset-left));
  }

  .site-footer {
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 12px 10px 76px;
  }

  .footer-contact {
    width: 100%;
    flex-direction: column;
    gap: 6px;
  }

  .footer-phones {
    width: min(100%, 360px);
  }

  .footer-phone {
    min-width: 0;
    padding-inline: 8px;
    font-size: 0.8rem;
  }

  .thank-you-shell {
    width: 100%;
    padding: 20px 8px 86px;
  }

  .thank-you-card {
    padding: 28px 17px;
  }

  .thank-you-actions {
    display: grid;
  }
}

@media (max-width: 340px) {
  .compact-header {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 7px;
    padding: 9px;
  }

  .compact-header__logo img {
    width: 53px;
  }

  .compact-header h1 {
    font-size: 0.96rem;
  }

  .compact-header p {
    font-size: 0.72rem;
  }

  .form-card {
    padding-inline: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 380px) {
  .footer-phones {
    grid-template-columns: 1fr;
  }

  .footer-phone {
    width: 100%;
  }
}
