/*
 * ShiftNevis schedule table polish v2
 * Desktop-first visual refinement for the editable Builder result table.
 * Pure presentation: no scheduling, persistence, or coverage logic.
 */

.schedule-form--interactive {
  --schedule-day-width: 48px;
  --schedule-holiday-head: #ffe7ea;
  --schedule-holiday-body: #fff5f6;
  --schedule-holiday-foot: #ffedef;
  --schedule-holiday-line: #efc4ca;
}

.schedule-form--interactive .table-wrap {
  border-color: #ddd6e8;
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(31, 23, 56, 0.07);
  scrollbar-width: thin;
  scrollbar-color: #cfc4df #f7f5fa;
}

.schedule-form--interactive .table-wrap::-webkit-scrollbar {
  height: 10px;
}

.schedule-form--interactive .table-wrap::-webkit-scrollbar-track {
  background: #f7f5fa;
}

.schedule-form--interactive .table-wrap::-webkit-scrollbar-thumb {
  border: 2px solid #f7f5fa;
  border-radius: 999px;
  background: #cfc4df;
}

.schedule-form--interactive .table-wrap::-webkit-scrollbar-thumb:hover {
  background: #b7a9cf;
}

.schedule-form--interactive th,
.schedule-form--interactive td {
  height: 36px;
}

.schedule-form--interactive thead th {
  height: 44px;
}

.schedule-form--interactive tbody tr {
  transition: background-color 0.14s ease;
}

.schedule-form--interactive tbody tr:hover td:not(.is-holiday) {
  background: #fcfbff;
}

.schedule-form--interactive tbody td:nth-child(n + 6):nth-last-child(n + 5),
.schedule-form--interactive tfoot td:nth-child(n + 6):nth-last-child(n + 5) {
  overflow: hidden;
}

/* Holiday columns read as one vertical band, not isolated gray cells. */
.schedule-form--interactive thead th.schedule-form__day.is-holiday {
  color: #9f1239;
  background: var(--schedule-holiday-head);
  border-inline-color: var(--schedule-holiday-line);
  box-shadow:
    inset 1px 0 0 rgba(190, 24, 93, 0.06),
    inset -1px 0 0 rgba(190, 24, 93, 0.06);
}

.schedule-form--interactive thead th.schedule-form__day.is-holiday .day-head small {
  color: #be5a68;
}

.schedule-form--interactive tbody td.is-holiday {
  background: var(--schedule-holiday-body);
  border-inline-color: var(--schedule-holiday-line);
}

.schedule-form--interactive tbody tr:hover td.is-holiday {
  background: #ffeff1;
}

/* Holiday tint stops at the final personnel row.
 * Coverage/summary rows keep their own semantic colors; red is reserved for
 * actual under-coverage via .coverage-assigned.is-under-covered.
 */
