/* =========================
   FORM SCOPE / LAYOUT
========================= */

.form-scope {
  max-width: 600px;
}

.form-scope header {
  margin-bottom: 30px;
}

/* =========================
   CARDS / WRAPPERS
========================= */

.form .card {
  display: none;
  position: relative;
  background: #fff;
  border-radius: 8px;
  padding: 30px 25px;
  margin-bottom: 30px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border: 2px solid #222;
}

.form .card.active {
  display: block;
}

.form .card.invalid {
  border-color: #e74c3c;
  animation: shake 0.3s;
}

.card-wrapper {
  display: none;
}

.card-wrapper.active {
  display: block;
}

.card-wrapper.animate-in {
  animation: fadeUp 0.45s ease forwards;
}

/* =========================
   FORM ELEMENTS
========================= */

.form label {
  font-weight: 500;
  font-size: 0.95rem;
  color: #222;
  display: block;
  margin-bottom: 6px;
}

.form input,
.form textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin: 0; /* spacing handled by .field */
}

.form textarea {
  resize: vertical;
}

/* Field spacing / validation */
.field {
  margin-bottom: 16px;
}

.field.invalid input {
  border-color: #e74c3c;
}

.field-error {
  font-size: 0.85rem;
  color: #e74c3c;
  margin-top: 4px;
}

.field-error:empty {
  display: none;
}

/* =========================
   BUTTONS
========================= */

.buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  height: 48px;
  margin-bottom: 14px;
}

.form button {
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  background: #222;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.form button:hover {
  background: #444;
}

.btn-secondary {
  background: #f2f2f2;
  color: #111;
  border: 1px solid #ccc;
}

.btn-secondary:hover {
  background: #eaeaea;
}

/* =========================
   PROGRESS BAR
========================= */

.progress-wrapper {
  margin: 20px 0 30px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e5e5;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #222;
  transition: width 0.35s ease;
}

.progress-text {
  margin-top: 6px;
  font-size: 0.85rem;
  color: #555;
  text-align: right;
}

/* =========================
   TEXT HELPERS
========================= */

.mini-title {
  font-family: "Inter", sans-serif;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 10px;
}

.hint {
  font-size: 0.9rem;
  color: #666;
  margin-top: 6px;
}

.subhint {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #666;
}

#noSubjectsMsg {
  margin-top: 12px;
  font-style: italic;
}

/* =========================
   SUBJECT TILE GRID
========================= */

.options {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.option-card {
  position: relative;
  border: 1px solid #ccc;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  padding: 16px 14px;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 120px;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  outline: none;
}

.option-card:focus-visible {
  outline: 2px solid #222;
  outline-offset: 2px;
}

.option-card:hover {
  background: #f0f0f0;
}

.option-card.selected {
  border-color: #222;
  background: #f2f2f2;
}

.check-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #222;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.option-card.selected .check-badge {
  opacity: 1;
  transform: scale(1);
}

.option-image {
  display: flex;
  align-items: center;
  justify-content: center;
}

.option-image img.icon {
  width: 100px;
  height: 55px;
  object-fit: contain;
  opacity: 0.92;
  transition: transform 0.3s ease;
}

.option-card:hover .option-image img.icon {
  transform: scale(1.1);
}

.option-title {
  margin-top: 14px;
  text-align: center;
  font-size: 0.75rem;
  color: #222;
}

/* =========================
   YEAR GRID
========================= */

