/* ========================================
   PAGES-SCHEDULE.CSS
   ======================================== */


/* ===== HERO ===== */
.sch-hero {
  position: relative;
  height: 420px;
  overflow: hidden;
}

.sch-hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sch-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.55) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-3);
}

.sch-hero__label {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.15em;
  font-style: italic;
  margin: 0;
}

.sch-hero__title {
  font-family: var(--font-serif);
  font-size: var(--text-4xl);
  font-weight: var(--fw-bold);
  color: var(--color-white);
  margin: 0;
  line-height: var(--lh-tight);
}


/* ===== SEARCH SECTION ===== */
.sch-search-section {
  background: var(--color-white);
  border-bottom: var(--border);
  padding-block: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.sch-search {
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: var(--space-16);
}

.sch-search__form {
  display: flex;
  align-items: flex-end;
  gap: var(--space-4);
}

.sch-search__group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
}

.sch-search__label {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text);
  white-space: nowrap;
}

.sch-search__select {
  height: 46px;
  padding-inline: var(--space-4) 36px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background-color: var(--color-white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999999' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-lighter);
  cursor: pointer;
  outline: none;
  width: 100%;
  transition: border-color var(--transition-fast);
}

.sch-search__select:focus {
  border-color: var(--color-primary);
  color: var(--color-text);
}

.sch-search__sep {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text);
  white-space: nowrap;
  flex: 0 0 auto;
  padding-bottom: 13px; /* vertically center with 46px select */
}

/* Override .button base width */
.sch-search__btn {
  width: auto;
  height: 46px;
  flex: 0 0 auto;
  padding-inline: var(--space-10);
  white-space: nowrap;
}


/* ===== RESULTS SECTION ===== */
.sch-results-section {
  padding-block: var(--space-12) var(--space-20);
  background: var(--color-white);
}

.sch-wrap {
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: var(--space-16);
}


/* ===== TABLE (desktop / tablet) ===== */
.sch-table-wrap {
  overflow-x: auto;
}

.sch-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}

.sch-table thead th {
  background: var(--color-primary-Pale);
  color: var(--color-text);
  font-weight: var(--fw-semibold);
  text-align: left;
  padding: var(--space-4);
  white-space: nowrap;
  border-bottom: 2px solid var(--color-border);
  letter-spacing: 0.02em;
}

.sch-table tbody .sch-row {
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-fast);
  font-size: var(--text-md);
}

.sch-table tbody .sch-row:hover {
  background: rgba(201, 164, 91, 0.04);
}

.sch-table tbody td {
  padding: var(--space-5) var(--space-4);
  vertical-align: middle;
  color: var(--color-text);
}

/* Column widths */
.sch-col-date   { width: 120px; }
.sch-col-code   { width: 100px; }
.sch-col-name   { }
.sch-col-flight { width: 80px; }
.sch-col-price  { width: 110px; white-space: nowrap; }
.sch-col-status { width: 120px; }
.sch-col-note   { width: 220px; }

/* Center-align flight and status columns */
.sch-table td:nth-child(1) { white-space: nowrap; letter-spacing: 0.04em; }
.sch-table td:nth-child(4) { text-align: center; }
.sch-table td:nth-child(6) { text-align: center; }
.sch-table th:nth-child(4) { text-align: center; }
.sch-table th:nth-child(6) { text-align: center; }

.sch-note {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  line-height: var(--lh-normal);
}


/* ===== STATUS LABELS ===== */
.sch-status {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  padding: 12px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  letter-spacing: 0.04em;
  width: 96px;
  text-align: center;
}

.sch-status--available {
  background: var(--color-primary);
  color: var(--color-white);
}

.sch-status--closed {
  background: transparent;
  color: #8E8E93;
  border: 1px solid #8E8E93;

}

.sch-status--full {
  background: transparent;
  color: #BB9D5B;
  border: 1px solid #BB9D5B;
}


/* ===== TOGGLE CHEVRON BUTTON ===== */
.sch-toggle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--color-primary);
  background: transparent;
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.sch-toggle:hover {
  background: var(--color-primary);
  color: var(--color-white);
}

.sch-toggle svg {
  transition: transform var(--transition-base);
}

.sch-toggle.is-active svg {
  transform: rotate(180deg);
}


/* ===== FLIGHT INFO ROW (table) ===== */
.sch-flight-row {
  display: none;
}

