/* Season Settings — comfortable schedule editor layout.
   Loaded after the app styles so it can override the older compact table rules. */

/* Enrollment opens is edited from the Season tab only. Hide the duplicated
   field from Setting so there is a single visible source of truth. */
.class-setting-panel .field:has(input[name="fecha_inscripcion"]) {
  display: none !important;
}

.class-setting-panel .season-events-table-wrap {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.class-setting-panel .season-events-table {
  width: 100%;
  min-width: 1420px;
  font-size: 0.9rem;
}

.class-setting-panel .season-events-table th,
.class-setting-panel .season-events-table td {
  padding: 1px 9px !important;
  vertical-align: middle;
}

/* Compact the actual controls, not only the table rows. */
.class-setting-panel .season-events-table input,
.class-setting-panel .season-events-table select,
.class-setting-panel .season-events-table .season-place-control input,
.class-setting-panel .season-events-table .season-location-inline input {
  box-sizing: border-box;
  min-height: 34px !important;
  height: 34px !important;
  padding: 0 9px !important;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.1 !important;
}

/* Keep the Season schedule actions compact: both buttons share one centered row. */
.class-setting-panel .season-events-heading {
  display: grid !important;
  grid-template-columns: 1fr !important;
  align-items: start !important;
  gap: 14px !important;
}

.class-setting-panel .season-events-actions {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 12px !important;
  width: 100%;
}

.class-setting-panel .season-events-actions button {
  width: auto !important;
  min-width: 220px;
  margin: 0 !important;
}

/* Date */
.class-setting-panel .season-events-table th:nth-child(1),
.class-setting-panel .season-events-table td:nth-child(1) {
  min-width: 190px;
}

/* Time */
.class-setting-panel .season-events-table th:nth-child(2),
.class-setting-panel .season-events-table td:nth-child(2) {
  min-width: 130px;
}

/* Event name */
.class-setting-panel .season-events-table th:nth-child(3),
.class-setting-panel .season-events-table td:nth-child(3) {
  min-width: 190px;
}

/* Modality */
.class-setting-panel .season-events-table th:nth-child(4),
.class-setting-panel .season-events-table td:nth-child(4) {
  min-width: 145px;
}

/* Address / location */
.class-setting-panel .season-events-table th:nth-child(5),
.class-setting-panel .season-events-table td:nth-child(5),
.class-setting-panel .season-events-table .season-location-cell {
  min-width: 330px;
}

/* Duration */
.class-setting-panel .season-events-table th:nth-child(6),
.class-setting-panel .season-events-table td:nth-child(6) {
  min-width: 135px;
}

.class-setting-panel .season-events-table td:nth-child(6) input {
  min-width: 78px;
}

/* Notes */
.class-setting-panel .season-events-table th:nth-child(7),
.class-setting-panel .season-events-table td:nth-child(7),
.class-setting-panel .season-events-table .season-notes-cell {
  min-width: 240px;
}

.class-setting-panel .season-events-table .season-notes-cell textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 220px;
  min-height: 34px !important;
  height: 34px !important;
  padding: 6px 9px !important;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.1 !important;
  resize: vertical;
  overflow-y: auto;
}

/* Season People — compact AppTable-style rows for Teachers and Students. */
.class-people-panel .class-student-list {
  width: 100%;
  margin-top: 10px;
  display: table !important;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #d9e4df;
  border-radius: 12px;
  overflow: hidden;
  background: #fffdf9;
}

.class-people-panel .class-student-row {
  min-height: 0 !important;
  padding: 0 !important;
  display: table-row !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

.class-people-panel .class-student-row > * {
  display: table-cell;
  padding: 7px 12px;
  vertical-align: middle;
  border-bottom: 1px solid #e6ece8;
  white-space: nowrap;
}

.class-people-panel .class-student-row:last-child > * {
  border-bottom: 0;
}

.class-people-panel .class-student-row .user-name-cell {
  width: 42%;
  display: table-cell !important;
}

.class-people-panel .class-student-row .user-name-cell .avatar {
  width: 30px;
  height: 30px;
  margin-right: 9px;
  display: inline-grid;
  vertical-align: middle;
  place-items: center;
  font-size: 0.7rem;
}

.class-people-panel .class-student-row .user-name-cell > span:last-child {
  display: inline-flex !important;
  max-width: calc(100% - 44px);
  align-items: center;
  gap: 10px;
  vertical-align: middle;
  overflow: hidden;
}

.class-people-panel .class-student-row .user-name-cell strong,
.class-people-panel .class-student-row .user-name-cell small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.class-people-panel .class-student-row .user-name-cell small {
  color: var(--muted);
}

.class-people-panel .class-student-row .finance-status {
  width: 15%;
  text-align: center;
  color: var(--text);
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  font-size: 0.88rem;
  font-weight: 500;
}

.class-people-panel .class-student-row > button {
  width: auto;
  min-height: 32px !important;
  padding: 0 12px !important;
  margin: 0;
  white-space: nowrap;
  border-radius: 8px;
}

.class-people-panel .class-student-row .student-membership-dates {
  width: 27%;
  display: table-cell !important;
  text-align: right;
  white-space: nowrap;
}

.class-people-panel .student-membership-dates span {
  display: inline;
}

.class-people-panel .student-membership-dates span + span::before {
  content: " · ";
  margin: 0 5px;
  color: var(--muted);
}

/* Teacher search stays visually empty until the user starts a search.
   The assigned-teacher table below remains visible at all times. */
.class-students-panel[aria-label="Teachers"]
  .student-search-box:has(input[type="search"]:placeholder-shown)
  .student-search-results,
.class-students-panel[aria-label="Teachers"]
  .student-search-box:has(input[type="search"]:placeholder-shown)
  .member-search-empty {
  display: none !important;
}

/* Search results use the same compact, single-line rhythm as the member table. */
.class-people-panel .student-search-results {
  margin-top: 8px;
  display: grid;
  gap: 4px;
}

.class-people-panel .student-search-result {
  min-height: 40px !important;
  padding: 4px 9px !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  border-radius: 9px !important;
}

.class-people-panel .student-search-result > input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0 2px 0 0;
  flex: 0 0 auto;
}