.year-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.year-buttons.bio-only {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.year-buttons input {
  display: none;
}

.year-buttons label.year-btn {
  text-align: center;
  padding: 12px 0;
  border: 1px solid #ccc;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  background: #fff;
  transition: all 0.2s ease;
  user-select: none;
}

.year-buttons input:checked + label.year-btn {
  background: #222;
  color: #fff;
  border-color: #222;
}

.year-btn.full-row {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .year-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =========================
   MATH COURSE BLOCK
========================= */

.math-course {
  display: none;
  margin-top: 18px;
}

.math-course.active {
  display: block;
}

.restriction-note {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #555;
  display: none;
}

.restriction-note.show {
  display: block;
}

/* =========================
   CONTACT LAYOUT
========================= */

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 640px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 641px) {
  .two-col .field {
    margin-bottom: 0; /* grid gap handles spacing on desktop */
  }
}

@media (max-width: 640px) {
  .two-col {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .field,
  .two-col .field {
    margin-bottom: 20px;
  }

  .two-col .field:last-child {
    margin-bottom: 0;
  }
}

/* =========================
   CHIPS
========================= */

/*
.selection-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
*/

.chip {
  background: #f2f2f2;
  border: 1px solid #ddd;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
  color: #222;
}

/* =========================
   REQUEST CARDS (FORMATS STEP)
========================= */

.request-list {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.request-card {
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}

.request-title {
  font-weight: 700;
  color: #222;
}

.request-meta {
  margin-top: 4px;
  font-size: 0.9rem;
  color: #666;
}

.format-buttons.inline {
  margin-top: 12px;
}

.format-buttons {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.format-buttons input {
  display: none;
}

.format-buttons label {
  flex: 1;
  text-align: center;
  padding: 12px 0;
  border: 1px solid #ccc;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  background: #fff;
  transition: all 0.2s ease;
}

.format-buttons input:checked + label {
  background: #222;
  color: #fff;
  border-color: #222;
}

.format-buttons label.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.request-note {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #555;
}

/* =========================
   AVAILABILITY
========================= */

.availability-container {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: stretch;
}

.availability-card p {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 12px;
}

.day-selector {
  flex: 1;
  min-width: 120px;
  position: relative;
}

.selected-day {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f0f0f0;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 8px;
}

.day-list {
  display: none;
  position: absolute;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  width: 100%;
  max-height: 170px;
  overflow-y: auto;
  z-index: 10;
}

.day-option {
  padding: 8px 12px;
  cursor: pointer;
}

.day-option:hover {
  background: #f0f0f0;
}

.day-times {
  height: 100%;
}

.time-buttons.day-times {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
}

.time-buttons.day-times.active {
  display: flex;
}

.time-buttons.day-times input {
  display: none;
}

.time-buttons.day-times label {
  flex: 1 0 45%;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-bottom: 0;
  line-height: 1.2;
}

.time-buttons.day-times input:checked + label {
  background: #222;
  color: #fff;
  border-color: #222;
}

.time-legend {
  margin-top: 12px;
  font-size: 0.9rem;
  color: #555;
  width: 100%;
}

.time-legend div {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
  line-height: 1.6;
}

.time-legend span:first-child {
  font-weight: 500;
}

@media (max-width: 600px) {
  .time-legend {
    grid-column: 1 / -1;
    width: 100%;
  }

  .availability-container {
    flex-direction: column;
  }

  .time-buttons.day-times {
    flex-wrap: nowrap;
  }

  .time-buttons.day-times label {
    flex: 1 1 0;
    padding: 8px 6px;
  }
}

/* =========================
   SUMMARY
========================= */

#availabilitySummary {
  margin-top: 16px;
  font-size: 0.9rem;
  color: #222;
  min-height: 20px;
}

.summary-line {
  display: flex;
  padding: 4px 0;
  border-bottom: 1px solid #ccc;
}

.summary-line:last-child {
  border-bottom: none;
}

.day-name {
  width: 100px;
  flex-shrink: 0;
}

/* =========================
   TOGGLE BUTTONS
========================= */

#toggleDays,
#toggleYears,
#toggleMathCourse {
  font-size: 0;
  padding: 5px 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #222;
  color: #fff;
  cursor: pointer;
  border: none;
}

#toggleDays::after,
#toggleYears::after,
#toggleMathCourse::after {
  content: "▼";
  font-size: 0.6rem;
}

#toggleDays:hover,
#toggleYears:hover,
#toggleMathCourse:hover {
  background: #444;
}

/* =========================
   ERROR MESSAGES
========================= */

.card .error-message {
  color: #e74c3c;
  font-size: 0.85rem;
  margin-top: 10px;
}

/* =========================
   LEAVE MODAL
========================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 10px;
  padding: 28px 24px;
  width: 90%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  animation: modalPop 0.25s ease;
}

.modal h2 {
  font-size: 1.25rem;
  margin-bottom: 8px;
  color: #222;
}

.modal p {
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions button {
  flex: 1;
  padding: 12px 16px;
  min-height: 44px;
  line-height: 1.2;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

.modal-actions button:not(.danger) {
  background: #222;
  color: #fff;
}

.modal-actions .danger {
  background: #e74c3c;
  color: #fff; 
}

.modal-actions button:not(.danger):hover {
  background: #444;
}

.modal-actions .danger {
  background: #e74c3c;
}

.modal-actions .danger:hover {
  background: #cf3f33;
}

/* =========================
   ANIMATIONS
========================= */

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

@keyframes modalPop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* =========================
   HOVER COLOR OVERRIDE (NON-NEXT / NON-SUBMIT / NON-MODAL)
   Target hover color: #f0f0f0
========================= */

/* Real <button> elements inside the form, excluding Next/Submit */
.form button:not(#nextBtn):not([type="submit"]):hover {
  background: #f0f0f0;
  color: #111;
}

/* Specifically override the toggle buttons (they had their own hover rule) */
#toggleDays:hover,
#toggleYears:hover,
#toggleMathCourse:hover {
  background: #f0f0f0;
  color: #111;
}

/* "Button" labels (year, format, availability) — only when NOT selected/checked */
.year-buttons input:not(:checked) + label.year-btn:hover {
  background: #f0f0f0;
}

.format-buttons input:not(:checked) + label:hover {
  background: #f0f0f0;
}

.time-buttons.day-times input:not(:checked) + label:hover {
  background: #f0f0f0;
}

/* Smooth hover for availability time labels */
.time-buttons.day-times label {
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

