/* Root Variables */
:root {
  --primary: #27aec4;
  --primary-dark: #0a375f;
  --primary-light: #a8dfe8;
  --accent-magenta: #ec008c;
  --success: #10b981;
  --success-bg: #d1fae5;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --bg-light: #f8fafc;
  --bg-lighter: #f1f5f9;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Body */
html {
  scroll-behavior: smooth;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--bg-light) 0%, #d5eff4 100%);
  min-height: 100vh;
  line-height: 1.6;
}

/* Main Container */
.page-shell {
  width: min(100%, 900px);
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Panel */
.panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow:
    0 10px 15px rgba(0, 0, 0, 0.08),
    0 4px 6px rgba(0, 0, 0, 0.05);
  padding: 2.5rem;
}

/* Header */
.panel-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
  margin: 0;
}

h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  color: var(--text-primary);
  margin: 0.6rem 0 0.4rem;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
}

/* Reset fieldset/legend browser defaults explicitly */
fieldset {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

legend {
  padding: 0;
  display: table;
  max-width: 100%;
  float: left;
  width: 100%;
}

legend + * {
  clear: left;
}

/* Form */
.student-form {
  display: grid;
  gap: 1.5rem;
}

.form-section {
  /* border shorthand first, then border-left so it is not overridden */
  border: none;
  border-left: 4px solid var(--primary);
  background: linear-gradient(
    135deg,
    var(--bg-light) 0%,
    var(--bg-lighter) 100%
  );
  border-radius: 10px;
  padding: 1.5rem;
  transition: box-shadow 0.3s ease;
}

.form-section:hover {
  box-shadow: 0 4px 12px rgba(39, 174, 196, 0.1);
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0 0 1.2rem;
  padding: 0.4rem 0.8rem;
  background: rgba(39, 174, 196, 0.08);
  border-radius: 6px;
  display: block;
  width: 100%;
  box-sizing: border-box;
}

/* Rows */
.field-row {
  display: grid;
  gap: 1.25rem;
}

.two-col {
  grid-template-columns: repeat(2, 1fr);
}

/* Fields */
.field {
  display: flex;
  flex-direction: column;
}

.field label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
}

.required {
  color: var(--accent-magenta);
  font-weight: 700;
}

/* Inputs */
.field input[type="text"],
.field input[type="email"],
.field input[type="date"],
.field input[type="file"],
.field select {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  background-color: #fafbfc;
  color: var(--text-primary);
  font-family: inherit;
  transition: all 0.25s ease;
}

.field input:hover,
.field select:hover {
  border-color: var(--border-dark);
  background-color: #ffffff;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(39, 174, 196, 0.1);
}

.field input::placeholder {
  color: var(--text-muted);
}

.field select {
  cursor: pointer;
}

.language-section {
  border-left-color: var(--primary-dark);
}

.language-field {
  max-width: 340px;
}

.field input[type="file"] {
  padding: 1rem;
  cursor: pointer;
}

.field input[type="file"]::file-selector-button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  margin-right: 0.8rem;
  transition: all 0.2s ease;
}

.field input[type="file"]::file-selector-button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

/* Helper Text */
.hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Error Text */
.error-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--danger);
  margin-top: 0.4rem;
  min-height: 1.2rem;
}

/* Status Messages */
.status-message {
  display: none;
  padding: 1rem 1.2rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1.5px solid;
}

.status-message.error {
  display: block;
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.status-message.success {
  display: block;
  background: #d1fae5;
  border-color: #86efac;
  color: #166534;
}

/* Confirmation Checkbox */
.confirmation-check {
  background: linear-gradient(
    135deg,
    var(--bg-light) 0%,
    var(--bg-lighter) 100%
  );
  border-left: 4px solid var(--accent-magenta);
  border-radius: 10px;
  padding: 1.2rem 1.5rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
}

.checkbox-label span {
  line-height: 1.5;
}

/* Honeypot */
.honeypot {
  position: absolute;
  left: -10000px;
}

/* Button */
button[type="submit"] {
  margin-top: 1rem;
  padding: 1rem 1.8rem;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(39, 174, 196, 0.3);
  transition: all 0.3s ease;
}

button[type="submit"]:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, var(--primary-dark) 0%, #062d4e 100%);
  box-shadow: 0 8px 20px rgba(39, 174, 196, 0.4);
}

button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Form Actions */
.form-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.8rem;
  margin-top: 1rem;
}

.form-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .page-shell {
    margin: 1rem auto;
    padding: 0 0.75rem;
  }

  .panel {
    padding: 1.5rem;
  }

  .panel-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
  }

  .form-section {
    padding: 1.2rem;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 1.4rem;
  }

  button[type="submit"] {
    width: 100%;
  }

  .form-actions {
    width: 100%;
  }

  .field-row {
    gap: 1rem;
  }

  .student-form {
    gap: 1rem;
  }
}

/* ===================== Success Modal ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 55, 95, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-box {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  padding: 2.5rem;
  width: min(100%, 600px);
  max-height: 90vh;
  overflow-y: auto;
  border-top: 6px solid var(--primary);
}

.modal-box h2 {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 1rem;
  line-height: 1.3;
}

.modal-intro {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.modal-steps {
  padding-left: 1.4rem;
  margin-bottom: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-steps li {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.55;
}

.modal-steps a {
  color: var(--primary-dark);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition:
    color 0.2s ease,
    text-decoration-color 0.2s ease;
}

.modal-steps a:hover,
.modal-steps a:focus {
  color: var(--accent-magenta);
  text-decoration-color: var(--accent-magenta);
}

.modal-steps a:focus-visible {
  outline: 3px solid rgba(39, 174, 196, 0.35);
  outline-offset: 3px;
  border-radius: 4px;
}

.confirmation-box {
  background: linear-gradient(135deg, var(--bg-light) 0%, #d5eff4 100%);
  border: 2px solid var(--primary-light);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  text-align: center;
  margin-bottom: 1.75rem;
}

.conf-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}

.confirmation-number {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  color: var(--primary-dark);
  font-family: "Courier New", Courier, monospace;
  margin: 0.25rem 0 0.5rem;
}

.conf-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

.modal-close-btn {
  display: block;
  width: 100%;
  padding: 0.95rem 1.5rem;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(39, 174, 196, 0.3);
  transition: all 0.3s ease;
}

.modal-close-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, var(--primary-dark) 0%, #062d4e 100%);
  box-shadow: 0 8px 20px rgba(39, 174, 196, 0.4);
}

@media (max-width: 480px) {
  .modal-box {
    padding: 1.5rem;
  }

  .confirmation-number {
    font-size: 1.5rem;
    letter-spacing: 0.15em;
  }
}

/* Summer Youth Pass instruction link - strong selector added v4 */
#successModal .modal-box .modal-steps a.instruction-link,
#successModal .modal-box .modal-steps a.instruction-link:link,
#successModal .modal-box .modal-steps a.instruction-link:visited {
  color: #0a375f !important;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: #0a375f !important;
  text-underline-offset: 3px;
}

#successModal .modal-box .modal-steps a.instruction-link:hover,
#successModal .modal-box .modal-steps a.instruction-link:focus,
#successModal .modal-box .modal-steps a.instruction-link:active {
  color: #ec008c !important;
  text-decoration-color: #ec008c !important;
}
