/* ═══════════════════════════════════════════════════
   Schedule Page — SaaS-Quality Stylesheet
   ═══════════════════════════════════════════════════ */

/* ─── Filter Bar ─────────────────────────────────── */
.sch-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.sch-filter-select {
  padding: 7px 36px 7px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .8125rem;
  color: var(--text-primary);
  background: var(--card-bg) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") no-repeat left 10px center / 12px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: all .15s ease;
  outline: none;
  font-family: inherit;
  min-width: 140px;
}

.sch-filter-select:hover {
  border-color: #cbd5e1;
}

.sch-filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

/* ─── Table ──────────────────────────────────────── */
.sch-table { border-collapse: collapse; }

.sch-table thead th {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 10px 16px;
  white-space: nowrap;
  border: none;
  background: var(--border-light);
  border-bottom: 1px solid var(--border);
}

.sch-table .th-sch-identity { min-width: 280px; }
.sch-table .th-sch-actions  { width: 100px; text-align: center; }

.sch-table tbody tr.sch-row {
  border-bottom: 1px solid var(--border-light);
  transition: background .15s ease;
}

.sch-table tbody tr.sch-row:last-child { border-bottom: none; }

.sch-table tbody tr.sch-row:hover {
  background: rgba(37, 99, 235, .02);
}

.sch-table tbody td {
  padding: 12px 16px;
  font-size: .8125rem;
  vertical-align: middle;
  border: none;
  color: var(--text-primary);
}

/* ─── Lecture Identity Cell ──────────────────────── */
.sch-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sch-identity-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.0625rem;
  flex-shrink: 0;
}

.sch-type-lecture .sch-identity-icon { background: #eff6ff; color: #2563eb; }
.sch-type-lab .sch-identity-icon     { background: #f0fdf4; color: #16a34a; }
.sch-type-section .sch-identity-icon { background: #fefce8; color: #ca8a04; }

.sch-identity-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sch-subject-name {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
  line-height: 1.4;
}

.sch-subject-meta {
  font-size: .75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  line-height: 1.4;
}

.sch-meta-dot {
  margin: 0 5px;
  color: var(--border);
}

.sch-type-label {
  font-weight: 500;
}

.sch-type-label.t-lecture { color: #2563eb; }
.sch-type-label.t-lab     { color: #16a34a; }
.sch-type-label.t-section { color: #ca8a04; }

/* ─── Schedule Cell ──────────────────────────────── */
.sch-schedule-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sch-day-text {
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-primary);
}

.sch-time-text {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── Location Cell ──────────────────────────────── */
.sch-location-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sch-room-text {
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-primary);
}

.sch-prof-text {
  font-size: .75rem;
  color: var(--text-muted);
}

/* ─── Semester Cell ──────────────────────────────── */
.sch-semester-text {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── Actions ────────────────────────────────────── */
.td-sch-actions { text-align: center; }

.sch-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.sch-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: .875rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
  padding: 0;
}

.sch-action-edit:hover {
  background: #eff6ff;
  color: #2563eb;
  border-color: rgba(37, 99, 235, .12);
}

.sch-action-delete:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: rgba(239, 68, 68, .12);
}

/* ─── Empty State ────────────────────────────────── */
.sch-empty-state {
  text-align: center;
  padding: 64px 24px;
}

.sch-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, #eff6ff, #e0e7ff);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 1.75rem;
  color: var(--accent);
}

.sch-empty-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.sch-empty-subtitle {
  font-size: .875rem;
  color: var(--text-muted);
  margin: 0 0 24px;
  line-height: 1.5;
}

.sch-empty-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: .8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s ease;
  border: none;
  cursor: pointer;
}

.sch-empty-cta:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .25);
}

/* ═══════════════════════════════════════════════════
   Modal
   ═══════════════════════════════════════════════════ */

.sch-modal-dialog {
  max-width: 680px;
}

.sch-modal-content {
  border: none;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .15), 0 4px 16px rgba(0, 0, 0, .08);
}

/* ─── Header ─────────────────────────────────────── */
.sch-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 28px 0;
  gap: 12px;
}

.sch-modal-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sch-modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
}

.sch-modal-subtitle {
  font-size: .8125rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.sch-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: .875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
  flex-shrink: 0;
  padding: 0;
}

.sch-modal-close:hover {
  background: var(--border-light);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* ─── Body ───────────────────────────────────────── */
.sch-modal-body {
  padding: 20px 28px 4px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ─── Field Sections ─────────────────────────────── */
.sch-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--border-light);
}

.sch-section:last-child {
  border-bottom: none;
  padding-bottom: 8px;
}

.sch-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.sch-section-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8125rem;
  color: var(--text-secondary);
}

.sch-section-label {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .01em;
}

.sch-section-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ─── Field Groups ───────────────────────────────── */
.sch-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sch-field-row {
  display: flex;
  gap: 14px;
}

.sch-field-half {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sch-label {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.sch-required {
  color: #dc2626;
  font-weight: 500;
}

.sch-optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: .75rem;
}

/* ─── Inputs ─────────────────────────────────────── */
.sch-input {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  color: var(--text-primary);
  background: var(--card-bg);
  transition: all .15s ease;
  outline: none;
  font-family: inherit;
}

.sch-input::placeholder {
  color: var(--text-muted);
}

.sch-input:hover {
  border-color: #cbd5e1;
}

.sch-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

/* ─── Selects ────────────────────────────────────── */
.sch-select {
  width: 100%;
  padding: 9px 36px 9px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  color: var(--text-primary);
  background: var(--card-bg) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") no-repeat left 12px center / 12px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: all .15s ease;
  outline: none;
  font-family: inherit;
}

.sch-select:hover {
  border-color: #cbd5e1;
}

.sch-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

/* ─── Compound Term Field ────────────────────────── */
.sch-compound-field {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: all .15s ease;
}

.sch-compound-field:hover {
  border-color: #cbd5e1;
}

.sch-compound-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.sch-compound-field .sch-select {
  border: none;
  border-radius: 0;
  box-shadow: none !important;
}

.sch-compound-field .sch-select:hover {
  border: none;
}

.sch-compound-field .sch-select:focus {
  box-shadow: none !important;
}

.sch-compound-major {
  flex: 3;
  border-left: 1px solid var(--border);
}

.sch-compound-minor {
  flex: 2;
}

/* ─── Footer ─────────────────────────────────────── */
.sch-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 28px 24px;
}

.sch-btn-cancel {
  padding: 9px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
}

.sch-btn-cancel:hover {
  background: var(--border-light);
  color: var(--text-primary);
  border-color: #cbd5e1;
}

.sch-btn-save {
  padding: 9px 24px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.sch-btn-save:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .25);
}

.sch-btn-save:active {
  transform: translateY(0);
  box-shadow: none;
}

.sch-btn-save:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ─── Modal Animation ────────────────────────────── */
#scheduleModal .modal-dialog {
  transition: transform .25s cubic-bezier(.34, 1.4, .64, 1), opacity .2s ease;
}

#scheduleModal.fade .modal-dialog {
  transform: scale(.95) translateY(12px);
  opacity: 0;
}

#scheduleModal.show .modal-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  .sch-modal-dialog {
    max-width: calc(100% - 24px);
    margin: 12px;
  }

  .sch-modal-header,
  .sch-modal-body,
  .sch-modal-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .sch-field-row {
    flex-direction: column;
    gap: 16px;
  }

  .sch-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .sch-filter-select {
    min-width: 100%;
  }

  .sch-subject-name { max-width: 180px; }
  .sch-table .th-sch-identity { min-width: 220px; }
}
