:root {
  --accent: #1976d2;
  --accent-light: #e3f2fd;
  --border-color: #ccc;
  --header-bg: #f5f5f5;
  --danger: #c62828;
  --gray: #e0e0e0;
  --yellow: #fff9c4;
  --orange: #ffe0b2;
  --cyan: #b2ebf2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #fafafa;
  color: #222;
}

header {
  background: var(--accent);
  color: white;
  padding: 12px 16px;
  font-size: 1.4rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header .subtitle {
  font-size: 0.9rem;
  opacity: 0.85;
  font-weight: 400;
}

main {
  padding: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  padding: 16px;
  margin-bottom: 16px;
}

h2 {
  margin-top: 0;
  font-size: 1.2rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 4px;
  margin-bottom: 12px;
}

h3 {
  margin-top: 16px;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

label {
  font-size: 0.9rem;
  margin-bottom: 4px;
  display: inline-block;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
select {
  width: 100%;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.read-only-input {
  background: #f5f5f5;
}


input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.btn {
  display: inline-block;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  background: var(--accent);
  color: white;
  margin-right: 8px;
  margin-top: 4px;
}

.btn.secondary { background: #757575; }
.btn.danger { background: var(--danger); }
.btn.success { background: #2e7d32; }

.btn.small {
  padding: 3px 8px;
  font-size: 0.8rem;
  margin-top: 0;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 4px;
}

.tab {
  padding: 6px 10px;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  font-size: 0.9rem;
  background: #ddd;
  color: #333;
}

.tab.active {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-bottom: 1px solid white;
  font-weight: 600;
}

.tab-changelog {
  margin-left: auto;
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}


.nav-buttons .btn[data-nav] {
  background: #ddd;
  color: #333;
}

.nav-buttons .btn[data-nav].active-nav {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}


.view { display: none; }
.view.active { display: block; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
  margin-bottom: 12px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.form-row > div {
  flex: 1;
  min-width: 150px;
}

.inline-checkbox {
  display: inline-flex;
  align-items: center;
  margin-right: 12px;
  font-size: 0.85rem;
}

.inline-checkbox input { margin-right: 4px; }

.inline-family-details {
  display: inline-flex;
  align-items: center;
  flex: 1;
  min-width: 200px;
  gap: 4px;
}

.inline-family-details input {
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th, td {
  border: 1px solid #ddd;
  padding: 4px 6px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--header-bg);
  font-weight: 600;
}

.text-right { text-align: right; padding-right: 4px; }
.text-center { text-align: center; }

/* Sticky headers */
.sticky-wrapper {
  max-height: 260px;
  overflow: auto;
}

.sticky-wrapper.large {
  max-height: 420px;
}

.sticky-header th {
  position: sticky;
  top: 0;
  z-index: 2;
}

/* Sorting UI */
th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable .th-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

th.sortable .chevron {
  font-size: 0.7rem;
  opacity: 0.6;
  margin-left: 4px;
}

/* Class roster specific styling */
#class-roster-header {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 8px 0 8px 0;
}

/* Header row in blue with bold black text */
#class-roster-table thead th {
  background: #1976d2;
  color: #000;
  font-weight: 700;
}

/* Name column cells in yellow (data cells only; header remains blue) */
#class-roster-table td.name-col {
  background: var(--yellow);
}

/* Ensure single-class roster header stays blue and no chevrons */
#class-roster-table thead th.name-col {
  background: #1976d2;
}
#class-roster-table thead .chevron {
  display: none;
}

/* Multi-class roster sections: spacing and colors */
.roster-multi-section {
  margin-bottom: 16px;
}

.roster-multi-section table thead th {
  background: #1976d2;
  color: #000;
  font-weight: 700;
}

.roster-multi-section td.name-col {
  background: var(--yellow);
}

.roster-teachers-inline {
  margin-top: 4px;
}

/* Login */
#login-card {
  max-width: 420px;
  margin: 48px auto;
}

.hint {
  font-size: 0.8rem;
  color: #555;
  margin-top: 6px;
}

.muted {
  color: #777;
  font-size: 0.85rem;
}

.section-divider {
  border-top: 1px dashed #ccc;
  margin: 12px 0;
}

/* DOB compact */
.dob-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.dob-select {
  width: auto;
  min-width: 60px;
  padding: 2px 4px;
  font-size: 0.8rem;
}

.password-row {
  position: relative;
  display: flex;
  align-items: center;
}

.password-row input[type="password"],
.password-row input[type="text"] {
  width: 100%;
  padding-right: 32px;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--border-color);
  background: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* Student highlighting */
.row-no-payment {
  background: var(--yellow);
}

.row-no-class {
  background: var(--cyan);
}

/* Custom confirmation dialog */
#confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

#confirm-overlay.active {
  display: flex;
}

#confirm-dialog {
  max-width: 420px;
  width: 90%;
}

#confirm-message {
  margin-top: 6px;
  margin-bottom: 4px;
}




/* Force Class Roster print button green even if secondary */
#roster-print {
  background: #2e7d32;
  color: #fff;
}


/* Narrow columns for Scholarship / Family Plan / Graduated on Students table */
#students-table th:nth-child(9),
#students-table th:nth-child(10),
#students-table th:nth-child(11),
#students-table td:nth-child(9),
#students-table td:nth-child(10),
#students-table td:nth-child(11) {
  width: 60px;
  text-align: center;
  white-space: nowrap;
}


/* Student name autocomplete on Registration */
.autocomplete-list {
  margin-top: 4px;
  border: 1px solid var(--border-color);
  background: #fff;
  max-height: 160px;
  overflow-y: auto;
  font-size: 0.85rem;
  display: none;
}

.autocomplete-item {
  padding: 4px 6px;
  cursor: pointer;
}

.autocomplete-item:hover {
  background: var(--accent-light);
}

/* Delete Event Log button: match inactive EventLog tab color */
#changelog-delete-btn {
  background: #ddd;
  color: #333;
}
