/* Elimu ERP — Timetable Stylesheet. Colours come from Elimu ERP Core's design tokens (--eerp-*), so the school's chosen colours apply automatically. */

.eerp-academic-dashboard,
.eerp-class-timetable-viewer,
.eerp-teacher-timetable-viewer {
  font-family: var(--eerp-font-body);
  color: var(--eerp-text);
  background-color: var(--eerp-neutral-50);
  border-radius: 12px;
  border: 1px solid var(--eerp-border);
  padding: 24px;
  box-sizing: border-box;
}

.eerp-timetable-header {
  margin-bottom: 20px;
}

.eerp-timetable-title {
  margin: 0 0 4px;
  font-family: var(--eerp-font-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--eerp-brand);
}

.eerp-timetable-desc {
  margin: 0;
  font-size: 14px;
  color: var(--eerp-text-muted);
}

/* Tabs */
.eerp-tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--eerp-border);
  margin-bottom: 18px;
}

.eerp-tab-btn {
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--eerp-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.eerp-tab-btn.active {
  color: var(--eerp-brand);
  border-bottom-color: var(--eerp-brand);
}

/* v1.0.1 fix: the theme's own button hover/focus styles (a solid coloured background)
   were out-ranking .eerp-tab-btn, leaving the blue tab text unreadable on a blue background.
   Scoped under the tab bar and hardcoded so the theme cannot override the tab look. */
.eerp-tab-bar .eerp-tab-btn,
.eerp-tab-bar .eerp-tab-btn:hover,
.eerp-tab-bar .eerp-tab-btn:focus,
.eerp-tab-bar .eerp-tab-btn:active {
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  border-top-color: transparent !important;
  border-left-color: transparent !important;
  border-right-color: transparent !important;
  border-bottom-color: transparent !important;
  color: var(--eerp-text-muted) !important;
}
.eerp-tab-bar .eerp-tab-btn:hover {
  color: var(--eerp-brand) !important;
}
.eerp-tab-bar .eerp-tab-btn.active,
.eerp-tab-bar .eerp-tab-btn.active:hover,
.eerp-tab-bar .eerp-tab-btn.active:focus,
.eerp-tab-bar .eerp-tab-btn.active:active {
  color: var(--eerp-brand) !important;
  border-bottom-color: var(--eerp-brand) !important;
}
.eerp-tab-bar .eerp-tab-btn:focus-visible {
  outline: 2px solid var(--eerp-brand);
  outline-offset: -2px;
}

.eerp-tab-panel {
  display: none;
}

.eerp-tab-panel.active {
  display: block;
}

/* Buttons */
.eerp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

/* Every state is set explicitly so the theme's own button hover and focus colours cannot override it. */
.eerp-btn.eerp-btn-primary,
.eerp-btn.eerp-btn-primary:hover,
.eerp-btn.eerp-btn-primary:focus,
.eerp-btn.eerp-btn-primary:active {
  color: var(--eerp-on-brand) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
.eerp-btn.eerp-btn-primary {
  background-color: var(--eerp-brand) !important;
}
.eerp-btn.eerp-btn-primary:hover,
.eerp-btn.eerp-btn-primary:focus,
.eerp-btn.eerp-btn-primary:active {
  background-color: var(--eerp-brand-hover) !important;
}

.eerp-btn.eerp-btn-secondary,
.eerp-btn.eerp-btn-secondary:hover,
.eerp-btn.eerp-btn-secondary:focus,
.eerp-btn.eerp-btn-secondary:active {
  color: var(--eerp-brand) !important;
  border-color: var(--eerp-neutral-300) !important;
  box-shadow: none !important;
}
.eerp-btn.eerp-btn-secondary {
  background-color: var(--eerp-surface) !important;
}
.eerp-btn.eerp-btn-secondary:hover,
.eerp-btn.eerp-btn-secondary:focus,
.eerp-btn.eerp-btn-secondary:active {
  background-color: var(--eerp-brand-soft) !important;
}

.eerp-btn.eerp-btn-danger,
.eerp-btn.eerp-btn-danger:hover,
.eerp-btn.eerp-btn-danger:focus,
.eerp-btn.eerp-btn-danger:active {
  color: var(--eerp-status-absent-text) !important;
  border-color: var(--eerp-status-absent-soft) !important;
  box-shadow: none !important;
}
.eerp-btn.eerp-btn-danger {
  background-color: var(--eerp-surface) !important;
}
.eerp-btn.eerp-btn-danger:hover,
.eerp-btn.eerp-btn-danger:focus,
.eerp-btn.eerp-btn-danger:active {
  background-color: var(--eerp-status-absent-soft) !important;
}

.eerp-btn:focus-visible {
  outline: 2px solid var(--eerp-brand);
  outline-offset: 2px;
}

.eerp-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.eerp-btn-sm { padding: 4px 10px; font-size: 12px; }

/* Forms */
.eerp-form-panel {
  border: 1px solid var(--eerp-border);
  border-radius: 8px;
  padding: 16px;
  background: var(--eerp-surface);
  margin-bottom: 18px;
}

.eerp-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 12px;
}

.eerp-form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 12px;
}

