/*=============================================
  Root Color Variables (Purple Palette)
=============================================*/
:root {
  --bg-page:        #f6f7fa;   /* main background between sections */
  --bg-panel:       #ffffff;   /* filter & generator sections */
  --accent-purple:  #8B5CF6;
  --header-purple:  #2b3173;
  --table-header-bg:#5662e6;   /* NEW: table header background */
  --text-light:     #ffffff;
  --text-dark:      #1F2937;
  --text-medium:    #4B5563;
  --border-light:   #E5E7EB;
  --row-alt:        #F6F7FE;
  --row-hover:      #E6E8FC;
}

/*=============================================
  Base Typography & Background
=============================================*/
body {
  font-family: 'Lexend Deca', sans-serif;
  margin: 0;
  padding: 1.5em;
  background: var(--bg-page);
  color: var(--text-dark);
  line-height: 1.6;
}

/*=============================================
  Header & Footer
=============================================*/
header,
footer {
  background-color: var(--header-purple);
  color: var(--text-light);
  padding: 1.5em;
  text-align: center;
}

header h1 {
  font-size: 2.25em;
  margin-bottom: 0.25em;
  color: var(--text-light);
}

header p,
footer p {
  font-size: 1em;
  color: var(--text-light);
  margin: 0;
}

/*=============================================
  Filter & Generator Toolbar Sections
=============================================*/
.filters,
.link-generator {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 1em;
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1em;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 1.5em;
}

.filters label,
.link-generator label {
  display: flex;
  flex-direction: column;
  font-weight: 600;
  font-size: 0.95em;
  min-width: 180px;
  color: var(--text-dark);
}

.filters input,
.filters select,
.link-generator input,
.link-generator select {
  margin-top: 0.3em;
  padding: 0.45em 0.6em;
  font-size: 1em;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--bg-page);
  color: var(--text-dark);
}

/*=============================================
  Buttons (Shared Style)
=============================================*/
.button-group {
  display: flex;
  gap: 0.75em;
  align-items: flex-end; /* aligns buttons with bottom of other controls */
  border: none;
}

.button-group button {
  padding: 0.55em 1.1em;
  background: #2b3173;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95em;
  cursor: pointer;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
  line-height: 1.2;         /* keeps vertical size tidy */
  transition: background-color 0.2s ease;
}

.button-group button:hover,
.button-group button:focus {
  background: #23285f;
  outline: none;
  box-shadow: 0 0 5px var(--accent-purple);
}

/* Clear Filters button style (if added) */
#clearFiltersBtn {
  padding: 0.55em 1.1em;
  background: #a855f7; /* lighter purple */
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95em;
  cursor: pointer;
  box-shadow: 0 2px 3px rgba(168, 85, 247, 0.6);
  transition: background-color 0.2s ease;
}

#clearFiltersBtn:hover,
#clearFiltersBtn:focus {
  background: #9333ea;
  outline: none;
  box-shadow: 0 0 6px #9333ea;
}

/*=============================================
  Schedule Table
=============================================*/
.table-container {
  overflow-x: auto;
}

table.class-schedule {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
  background: var(--bg-panel);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  border-radius: 6px;
  overflow: hidden;
}

/* Sticky headers */
table.class-schedule thead th {
  position: sticky;
  top: 0;
  background-color: var(--table-header-bg);
  color: var(--text-light);
  z-index: 10;
  box-shadow: 0 2px 2px -1px rgba(0,0,0,0.1);
}

table th,
table td {
  padding: 0.75em;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
}

table th {
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  position: relative;
  color: var(--text-light); /* ensure white text on header */
}

/*=============================================
  Sort Icons (Up/Down Chevron Style)
=============================================*/
th.sort-icon::after {
  content: '▴'; /* default unsorted */
  position: absolute;
  right: 0.75em;
  color: var(--text-light); /* changed from accent-purple */
  font-size: 0.8em;
  opacity: 0.6;             /* more visible on dark header */
  transition: opacity 0.2s ease;
}

th.sort-icon.asc::after {
  content: '▴'; /* ascending */
  opacity: 1;
}

th.sort-icon.desc::after {
  content: '▾'; /* descending */
  opacity: 1;
}

/*=============================================
  Table Row Striping & Hover
=============================================*/
tr.zebra-even {
  background-color: var(--row-alt);
}

tr.zebra-odd {
  background-color: var(--bg-panel);
}

table tr:hover {
  background-color: var(--row-hover);
}

/*=============================================
  Utilities
=============================================*/
.hidden {
  display: none;
}

.loading-spinner {
  font-weight: bold;
  margin-bottom: 1em;
}

/*=============================================
  Generated Link Display
=============================================*/
.link-generator .generated-link {
  order: 1;
  flex: 0 0 100%;
  margin-top: 1em;
  text-align: center;
  color: var(--accent-purple);
  word-break: break-word;
}
