/* Shared look for the latest enrolment application forms
   (riverdale_v6, sits_v3, accord_v2) via templates/enrolments/includes/apply_base.html.
   --apply-primary is set per college in that college's layout.html.
   Rules are scoped under .apply-shell so they win over the older per-step <style> blocks. */

.apply-body {
  font-family: 'Poppins', sans-serif;
  line-height: 1.6;
  background: #f8fafc;
  color: #1e293b;
}

/* Header */
.apply-header { background: #ffffff; border-bottom: 1px solid #e2e8f0; }
.apply-header-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}
.apply-logo { display: block; height: 80px; width: auto; max-width: 100%; object-fit: contain; }
.apply-form-title { font-size: 1rem; line-height: 1.35; font-weight: 600; color: #0f172a; }
.apply-form-codes { margin-top: 0.125rem; font-size: 0.75rem; color: #64748b; letter-spacing: 0.01em; }

/* Layout */
.apply-layout {
  max-width: 80rem;
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

/* Steps: slim bar on small screens, list on large screens */
.apply-steps-label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #64748b; }
.apply-steps-list { display: none; }
.apply-steps-bar { display: flex; gap: 0.25rem; margin-top: 0.5rem; }
.apply-steps-seg { flex: 1; height: 0.25rem; border-radius: 9999px; background: #e2e8f0; }
.apply-steps-seg.is-on { background: var(--apply-primary); }

/* Card */
.apply-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -16px rgba(15, 23, 42, 0.18);
}
.apply-card-head { padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid #f1f5f9; }
.apply-card-title { font-size: 1.25rem; line-height: 1.35; font-weight: 600; color: #0f172a; letter-spacing: -0.01em; }
.apply-shell .apply-step > form { padding: 1.25rem; }

/* Labels, help and errors */
.apply-shell .ef-label { font-size: 0.875rem; font-weight: 500; color: #334155; margin-bottom: 0.375rem; }
.apply-shell .ef-help { color: #64748b; }
.apply-shell .ef-error { color: #b91c1c; font-weight: 500; }

/* Native inputs rendered by Django */
.apply-shell form input[type="text"],
.apply-shell form input[type="email"],
.apply-shell form input[type="tel"],
.apply-shell form input[type="date"],
.apply-shell form input[type="number"],
.apply-shell form select,
.apply-shell form textarea {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background-color: #ffffff;
  color: #0f172a;
  padding: 0.5rem 0.75rem;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.apply-shell form textarea { min-height: 96px; }
.apply-shell form input[type="text"]:hover,
.apply-shell form input[type="email"]:hover,
.apply-shell form input[type="tel"]:hover,
.apply-shell form input[type="date"]:hover,
.apply-shell form input[type="number"]:hover,
.apply-shell form select:hover,
.apply-shell form textarea:hover { border-color: #94a3b8; }
.apply-shell form input[type="text"]:focus,
.apply-shell form input[type="email"]:focus,
.apply-shell form input[type="tel"]:focus,
.apply-shell form input[type="date"]:focus,
.apply-shell form input[type="number"]:focus,
.apply-shell form select:focus,
.apply-shell form textarea:focus {
  outline: none;
  border-color: var(--apply-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--apply-primary) 15%, transparent);
}
.apply-shell form input[type="checkbox"],
.apply-shell form input[type="radio"] { accent-color: var(--apply-primary); }

/* Selects: same height as text boxes in every browser, with our own arrow. */
.apply-shell form select:not([multiple]):not([size]) {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  background-size: 1.125rem;
}
.apply-shell form select:disabled,
.apply-shell form input:disabled { background-color: #f8fafc; color: #94a3b8; cursor: not-allowed; }

/* Section headings and field grid used by the redesigned steps (e.g. Section C). */
.apply-section + .apply-section { margin-top: 2rem; }
.apply-section-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.apply-section-head h3 { font-size: 0.9375rem; font-weight: 600; color: #0f172a; }
.apply-section-head::after { content: ""; flex: 1; height: 1px; background: #e2e8f0; }
.apply-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem 1.25rem; }
.apply-note {
  padding: 0.75rem 1rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.625rem;
  background: #f8fafc;
}
.apply-note .ef-label { color: #475569; }

/* Phones: nothing in a step may be wider than the screen. Grid columns may shrink below their
   content (a select with a long option otherwise widens the page), long links wrap, and the
   Section B course tables scroll sideways inside their own box instead of squeezing their columns. */
.apply-shell .apply-step .grid > * { min-width: 0; }
.apply-shell .apply-step a { overflow-wrap: anywhere; }
.apply-shell .table-stack { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.apply-shell .table-stack .stacked-table { min-width: 44rem; }

/* Footer actions */
.apply-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1rem 0;
  border-top: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.apply-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.apply-btn-primary { min-width: 8rem; border: 1px solid var(--apply-primary); background: var(--apply-primary); color: #ffffff; }
.apply-btn-primary:hover { filter: brightness(1.2); }
.apply-btn-secondary { border: 1px solid #cbd5e1; background: #ffffff; color: #334155; }
.apply-btn-secondary:hover { border-color: #94a3b8; background: #f8fafc; }
.apply-link { font-size: 0.875rem; color: #64748b; }
.apply-link:hover { color: #0f172a; text-decoration: underline; }

.apply-footer { margin-top: 1.5rem; text-align: center; font-size: 0.75rem; color: #94a3b8; }

@media (min-width: 768px) {
  .apply-header-inner { flex-direction: row; align-items: center; justify-content: space-between; padding: 0.5rem 1.5rem; }
  .apply-logo { height: 104px; }
  .apply-header-text { text-align: right; }
  .apply-form-title { font-size: 1.0625rem; }
  .apply-layout { padding: 1.5rem 1.5rem 3rem; }
  .apply-card-head { padding: 1.5rem 2rem 1.25rem; }
  .apply-card-title { font-size: 1.375rem; }
  .apply-shell .apply-step > form { padding: 1.5rem 2rem; }
  .apply-fields { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .apply-span-2 { grid-column: span 2; }
  .apply-span-3 { grid-column: span 3; }
  .apply-span-4 { grid-column: span 4; }
  .apply-span-6 { grid-column: span 6; }
}

@media (min-width: 1100px) {
  .apply-layout { grid-template-columns: 15.5rem minmax(0, 1fr); gap: 2rem; padding-top: 2rem; }
  .apply-steps { position: sticky; top: 5.5rem; align-self: start; }
  .apply-steps-bar { display: none; }
  .apply-steps-label { margin: 0 0 0.75rem 0.75rem; }
  .apply-steps-list { display: block; }
  .apply-steps-item { border-radius: 0.625rem; font-size: 0.875rem; line-height: 1.35; color: #64748b; }
  .apply-steps-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 0;
    border-radius: 0.625rem;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
  }
  button.apply-steps-link { cursor: pointer; }
  button.apply-steps-link:hover { background: #ffffff; color: #0f172a; box-shadow: 0 0 0 1px #e2e8f0; }
  button.apply-steps-link:focus-visible { outline: 2px solid var(--apply-primary); outline-offset: 2px; }
  .apply-steps-item.is-locked { color: #94a3b8; }
  .apply-steps-item.is-locked .apply-steps-dot { border-style: dashed; color: #94a3b8; }
  .apply-steps-dot {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 9999px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
  }
  .apply-steps-dot svg { width: 0.875rem; height: 0.875rem; }
  .apply-steps-item.is-done { color: #334155; }
  .apply-steps-item.is-done .apply-steps-dot { border-color: var(--apply-primary); background: var(--apply-primary); color: #ffffff; }
  .apply-steps-item.is-current { background: #ffffff; color: #0f172a; font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 0 0 1px #e2e8f0; }
  .apply-steps-item.is-current .apply-steps-dot { border-color: var(--apply-primary); color: var(--apply-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--apply-primary) 15%, transparent); }
}

/* Instructions page: "How your application is processed" — a timeline on small screens,
   one row of steps on wide screens. */
.apply-process-heading { margin-bottom: 0.875rem; font-size: 0.9375rem; font-weight: 600; color: #0f172a; }
.apply-process { display: grid; margin: 0; padding: 0; list-style: none; }
.apply-process-step { position: relative; display: flex; gap: 0.875rem; padding-bottom: 1.25rem; }
.apply-process-step:last-child { padding-bottom: 0; }
.apply-process-step::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 2.25rem;
  bottom: 0.25rem;
  width: 2px;
  background: #e2e8f0;
  transform: translateX(-50%);
}
.apply-process-step:last-child::before { display: none; }
.apply-process-num {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: var(--apply-primary);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 600;
}
.apply-process-title { margin-top: 0.25rem; font-weight: 600; line-height: 1.4; color: #0f172a; }
.apply-process-text { margin-top: 0.125rem; font-size: 0.8125rem; line-height: 1.5; color: #64748b; }

@media (min-width: 1024px) {
  .apply-process { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1rem; }
  .apply-process-step { flex-direction: column; gap: 0.625rem; padding-bottom: 0; }
  .apply-process-step::before { left: 2.5rem; right: -0.75rem; top: 1rem; bottom: auto; width: auto; height: 2px; transform: translateY(-50%); }
}
.apply-process-note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 0.875rem;
  border-top: 1px solid #e2e8f0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #64748b;
}
.apply-process-note svg { flex: none; width: 1rem; height: 1rem; margin-top: 0.1rem; color: #94a3b8; }

/* Instructions page: the opening summary, then notes with an icon, a title and the text. Like the
   portal's ds-alert, the note colours mean the same for every college (info blue, warning amber);
   only the college's own colour is left to the buttons and steps. On phones the icon sits beside
   the title and the text uses the full width; wider screens indent the text under the title and
   put two notes side by side. */
.apply-lead { font-size: 0.9375rem; line-height: 1.7; color: #475569; }
.apply-callouts { display: grid; gap: 0.875rem; }
@media (min-width: 768px) {
  .apply-callouts { grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }
}
.apply-callout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  align-content: start; /* a shorter note beside a taller one keeps its text under the title */
  gap: 0.5rem 0.75rem;
  padding: 1rem 1.125rem;
  border: 1px solid var(--callout-border);
  border-radius: 0.75rem;
  background: var(--callout-bg);
  font-size: 0.875rem;
  line-height: 1.6;
  color: #334155;
}
.apply-callout-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background: #ffffff;
  color: var(--callout-ink);
  box-shadow: inset 0 0 0 1px var(--callout-border);
}
.apply-callout-icon svg { width: 1.125rem; height: 1.125rem; }
.apply-callout-title { font-weight: 600; line-height: 1.4; color: var(--callout-ink); }
.apply-callout-text { grid-column: 1 / -1; }
@media (min-width: 640px) {
  .apply-callout { column-gap: 0.875rem; row-gap: 0.25rem; }
  .apply-callout-text { grid-column: 2; }
}
.apply-callout strong { font-weight: 600; color: #0f172a; }
.apply-callout a {
  font-weight: 600;
  color: var(--callout-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}
.apply-callout--info { --callout-ink: #234ea3; --callout-bg: #f3f6fd; --callout-border: #d3def6; }
.apply-callout--warning { --callout-ink: #7f4d00; --callout-bg: #fef8ea; --callout-border: #f3dca3; }

/* Header stays at the top while the form is filled in, and slims down once the page
   scrolls (the script in apply_base.html adds .is-compact), so the college's branding is
   always visible without taking space from the form. */
/* Keeps a field reached with Tab, or an error scrolled to, clear of the sticky header.
   (This stylesheet is only loaded on the application form.) */
html { scroll-padding-top: 5.5rem; }
.apply-header { position: sticky; top: 0; z-index: 30; transition: box-shadow 0.2s ease; }
.apply-header-inner, .apply-logo, .apply-form-title { transition: all 0.2s ease; }
.apply-header.is-compact { box-shadow: 0 8px 20px -14px rgba(15, 23, 42, 0.35); }
.apply-header.is-compact .apply-header-inner {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.apply-header.is-compact .apply-logo { height: 36px; }
.apply-header.is-compact .apply-header-text { text-align: right; }
/* Phones: the slim bar shows the logo and the step number only. */
.apply-header-step { display: none; font-size: 0.75rem; font-weight: 600; color: var(--apply-primary); white-space: nowrap; }
.apply-header.is-compact .apply-form-title,
.apply-header.is-compact .apply-form-codes { display: none; }
.apply-header.is-compact .apply-header-step { display: block; }

@media (min-width: 768px) {
  .apply-header.is-compact .apply-logo { height: 44px; }
  .apply-header.is-compact .apply-form-title { display: block; font-size: 0.9375rem; }
  .apply-header.is-compact .apply-form-codes { display: block; }
  .apply-header.is-compact .apply-header-step { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .apply-header, .apply-header-inner, .apply-logo, .apply-form-title { transition: none; }
}