@media (max-width: 720px) {
  .eerp-form-row,
  .eerp-form-row-3 {
    grid-template-columns: 1fr;
  }
}

.eerp-form-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.eerp-form-group label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--eerp-neutral-700);
}

.eerp-input,
.eerp-select,
.eerp-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--eerp-neutral-300);
  border-radius: 6px;
  font-size: 13px;
  color: var(--eerp-text);
  background-color: var(--eerp-surface);
  box-sizing: border-box;
}

.eerp-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.eerp-checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.eerp-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* Alerts */
.eerp-alert-box {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.5;
}

.eerp-alert-success {
  background-color: var(--eerp-status-present-soft);
  border: 1px solid var(--eerp-border);
  color: var(--eerp-status-present-text);
}

.eerp-alert-error {
  background-color: var(--eerp-status-absent-soft);
  border: 1px solid var(--eerp-border);
  color: var(--eerp-status-absent-text);
}

/* Tables */
.eerp-table-responsive {
  overflow-x: auto;
  min-width: 0;
}

.eerp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
  min-width: 520px;
}

.eerp-table th {
  background: var(--eerp-neutral-50);
  padding: 8px 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--eerp-border);
  color: var(--eerp-neutral-600);
}

.eerp-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--eerp-neutral-100);
  vertical-align: middle;
}

/* Badges */
.eerp-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.eerp-badge-core { background: var(--eerp-status-present-soft); color: var(--eerp-status-present-text); }
.eerp-badge-elective { background: var(--eerp-brand-soft); color: var(--eerp-brand); }
.eerp-badge-pathway { background: var(--eerp-brand-accent-soft); color: var(--eerp-brand); }

/* Day-column timetable layout (used by both dashboard and viewer) */
.eerp-grid-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}
.eerp-grid-table th, .eerp-grid-table td {
  border: 1px solid var(--eerp-border);
  padding: 10px;
  text-align: center;
}
.eerp-grid-slot-card {
  background-color: var(--eerp-brand-soft);
  border: 1px solid var(--eerp-border);
  border-radius: 6px;
  padding: 8px;
  text-align: left;
  margin-bottom: 8px;
  font-size: 12px;
}

.eerp-day-columns {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
  min-width: 900px;
}

@media (max-width: 900px) {
  .eerp-day-columns {
    grid-template-columns: repeat(6, minmax(150px, 1fr));
  }
}

.eerp-day-column {
  min-width: 0;
  background: var(--eerp-surface);
  border: 1px solid var(--eerp-border);
  border-radius: 8px;
  padding: 10px;
}

.eerp-day-column-header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--eerp-neutral-600);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--eerp-border);
}

.eerp-slot-time {
  font-weight: 700;
  color: var(--eerp-brand);
}

.eerp-slot-subject {
  font-weight: 600;
  margin: 2px 0;
}

.eerp-slot-meta {
  color: var(--eerp-text-muted);
  font-size: 11px;
}

.eerp-slot-actions {
  margin-top: 6px;
  display: flex;
  gap: 6px;
}

.eerp-empty-state {
  color: var(--eerp-text-muted);
  font-size: 13px;
  padding: 20px;
  text-align: center;
}

.eerp-loading-state {
  color: var(--eerp-text-muted);
  font-size: 13px;
  padding: 16px;
}

@media print {
  body * { visibility: hidden; }
  .eerp-class-timetable-viewer, .eerp-class-timetable-viewer * { visibility: visible; }
  .eerp-class-timetable-viewer { position: absolute; left: 0; top: 0; width: 100%; border: none; }
  .eerp-day-columns { min-width: 0; grid-template-columns: repeat(6, 1fr); }
}
