/* SCOVER Academic · ACE-02b.2 Modal UX Polish
   CSS-only, scoped to the ACE-02b venue-aware assignment modal.
   Does not modify Room/Tutor safe matching, submit, scheduling grid, or legacy dialogs.
   Chromium :has() is used strictly as a CSS scoping gate. */

#modal:has(#venueSlotForm) {
  padding: clamp(10px, 2.2vh, 24px);
  overscroll-behavior: contain;
}

#modal:has(#venueSlotForm) > .modal-card {
  width: min(852px, 100%);
  max-height: calc(100vh - 28px);
  max-height: calc(100dvh - 28px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
  border: 1px solid #386180;
  border-radius: 20px;
  background: linear-gradient(160deg, #10243a 0%, #0b1b2e 50%, #091827 100%);
  box-shadow: 0 26px 86px rgba(0, 0, 0, .58), 0 0 0 1px rgba(110,231,255,.035);
  scrollbar-color: #40617b #0b1b2d;
  scrollbar-width: thin;
}

/* Sticky modal title: remains visible while inspecting longer forms. */
#modal:has(#venueSlotForm) .modal-head {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 24px 15px;
  border-bottom: 1px solid #2b4862;
  background: rgba(12, 31, 50, .97);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
#modal:has(#venueSlotForm) .modal-head > div:first-child { min-width: 0; }
#modal:has(#venueSlotForm) .modal-head small {
  display: block;
  color: #93c6e9;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .04em;
  line-height: 1.5;
}
#modal:has(#venueSlotForm) .modal-head h2 {
  margin: 2px 0 3px;
  font-size: clamp(17px, 1.7vw, 21px);
  font-weight: 850;
  letter-spacing: -.025em;
  line-height: 1.25;
  color: #f1f9ff;
}
#modal:has(#venueSlotForm) .modal-head p {
  margin: 0;
  color: #a6c1d6;
  font-size: 12px;
  line-height: 1.45;
}
#modal:has(#venueSlotForm) #closeModal {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border: 1px solid #3e607c;
  border-radius: 10px;
  background: #122e46;
  color: #e3f4ff;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}
#modal:has(#venueSlotForm) #closeModal:hover,
#modal:has(#venueSlotForm) #closeModal:focus-visible {
  background: #1a405f;
  border-color: #6ee7ff;
}

#modal #venueSlotForm {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: start;
  padding: 18px 24px 0;
}
#modal #venueSlotForm > * { min-width: 0; }
#modal #venueSlotForm .span2 { grid-column: 1 / -1; }
#modal #venueSlotForm .field { display: grid; gap: 6px; min-width: 0; }
#modal #venueSlotForm .field > label {
  display: block;
  color: #bfd5e9;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .008em;
  line-height: 1.35;
}
#modal #venueSlotForm .field > select,
#modal #venueSlotForm .field > input {
  width: 100%;
  min-width: 0;
  height: 43px;
  min-height: 43px;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.35;
  color: #eef8ff;
  border: 1px solid #355873;
  border-radius: 10px;
  background-color: #071927;
  box-shadow: inset 0 1px 1px rgba(0,0,0,.09);
}
#modal #venueSlotForm .field > select:hover,
#modal #venueSlotForm .field > input:hover { border-color: #5484a4; }
#modal #venueSlotForm .field > select:focus,
#modal #venueSlotForm .field > input:focus {
  outline: 2px solid rgba(110,231,255,.2);
  outline-offset: 1px;
  border-color: #6ee7ff;
}
#modal #venueSlotForm input[readonly] {
  background: #112d40;
  color: #e1f5ff;
  border-color: #33647f;
  cursor: default;
}
#modal #venueSlotForm input::placeholder { color: #7d9ab3; }
#modal #venueSlotForm .field > small {
  display: block;
  color: #9ab4ca;
  font-size: 10.5px;
  line-height: 1.5;
  margin: 0;
}

/* Read-only canonical partnership card. */
#modal #venueContextSummary {
  margin: 0 0 1px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #346d88;
  border-left: 3px solid #6ee7ff;
  background: linear-gradient(100deg, rgba(17,73,99,.43), rgba(14,43,68,.58));
  color: #d8ecf7;
  font-size: 12px;
  line-height: 1.55;
}
#modal #venueContextSummary b { font-weight: 850; color: #b8f1ff; }
#modal #venueContextSummary small { font-size: 10.5px; color: #b5cadb; }

/* Make venue selection visually prominent while retaining the original DOM. */
#modal #venueSlotForm #venueType {
  border-color: #4385a1;
  background-color: #102e43;
  font-weight: 700;
}
#modal #venueSlotForm #venueSchool { font-weight: 750; }
#modal #venueSlotForm #venueBuffer { max-width: 235px; font-variant-numeric: tabular-nums; }
#modal #venueInfo {
  margin: 0 0 1px;
  padding: 10px 13px;
  border: 1px solid #2a5067;
  border-radius: 10px;
  background: rgba(11, 37, 57, .72);
  color: #b4ccdc;
  font-size: 11px;
  line-height: 1.5;
}
#modal #venueSlotForm .planner-audit-inline { min-width: 0; }

/* Sticky actions are the only footer affected; legacy forms keep their own footer. */
#modal #venueSlotForm > .span2.row.between:last-child {
  position: sticky;
  bottom: 0;
  z-index: 7;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  margin: 5px -24px 0;
  padding: 12px 24px 14px;
  border-top: 1px solid #36526a;
  background: rgba(10, 28, 46, .98);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 -8px 20px rgba(0,0,0,.15);
}
#modal #venueSlotForm > .span2.row.between:last-child .actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
#modal #venueSlotForm #cancelModal,
#modal #venueSlotForm #venueSubmit {
  min-height: 39px;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
#modal #venueSlotForm #cancelModal { border: 1px solid #41607a; color: #d7e8f5; }
#modal #venueSlotForm #venueSubmit {
  background: linear-gradient(110deg, #6ee7ff 0%, #a78bfa 100%);
  color: #081826;
  min-width: 112px;
}
#modal #venueSlotForm #venueSubmit:disabled {
  opacity: .42;
  filter: grayscale(.5);
  cursor: not-allowed;
}
#modal #venueSlotForm #msg {
  color: #ffb8c3;
  line-height: 1.45;
  font-size: 11px;
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 700px) {
  #modal:has(#venueSlotForm) { padding: 8px; }
  #modal:has(#venueSlotForm) > .modal-card {
    width: 100%;
    max-height: calc(100dvh - 16px);
    border-radius: 16px;
  }
  #modal:has(#venueSlotForm) .modal-head { padding: 14px 15px 12px; gap: 10px; }
  #modal:has(#venueSlotForm) .modal-head h2 { font-size: 17px; }
  #modal #venueSlotForm { grid-template-columns: minmax(0,1fr); padding: 14px 15px 0; gap: 12px; }
  #modal #venueSlotForm .span2 { grid-column: 1; }
  #modal #venueSlotForm #venueBuffer { max-width: 100%; }
  #modal #venueSlotForm > .span2.row.between:last-child {
    margin-left: -15px;
    margin-right: -15px;
    padding: 11px 15px 13px;
  }
}
@media (max-width: 420px) {
  #modal:has(#venueSlotForm) .modal-head small { font-size: 9px; }
  #modal #venueSlotForm > .span2.row.between:last-child { gap: 7px; }
  #modal #venueSlotForm #cancelModal, #modal #venueSlotForm #venueSubmit { padding: 9px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  #modal:has(#venueSlotForm) *, #modal:has(#venueSlotForm) *::before, #modal:has(#venueSlotForm) *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