.class-people-panel .student-search-result .user-name-cell {
  min-width: 0;
  flex: 1 1 auto;
  display: flex !important;
  align-items: center;
  gap: 9px;
}

.class-people-panel .student-search-result .avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  font-size: 0.7rem;
}

.class-people-panel .student-search-result .user-name-cell > span:last-child {
  min-width: 0;
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  white-space: nowrap;
}

.class-people-panel .student-search-result .user-name-cell strong,
.class-people-panel .student-search-result .user-name-cell small {
  display: inline !important;
  margin: 0 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.class-people-panel .student-search-result .user-name-cell small {
  color: var(--muted);
}

.class-people-panel .student-search-result > button {
  min-height: 32px !important;
  height: 32px;
  padding: 0 12px !important;
  margin: 0;
  flex: 0 0 auto;
}

/* Student bulk actions: keep both billing choices compact and on one line. */
.class-students-panel[aria-label="Students"] .student-search-box > .student-search-row:nth-of-type(2) {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: nowrap !important;
}

.class-students-panel[aria-label="Students"] .student-search-box > .student-search-row:nth-of-type(2) .classes-active-filter {
  margin-right: auto;
  min-width: 0;
  flex: 1 1 auto;
}

.class-students-panel[aria-label="Students"] .student-search-box > .student-search-row:nth-of-type(2) button {
  width: auto !important;
  min-width: 0 !important;
  min-height: 34px !important;
  height: 34px !important;
  padding: 0 12px !important;
  margin: 0 !important;
  flex: 0 0 auto !important;
  white-space: nowrap;
  font-size: 0.84rem;
}

/* Season tab — restore the intended field order regardless of source order. */
.class-modal form.class-form:not(.setting-form) {
  display: flex !important;
  flex-direction: column !important;
}

.class-modal form.class-form:not(.setting-form) > .field:has(input[name="nombre"]) {
  order: 1;
}

.class-modal form.class-form:not(.setting-form) > .field:has(input[name="fecha_inscripcion"]) {
  order: 2;
}

.class-modal form.class-form:not(.setting-form) > .form-grid.two-columns {
  order: 3;
}

.class-modal form.class-form:not(.setting-form) > .field:has(textarea[name="descripcion"]) {
  order: 4;
}

.class-modal form.class-form:not(.setting-form) > .toggle-row {
  order: 5;
}

.class-modal form.class-form:not(.setting-form) > .login-error {
  order: 6;
}

.class-modal form.class-form:not(.setting-form) > .modal-actions {
  order: 7;
}

@media (max-width: 900px) {
  .class-people-panel .class-student-list {
    display: block !important;
    overflow-x: auto;
    min-width: 0;
  }

  .class-people-panel .class-student-row {
    display: grid !important;
    grid-template-columns: minmax(300px, 1fr) auto auto minmax(230px, auto);
    min-width: 760px;
    align-items: center;
    border-bottom: 1px solid #e6ece8 !important;
  }

  .class-people-panel .class-student-row:last-child {
    border-bottom: 0 !important;
  }

  .class-people-panel .class-student-row > *,
  .class-people-panel .class-student-row .user-name-cell,
  .class-people-panel .class-student-row .student-membership-dates {
    width: auto;
    display: block !important;
    border-bottom: 0;
  }

  .class-students-panel[aria-label="Students"] .student-search-box > .student-search-row:nth-of-type(2) {
    overflow-x: auto;
  }
}

@media (max-width: 760px) {
  .class-setting-panel .season-events-actions {
    flex-wrap: nowrap !important;
    gap: 8px !important;
  }

  .class-setting-panel .season-events-actions button {
    min-width: 0;
    flex: 1 1 0;
  }

  .class-setting-panel .season-events-table {
    min-width: 1320px;
    font-size: 0.84rem;
  }

  .class-setting-panel .season-events-table th,
  .class-setting-panel .season-events-table td {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  .class-setting-panel .season-events-table input,
  .class-setting-panel .season-events-table select,
  .class-setting-panel .season-events-table .season-place-control input,
  .class-setting-panel .season-events-table .season-location-inline input,
  .class-setting-panel .season-events-table .season-notes-cell textarea {
    min-height: 32px !important;
    height: 32px !important;
    font-size: 0.84rem;
  }

  .class-setting-panel .season-events-table .season-notes-cell textarea {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
  }

  .class-setting-panel .season-events-table th:nth-child(3),
  .class-setting-panel .season-events-table td:nth-child(3) {
    min-width: 175px;
  }

  .class-setting-panel .season-events-table th:nth-child(4),
  .class-setting-panel .season-events-table td:nth-child(4) {
    min-width: 135px;
  }

  .class-setting-panel .season-events-table th:nth-child(5),
  .class-setting-panel .season-events-table td:nth-child(5),
  .class-setting-panel .season-events-table .season-location-cell {
    min-width: 300px;
  }
}