.sch-flight-row.is-open {
  display: table-row;
}

.sch-flight-row > td {
  padding: var(--space-4) var(--space-6);
  background: #FCFCFC;
  border-bottom: 1px solid var(--color-border);
}

/* Flight info container */
.sch-flight {
  display: flex;
  align-items: stretch;
}

/* Each panel (去程 / 回程) */
.sch-flight__panel {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding-inline: var(--space-4);
}

/* Dashed vertical divider */
.sch-flight__divider {
  flex-shrink: 0;
  width: 0;
  border-left: 1px dashed var(--color-border);
  margin-block: var(--space-2);
}

/* Tag (去程 / 回程) – vertical writing */
.sch-flight__tag {
  writing-mode: vertical-rl;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: 4px;
  padding: var(--space-2) 5px;
  letter-spacing: 0.12em;
  flex-shrink: 0;
  align-self: center;
}

/* Legs container */
.sch-flight__legs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Single flight leg */
.sch-leg {
  display: flex;
  align-items: center;
}

/* Airport block */
.sch-leg__airport {
  display: flex;
  flex-direction: column;
  min-width: 70px;
}

.sch-leg__code {
  font-family: var(--font-sans);
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: var(--color-dark);
  line-height: 1;
  margin: 0;
}

.sch-leg__city {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--color-text-lighter);
  margin: 3px 0 0;
}

.sch-leg__time {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text);
  font-weight: var(--fw-medium);
  margin: 2px 0 0;
}

.sch-leg__time--primary {
  color: var(--color-primary);
}

/* Connector (flight# + arrow line) */
.sch-leg__connector {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding-inline: var(--space-3);
  min-width: 80px;
}

.sch-leg__flight-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.sch-leg__plane {
  font-size: 12px;
  color: var(--color-text-lighter);
  line-height: 1;
}

.sch-leg__num {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--color-text-lighter);
  letter-spacing: 0.04em;
}

/* Arrow line with arrowhead */
.sch-leg__arrow-line {
  display: flex;
  align-items: center;
}

.sch-leg__arrow-line::before {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.sch-leg__arrow-line::after {
  content: '';
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid rgba(17, 24, 39, 0.18);
}


/* ===== MOBILE CARDS ===== */
.sch-cards {
  display: none;
  flex-direction: column;
  gap: var(--space-4);
}

.sch-card {
  background: var(--color-white);
  /* border: 1px solid var(--color-border); */
  /* border-radius: var(--radius-md); */
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.sch-card__date {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-light);
  letter-spacing: 0.08em;
  margin: 0 0 var(--space-2);
}

.sch-card__title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  color: var(--color-dark);
  margin: 0 0 var(--space-3);
  line-height: var(--lh-tight);
  letter-spacing: 0.04em;
}

.sch-card__notes {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-light);
  line-height: var(--lh-normal);
  margin: 0 0 var(--space-4);
}

.sch-card__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.sch-card__price {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text);
}

.sch-card__price strong {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--color-dark);
  margin-left: 4px;
}

.sch-card__flight-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-light);
}

/* Card collapsible flight panel */
.sch-card__flight {
  display: none;
  margin: var(--space-4) calc(-1 * var(--space-5)) calc(-1 * var(--space-5));
  padding: var(--space-4) var(--space-5);
  background: #FCFCFC;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  overflow-x: auto;
}

.sch-card__flight.is-open {
  display: block;
}

/* In cards, panels stack vertically */
.sch-card__flight .sch-flight {
  flex-direction: column;
  gap: var(--space-4);
  min-width: 260px;
}

.sch-card__flight .sch-flight__panel {
  padding-inline: 0;
}

.sch-card__flight .sch-flight__divider {
  border-left: none;
  border-top: 1px dashed var(--color-border);
  width: 100%;
  height: 0;
  margin: 0;
}


/* ===== RESPONSIVE ===== */

/* Tablet */
@media (max-width: 1199px) {
  .sch-hero {
    height: 360px;
  }

  .sch-hero__title {
    font-size: var(--text-3xl);
  }

  .sch-search,
  .sch-wrap {
    padding-inline: var(--space-8);
  }

  .sch-flight__panel {
    padding-inline: var(--space-3);
    gap: var(--space-3);
  }
}