.schedule-form--interactive tfoot td.is-holiday {
  color: inherit;
  background: var(--schedule-footer-row-bg, #f3f4f6) !important;
  border-inline-color: var(--schedule-grid-color) !important;
}

/* The global select enhancer turns schedule selects into buttons.
 * Keep that good dropdown UX, but make its trigger fit a 48px schedule cell.
 */
.schedule-form--interactive .shift-cell {
  min-width: 0;
  min-height: 30px;
  display: grid;
  place-items: center;
  position: relative;
}

.schedule-form--interactive .shift-cell > .sn-select-trigger {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 30px;
  height: 30px;
  padding: 0 12px;
  overflow: hidden;
  justify-content: center;
  gap: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #211a31;
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  box-shadow: none;
  transition:
    border-color 0.14s ease,
    background-color 0.14s ease,
    box-shadow 0.14s ease,
    color 0.14s ease;
}

.schedule-form--interactive .shift-cell > .sn-select-trigger .sn-select-label {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
  line-height: 1;
}

.schedule-form--interactive .shift-cell > .sn-select-trigger .sn-select-chevron {
  position: absolute;
  inset-inline-end: 2px;
  top: 50%;
  width: 11px;
  height: 11px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: transparent;
  color: #7c3aed;
  font-size: 10px;
  font-weight: 950;
  line-height: 1;
  opacity: 0.08;
  transform: translateY(-50%);
  transition:
    opacity 0.14s ease,
    transform 0.16s ease,
    background-color 0.16s ease,
    color 0.16s ease;
}

.schedule-form--interactive .shift-cell > .sn-select-trigger:hover,
.schedule-form--interactive .shift-cell > .sn-select-trigger:focus,
.schedule-form--interactive .shift-cell > .sn-select-trigger[aria-expanded="true"] {
  border-color: #cdbcf3;
  background: rgba(255, 255, 255, 0.9);
  color: #4c1d95;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.07);
}

.schedule-form--interactive .shift-cell > .sn-select-trigger:hover .sn-select-chevron,
.schedule-form--interactive .shift-cell > .sn-select-trigger:focus .sn-select-chevron,
.schedule-form--interactive .shift-cell > .sn-select-trigger[aria-expanded="true"] .sn-select-chevron {
  opacity: 1;
}

.schedule-form--interactive .shift-cell > .sn-select-trigger[aria-expanded="true"] .sn-select-chevron {
  background: #7c3aed;
  color: #fff;
  transform: translateY(-50%) rotate(180deg);
}

.schedule-form--interactive td.is-holiday .shift-cell > .sn-select-trigger {
  background: rgba(255, 255, 255, 0.24);
}

.schedule-form--interactive td.is-holiday .shift-cell > .sn-select-trigger:hover,
.schedule-form--interactive td.is-holiday .shift-cell > .sn-select-trigger:focus,
.schedule-form--interactive td.is-holiday .shift-cell > .sn-select-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.82);
}

/* Manual-edit pencil becomes a deliberate affordance instead of permanent clutter. */
.schedule-form--interactive .schedule-edit-icon {
  inset-inline-start: 2px;
  top: 2px;
  width: 12px;
  height: 12px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: #fff;
  color: #7c3aed;
  font-size: 6.5px;
  opacity: 0;
  box-shadow: 0 1px 4px rgba(76, 29, 149, 0.14);
  transform: scale(0.92);
  transition:
    opacity 0.14s ease,
    transform 0.14s ease;
}

.schedule-form--interactive .shift-cell:hover .schedule-edit-icon,
.schedule-form--interactive .shift-cell:focus-within .schedule-edit-icon {
  opacity: 0.95;
  transform: scale(1);
}

.schedule-form--interactive .shift-explain {
  inset-inline-end: 2px;
  top: 17px;
  width: 11px;
  height: 11px;
  border: 1px solid #ddd3ef;
  background: rgba(255, 255, 255, 0.95);
  font-size: 6px;
  opacity: 0.62;
}

.schedule-form--interactive .shift-explain:hover,
.schedule-form--interactive .shift-explain:focus-visible {
  opacity: 1;
  border-color: #bca6e7;
  background: #fff;
}

/* Keep off cells quiet while preserving holiday tint. */
.schedule-form--interactive td.is-off-cell:not(.is-holiday) {
  background: #fbfbfd;
}

.schedule-form--interactive .schedule-select.is-off + .sn-select-trigger {
  color: #8f879b;
}

.schedule-form--interactive .schedule-select.is-manual + .sn-select-trigger {
  border-color: #d8caf4;
  background: #faf7ff;
}

/* Compact responsive widths: still roomy enough to prevent adjacent overlap. */
@media (max-width: 1024px) {
  .schedule-form--interactive {
    --schedule-day-width: 44px;
  }

  .schedule-form--interactive .shift-cell > .sn-select-trigger {
    padding-inline: 11px;
    font-size: 10px;
  }
}

@media (max-width: 760px) {
  .schedule-form--interactive {
    --schedule-day-width: 40px;
  }

  .schedule-form--interactive th,
  .schedule-form--interactive td {
    height: 42px;
  }

  .schedule-form--interactive .shift-cell {
    min-height: 40px;
  }

  .schedule-form--interactive .shift-cell > .sn-select-trigger {
    min-height: 40px;
    height: 40px;
    padding-inline: 10px;
    border-radius: 7px;
    font-size: 10px;
  }

  .schedule-form--interactive .shift-cell > .sn-select-trigger .sn-select-chevron {
    opacity: 0.55;
  }

  .schedule-form--interactive .schedule-edit-icon {
    display: none;
  }
}
