/* 排班管理 - 符合 UI-DESIGN-SPEC */
:root {
  --primary: #1890FF;
  --primary-alt: #0066CC;
  --bg-global: #F0F2F5;
  --bg-card: #FFFFFF;
  --color-success: #52C41A;
  --color-warning: #FAAD14;
  --color-danger: #FF4D4F;
  --text-title: #262626;
  --text-body: #595959;
  --text-muted: #8C8C8C;
  --border: #E8E8E8;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --radius: 8px;
}

.schedule-page { max-width: 1440px; margin: 0 auto; padding: var(--spacing-lg); font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }
.schedule-page .page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--spacing-lg); }
.schedule-page .page-title { font-size: 20px; font-weight: 600; color: var(--text-title); margin: 0; }
.schedule-page .breadcrumb { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.schedule-page .breadcrumb a { color: var(--text-muted); text-decoration: none; }
.schedule-page .breadcrumb a:hover { color: var(--primary); }

.schedule-toolbar {
  display: flex; flex-wrap: wrap; gap: var(--spacing-sm); align-items: center;
  padding: var(--spacing-md); background: var(--bg-card); border-radius: var(--radius);
  margin-bottom: var(--spacing-md); box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.schedule-toolbar .view-toggle { display: flex; background: var(--bg-global); border-radius: var(--radius); padding: 2px; }
.schedule-toolbar .view-toggle .tab {
  padding: 6px 16px; border: none; background: transparent; cursor: pointer;
  font-size: 14px; color: var(--text-body); border-radius: 6px; transition: all .2s;
}
.schedule-toolbar .view-toggle .tab.active { background: var(--bg-card); color: var(--primary); font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.schedule-toolbar .spacer { flex: 1; min-width: 16px; }
.schedule-toolbar .filter-select { min-width: 140px; padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }
.schedule-toolbar .btn { padding: 6px 16px; border-radius: var(--radius); border: none; cursor: pointer; font-size: 14px; }
.schedule-toolbar .btn-primary { background: var(--primary); color: #fff; }
.schedule-toolbar .btn-primary:hover { background: var(--primary-alt); }
.schedule-toolbar .btn-ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.schedule-toolbar .btn-ghost:hover { background: rgba(24,144,255,.08); }
.schedule-toolbar .btn-warning { background: #fff; color: var(--color-danger); border: 1px solid var(--color-danger); }
.schedule-toolbar .btn-warning:hover { background: rgba(255,77,79,.08); }

.btn-warning { background: #fff; color: var(--color-danger); border: 1px solid var(--color-danger); }
.btn-warning:hover { background: rgba(255,77,79,.08); }

.form-warning { padding: 12px; background: #fff7e6; border: 1px solid #ffd591; border-radius: var(--radius); color: #d46b08; font-size: 13px; }
.date-range-picker, .time-range-picker { display: flex; align-items: center; gap: var(--spacing-sm); }
.date-range-picker input, .time-range-picker input { flex: 1; }

.schedule-card {
  background: var(--bg-card); border-radius: var(--radius); padding: var(--spacing-lg);
  box-shadow: 0 1px 2px rgba(0,0,0,.05); margin-bottom: var(--spacing-lg);
}
.schedule-card .card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--spacing-md); }
.schedule-card .card-title { font-size: 16px; font-weight: 500; color: var(--text-title); }
.schedule-card .week-nav { display: flex; align-items: center; gap: var(--spacing-sm); }
.schedule-card .week-nav button { padding: 4px 12px; border: 1px solid var(--border); background: #fff; border-radius: var(--radius); cursor: pointer; font-size: 14px; }
.schedule-card .week-nav button:hover { border-color: var(--primary); color: var(--primary); }
.schedule-card .week-nav span { min-width: 140px; text-align: center; font-weight: 500; color: var(--text-body); }
.schedule-card .week-nav .week-date-picker {
  padding: 4px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; background: #fff;
}

/* 矩阵表 */
.matrix-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.matrix-table th, .matrix-table td { border: 1px solid var(--border); padding: var(--spacing-sm); text-align: center; }
.matrix-table th { background: var(--bg-global); color: var(--text-muted); font-weight: 500; }
.matrix-table th.doctor-col { min-width: 100px; text-align: left; padding-left: 12px; }
.matrix-table .cell-slot {
  min-width: 60px; height: 36px; cursor: pointer; border-radius: 4px;
  transition: background .2s; color: var(--text-body);
}
.matrix-table .cell-slot:hover { background: rgba(24,144,255,.1); }
.matrix-table .cell-slot.has-schedule { background: rgba(82,196,26,.15); color: var(--color-success); font-size: 12px; }
.matrix-table .cell-slot.empty { color: var(--text-muted); font-size: 12px; }
.matrix-table .cell-slot.expired {
  background: #f5f5f5; color: var(--text-muted); cursor: not-allowed; opacity: 0.7;
}
.matrix-table .cell-slot.expired:hover { background: #f5f5f5; }
.matrix-table .cell-slot.past-empty {
  background: #fafafa; color: var(--text-muted); opacity: 0.85;
}
.matrix-table .cell-slot.past-empty:hover { background: #f5f5f5; }
.matrix-table .day-col { min-width: 140px; }
.matrix-table .day-col .day-label { font-weight: 500; color: var(--text-body); display: block; margin-bottom: 4px; }
.matrix-table .day-col .period-row { display: flex; }
.matrix-table .day-col .period { flex: 1; font-size: 11px; color: var(--text-muted); }
.matrix-table .day-cell { padding: 4px !important; vertical-align: top; }
.matrix-table .day-slots { display: flex; flex-direction: column; gap: 2px; }
.matrix-table .day-slots .cell-slot { min-height: 28px; font-size: 11px; display: flex; align-items: center; justify-content: center; }

/* 日历视图 */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); }
.calendar-grid .cal-header { padding: var(--spacing-sm); text-align: center; font-size: 12px; font-weight: 500; color: var(--text-muted); background: var(--bg-global); }
.calendar-grid .cal-day {
  min-height: 80px; padding: var(--spacing-sm); background: var(--bg-card); cursor: pointer;
  transition: background .2s;
}
.calendar-grid .cal-day:hover { background: rgba(24,144,255,.08); }
.calendar-grid .cal-day.other-month { background: #FAFAFA; color: var(--text-muted); }
.calendar-grid .cal-day .day-num { font-size: 14px; font-weight: 500; color: var(--text-body); margin-bottom: 4px; }
.calendar-grid .cal-day .doctor-count {
  font-size: 12px; color: var(--primary); font-weight: 500;
}
.calendar-grid .cal-day.other-month .doctor-count { color: var(--text-muted); }

/* 加载/空状态 */
.schedule-loading, .schedule-empty {
  padding: var(--spacing-xl); text-align: center; color: var(--text-muted);
}
.schedule-empty .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: .5; }
.schedule-empty .empty-text { margin-bottom: 16px; }
.schedule-empty .btn { margin-top: 8px; }

/* 日详情抽屉 */
.day-detail { padding: var(--spacing-md); }
.day-detail h3 { margin: 0 0 var(--spacing-md); font-size: 16px; color: var(--text-title); }
.day-detail .detail-list { font-size: 14px; }
.day-detail .detail-item { padding: var(--spacing-sm) 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; }
.day-detail .detail-item:last-child { border-bottom: none; }
.day-detail .badge { padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.day-detail .badge-success { background: rgba(82,196,26,.15); color: var(--color-success); }

/* Toast 提示 */
.schedule-toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-20px);
  padding: 10px 24px; border-radius: var(--radius); font-size: 14px; font-weight: 500;
  z-index: 10000; opacity: 0; transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.schedule-toast.schedule-toast-visible {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.schedule-toast-warning {
  background: #fff7e6; color: #d46b08; border: 1px solid #ffd591;
}
.schedule-toast-success {
  background: #f6ffed; color: var(--color-success); border: 1px solid #b7eb8f;
}
.doctor-search-input { margin-bottom: 8px; }

/* 排班类型切换 */
.slot-type-toggle {
  display: flex; gap: 0; background: var(--bg-global); border-radius: var(--radius); padding: 2px;
}
.slot-type-option {
  flex: 1; text-align: center; padding: 8px 16px; cursor: pointer; border-radius: 6px;
  font-size: 14px; transition: all .2s;
}
.slot-type-option input { display: none; }
.slot-type-option:has(input:checked) {
  background: var(--bg-card); color: var(--primary); font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

/* 排班类型标签 */
.schedule-tag {
  font-size: 10px; padding: 1px 4px; border-radius: 3px; margin-right: 4px;
}
.schedule-tag-outpatient {
  background: rgba(24,144,255,.2); color: var(--primary); border-left: 2px solid var(--primary);
}
.schedule-tag-remote {
  background: rgba(114,46,209,.15); color: #722ed1; border-left: 2px solid #722ed1;
}
.matrix-table .cell-slot.has-schedule.remote-tag {
  background: rgba(114,46,209,.08);
}