/* Mobile */
@media (max-width: 767px) {
  .sch-hero {
    height: 280px;
  }

  .sch-hero__title {
    font-size: var(--text-2xl);
  }

  .sch-search-section {
    padding-block: var(--space-5);
  }

  .sch-search,
  .sch-wrap {
    padding-inline: var(--space-4);
  }

  /* Stacked form layout */
  .sch-search__form {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .sch-search__sep {
    padding-bottom: 0;
    color: var(--color-text-light);
  }

  .sch-search__select {
    height: 48px;
  }

  .sch-search__btn {
    width: 100%;
    height: 48px;
    padding-inline: 0;
  }

  /* Hide table, show cards */
  .sch-table-wrap {
    display: none;
  }

  .sch-cards {
    display: flex;
  }

  .sch-results-section {
    padding-block: var(--space-8) var(--space-12);
  }
}


/* ===== DATE PICKER ===== */

/* Invisible spacer label keeps height consistent on desktop */
.sch-search__label--spacer {
  visibility: hidden;
  pointer-events: none;
}

/* Wrapper – position: relative for calendar popup */
.date-picker {
  position: relative;
  width: 100%;
}

/* Input field */
.date-picker__input {
  width: 100%;
  height: 46px;
  padding-inline: var(--space-4) 36px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background-color: var(--color-white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-lighter);
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
  transition: border-color var(--transition-fast);
  caret-color: transparent;
  user-select: none;
}

.date-picker__input:focus,
.date-picker__input.has-value {
  border-color: var(--color-primary);
  color: var(--color-text);
}

/* Calendar popup */
.date-picker__cal {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 100;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-5);
  min-width: 300px;
  width: max-content;
  box-sizing: border-box;
}

.date-picker__cal.is-open {
  display: block;
}

/* Header row */
.date-picker__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

/* Prev / Next nav buttons */
.date-picker__nav {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.date-picker__nav:hover {
  background: var(--color-primary-Pale);
  border-color: var(--color-primary);
}

/* Month / year label */
.date-picker__month-label {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: var(--fw-medium);
  color: var(--color-dark);
  letter-spacing: 0.05em;
}

/* Weekday header row */
.date-picker__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: var(--space-2);
}

.date-picker__weekday {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-primary);
  padding-block: var(--space-2);
}

/* Day cell grid */
.date-picker__days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.date-picker__day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text);
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  padding: 0;
}

.date-picker__day:hover:not(.is-empty) {
  background: var(--color-primary-Pale);
}

.date-picker__day.is-selected {
  background: var(--color-primary-Pale);
  border: 1.5px solid var(--color-primary-light);
  color: var(--color-dark);
  font-weight: var(--fw-semibold);
}

.date-picker__day.is-empty {
  cursor: default;
  pointer-events: none;
}

/* 過期日期：灰色不可選 */
.date-picker__day.is-disabled {
  color: #c4c4c4;
  cursor: not-allowed;
  pointer-events: none;
  background: transparent !important;
}

/* Mobile: full width calendar */
@media (max-width: 767px) {
  .date-picker__cal {
    min-width: unset;
    width: 100%;
  }

  .date-picker__input {
    height: 48px;
  }

  .sch-search__label--spacer {
    display: none;
  }
}

/* ───── Pagination ───── */
.sch-pagination {
  margin: 32px auto 8px;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  border-top: 1px solid rgba(0,0,0,0.08);
  font-family: 'Noto Sans TC', sans-serif;
}
.sch-pagination__info {
  font-size: 13px;
  color: #888;
  letter-spacing: 0.05em;
}
.sch-pagination__nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.sch-pagination__btn {
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid #d6d6d6;
  color: #333;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sch-pagination__btn:hover:not([disabled]):not(.is-active) {
  border-color: #C9A45B;
  color: #C9A45B;
}
.sch-pagination__btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}
.sch-pagination__btn.is-active {
  background: #C9A45B;
  border-color: #C9A45B;
  color: #fff;
  font-weight: 600;
  cursor: default;
}
.sch-pagination__ellipsis {
  padding: 0 6px;
  color: #999;
  font-size: 13px;
}
@media (max-width: 600px) {
  .sch-pagination__btn { min-width: 32px; height: 32px; padding: 0 8px; font-size: 12px; }
  .sch-pagination__info { font-size: 12px; }
}
