/* =====================================================
   MMCT Scholarship Application — public form
   Mobile-first. Most applicants will be on a phone on a
   slow connection, so: no webfonts, no framework, large
   touch targets, and one question group visible at a time.
   ===================================================== */

:root {
  --navy: #1a2744;
  --navy-dark: #0f1a33;
  --navy-mid: #243258;
  --gold: #c9972a;
  --gold-pale: #fdf3dc;
  --cream: #faf8f4;
  --white: #ffffff;
  --gray-100: #f5f5f5;
  --gray-200: #e8e8e8;
  --gray-400: #a0a0a0;
  --gray-600: #666666;
  --gray-800: #333333;
  --green: #2d7a5f;
  --green-pale: #eaf5f0;
  --red: #c62828;
  --red-pale: #fdecea;
  --radius: 10px;
  --radius-sm: 6px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--gray-800);
  background: var(--cream);
}

/* --- Header ---------------------------------------------------------------- */

.ap-header {
  background: var(--navy);
  color: var(--white);
  padding: 14px 16px;
}
/* Wraps rather than overflows: the same header holds "Scholarship Application"
   and "உதவித்தொகை விண்ணப்பம்", and the longer translations do not fit on one
   line on a phone. */
.ap-header__inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
}
.ap-header__logo { height: 38px; width: auto; flex: 0 0 auto; }
.ap-header__titles { flex: 1 1 auto; min-width: 0; }
.ap-header__title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: break-word;
}
.ap-header__sub { font-size: 12px; color: #b9c2d6; overflow-wrap: break-word; }
.ap-header__tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}
/* On a narrow screen the switcher and link drop to their own row, so a long
   translated title never squeezes them off the edge. */
@media (max-width: 560px) {
  .ap-header__tools {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }
}
.ap-header__link {
  color: #b9c2d6;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}
.ap-header__link:hover { color: var(--white); }

/* Language switcher. Options render in their own script, so the control needs
   a font stack that covers Devanagari, Tamil and Kannada. */
.ap-lang {
  font-family: inherit;
  font-size: 14px;
  padding: 7px 10px;
  min-height: 38px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.ap-lang:focus {
  outline: none;
  border-color: var(--white);
}
/* The dropdown list itself is painted by the OS, which uses the page colours. */
.ap-lang option { color: var(--gray-800); background: var(--white); }

/* --- Shell ----------------------------------------------------------------- */

.ap-wrap { max-width: 760px; margin: 0 auto; padding: 16px 16px 64px; }

.ap-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 16px;
}

.ap-title { font-size: 20px; font-weight: 600; margin: 0 0 4px; color: var(--navy); }
.ap-lede { margin: 0 0 20px; color: var(--gray-600); font-size: 14px; }

/* --- Progress -------------------------------------------------------------- */

.ap-progress { margin: 16px 0 20px; }
.ap-progress__bar {
  height: 6px;
  background: var(--gray-200);
  border-radius: 99px;
  overflow: hidden;
}
.ap-progress__fill {
  height: 100%;
  width: 0;
  background: var(--gold);
  border-radius: 99px;
  transition: width 0.3s ease;
}
.ap-progress__label {
  margin-top: 8px;
  font-size: 13px;
  color: var(--gray-600);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.ap-progress__step { font-weight: 600; color: var(--navy); }

/* --- Forms ----------------------------------------------------------------- */

.ap-field { margin-bottom: 18px; }

.ap-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}
.ap-label .req { color: var(--red); font-weight: 400; }

.ap-hint {
  font-size: 12.5px;
  color: var(--gray-600);
  margin: -2px 0 6px;
}

.ap-input, .ap-select, .ap-textarea {
  width: 100%;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 16px; /* 16px stops iOS zooming on focus */
  color: var(--gray-800);
  background: var(--white);
  border: 1px solid #cfd4de;
  border-radius: var(--radius-sm);
}
.ap-input:focus, .ap-select:focus, .ap-textarea:focus {
  outline: none;
  border-color: var(--navy-mid);
  box-shadow: 0 0 0 3px rgba(36, 50, 88, 0.12);
}
.ap-input[aria-invalid="true"], .ap-select[aria-invalid="true"] {
  border-color: var(--red);
  background: var(--red-pale);
}
.ap-textarea { min-height: 80px; resize: vertical; }

.ap-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .ap-row { grid-template-columns: 1fr; gap: 0; } }

/* Radio / checkbox groups sized for thumbs */
.ap-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid #cfd4de;
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  font-size: 15px;
  min-height: 44px;
}
.ap-choice:hover { border-color: var(--navy-mid); }
.ap-choice input { width: 18px; height: 18px; accent-color: var(--navy); }
.ap-choice--on { border-color: var(--navy); background: #f2f5fb; font-weight: 500; }

.ap-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.5;
}
.ap-check input { margin-top: 2px; width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--navy); }

/* --- Buttons --------------------------------------------------------------- */

.ap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  min-height: 48px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
}
.ap-btn--primary { background: var(--navy); color: var(--white); }
.ap-btn--primary:hover { background: var(--navy-dark); }
.ap-btn--gold { background: var(--gold); color: var(--navy-dark); }
.ap-btn--gold:hover { background: #b8881f; }
.ap-btn--ghost { background: var(--white); color: var(--navy); border-color: #cfd4de; }
.ap-btn--ghost:hover { background: var(--gray-100); }
.ap-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.ap-actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--gray-200);
}
.ap-actions--end { justify-content: flex-end; }
@media (max-width: 560px) {
  .ap-actions { flex-direction: column-reverse; }
  .ap-btn { width: 100%; }
}

/* --- Messages -------------------------------------------------------------- */

.ap-note {
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 16px;
  border-left: 4px solid;
}
.ap-note--ok   { background: var(--green-pale); border-color: var(--green); color: #1d5c46; }
.ap-note--bad  { background: var(--red-pale);   border-color: var(--red);   color: #8c1d17; }
.ap-note--warn { background: var(--gold-pale);  border-color: var(--gold);  color: #7a5a10; }
.ap-note--info { background: #eef2fa;           border-color: var(--navy-mid); color: var(--navy); }
.ap-note ul { margin: 8px 0 0; padding-left: 20px; }
.ap-note li { margin-bottom: 4px; }
.ap-note strong { display: block; margin-bottom: 2px; }

/* --- Documents ------------------------------------------------------------- */

.ap-doc {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  background: var(--white);
  flex-wrap: wrap;
}
.ap-doc--done { border-color: var(--green); background: var(--green-pale); }
.ap-doc__icon {
  width: 30px; height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  background: var(--gray-200);
  color: var(--gray-600);
}
.ap-doc--done .ap-doc__icon { background: var(--green); color: var(--white); }
.ap-doc__body { flex: 1 1 200px; min-width: 0; }
.ap-doc__label { font-size: 14px; font-weight: 500; color: var(--navy); }
.ap-doc__meta {
  font-size: 12.5px;
  color: var(--gray-600);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ap-doc__actions { display: flex; gap: 8px; flex-shrink: 0; }
.ap-doc__btn {
  padding: 8px 14px;
  min-height: 40px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid #cfd4de;
  background: var(--white);
  color: var(--navy);
  cursor: pointer;
}
.ap-doc__btn:hover { background: var(--gray-100); }
.ap-doc__btn--danger { color: var(--red); border-color: #f0c0bc; }

/* --- Review summary -------------------------------------------------------- */

.ap-summary { border-top: 1px solid var(--gray-200); }
.ap-summary__row {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--gray-200);
  font-size: 14px;
}
.ap-summary__key { flex: 0 0 44%; color: var(--gray-600); }
.ap-summary__val { flex: 1; font-weight: 500; color: var(--navy); word-break: break-word; }
/* Shown where cleaning the input changed it - a different script, different
   digits, or different spacing - so the applicant can see their own text. */
.ap-summary__raw {
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--gray-600);
}
.ap-summary__head {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold);
  padding: 16px 0 4px;
}

/* --- Reference badge ------------------------------------------------------- */

.ap-ref {
  background: var(--navy);
  color: var(--white);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.ap-ref__label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #b9c2d6;
}
.ap-ref__value {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
  word-break: break-all;
}
.ap-ref__note { font-size: 12.5px; color: #b9c2d6; margin-top: 6px; }

/* --- Misc ------------------------------------------------------------------ */

.hidden { display: none !important; }
.ap-saving {
  font-size: 13px;
  color: var(--gray-600);
  min-height: 20px;
  align-self: center;
}
.ap-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.ap-footer {
  text-align: center;
  font-size: 12.5px;
  color: var(--gray-600);
  padding: 24px 16px;
  line-height: 1.7;
}
.ap-footer a { color: var(--navy); }

.ap-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--navy);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  max-width: 90vw;
  text-align: center;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.ap-toast--bad { background: var(--red); }
