/* Attendance Check-In sidebar refinements */

#sidebar,
#sidebar * {
  -webkit-font-smoothing: antialiased;
}

#sidebar {
  width: clamp(280px, 28vw, 360px);
  flex: 0 0 clamp(280px, 28vw, 360px);
  flex-shrink: 0;
  overflow-x: hidden;
  position: relative;
  z-index: 20;
  color: var(--color-text);
  background: linear-gradient(180deg, rgba(5, 12, 22, 0.85), rgba(4, 10, 18, 0.92));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(94, 234, 212, 0.08);
  box-shadow: 0 18px 36px rgba(2, 6, 12, 0.35);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.take-sidebar {
  display: flex;
  flex-direction: column;
  padding: var(--space-2) var(--space-4) var(--space-4);
  gap: 0;
}

.take-sidebar__sticky {
  position: sticky;
  top: 80px;
  padding: var(--space-2) 0 var(--space-3);
  background: transparent;
  z-index: 20;
}

.take-sidebar__scroll,
#sidebar-scroll {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.section-card {
  margin-bottom: var(--space-4);
}

.section-card:last-of-type {
  margin-bottom: 0;
}

.section-card__surface {
  border-radius: 16px;
  border: 1px solid rgba(94, 234, 212, 0.12);
  background: linear-gradient(180deg, rgba(13, 22, 36, 0.9), rgba(8, 15, 26, 0.92));
  padding: var(--space-4);
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.section-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-card__title {
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: rgba(241, 245, 249, 0.98);
}

.section-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  color: rgba(203, 213, 225, 0.9);
}

.section-card__body--stack {
  gap: var(--space-3);
}

.sidebar-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: rgba(203, 213, 225, 0.88);
}

.sidebar-field__label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: rgba(226, 232, 240, 0.92);
}

.event-stepper {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.step-btn {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.6);
  padding: var(--space-3);
  text-align: left;
  display: grid;
  gap: 2px;
  color: rgba(226, 232, 240, 0.94);
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.step-btn--primary {
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.28), rgba(20, 184, 166, 0.7));
  border-color: rgba(45, 212, 191, 0.85);
  color: rgba(240, 253, 250, 0.98);
  font-size: var(--fs-lg);
  padding: var(--space-4);
  box-shadow: 0 10px 28px rgba(13, 148, 136, 0.25);
}

.step-btn--optional {
  border-style: dashed;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.45);
  font-size: var(--fs-sm);
}

.step-btn--optional .step-title {
  font-size: var(--fs-md);
  color: rgba(214, 226, 240, 0.9);
}

.step-btn[aria-current="true"] {
  border-color: var(--action-accent);
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.35);
}

.step-btn:hover {
  border-color: rgba(45, 212, 191, 0.55);
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(6, 182, 212, 0.15);
}

.step-title {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.step-btn--primary .step-title {
  font-size: var(--fs-xl);
}

.step-sub {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(148, 163, 184, 0.85);
}

.step-btn--primary .step-sub {
  color: rgba(240, 253, 250, 0.8);
}

.step-dot {
  position: absolute;
  top: 50%;
  right: var(--space-4);
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.4);
  transform: translateY(-50%);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.step-btn[aria-current="true"] .step-dot {
  transform: translateY(-50%) scale(1.15);
}

.step-btn[data-has-records="true"] .step-dot {
  background: var(--action-accent);
}

@media (max-width: 1080px) {
  #sidebar {
    width: 100%;
    flex: 1 1 auto;
  }

  .take-sidebar {
    padding: var(--space-3);
    gap: var(--space-2);
  }

  .section-card {
    margin-bottom: var(--space-3);
  }

  .section-card__surface {
    padding: var(--space-3);
    gap: var(--space-2);
  }

  .sidebar-field {
    gap: var(--space-1);
  }

  #view-take [data-section="find-people"] .section-card__body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    align-items: center;
  }
}

@media (max-width: 960px) {
  #sidebar {
    width: 100%;
    flex-shrink: 1;
    position: static;
    z-index: auto;
  }

  .take-sidebar {
    padding: var(--space-3);
    gap: var(--space-3);
  }

  .take-sidebar__sticky {
    position: static;
    top: auto;
    padding: 0;
  }

  .section-card {
    margin-bottom: var(--space-3);
  }
}

.step-btn--primary .step-dot {
  width: 10px;
  height: 10px;
  background: rgba(240, 253, 250, 0.9);
}

.event-stepper-note {
  margin: 0;
  font-size: var(--fs-xs);
  color: rgba(148, 163, 184, 0.75);
}

.sidebar-field--toggle {
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
  color: rgba(203, 213, 225, 0.88);
}

.sidebar-date {
  display: grid;
  gap: var(--space-3);
}

.sidebar-date__input {
  display: grid;
  gap: var(--space-1);
}

.sidebar-hint {
  font-size: var(--fs-xs);
  color: rgba(148, 163, 184, 0.75);
}

.date-nav {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  background: rgba(15, 24, 38, 0.6);
}

.chip-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 0;
  min-height: 40px;
  padding: 0 var(--space-3);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: rgba(236, 241, 247, 0.92);
  font-weight: 600;
  transition: background-color 0.15s ease, opacity 0.15s ease, color 0.15s ease;
}

.chip-control:hover {
  opacity: 0.98;
  background: rgba(56, 189, 248, 0.22);
  color: rgba(165, 243, 252, 0.95);
}

.chip-control:active {
  opacity: 0.85;
  transform: none;
}

.navigator-board {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.18);
  background: rgba(10, 19, 29, 0.55);
}

.navigator-board__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.navigator-board__title {
  display: block;
  font-weight: 600;
  font-size: var(--fs-lg);
  color: rgba(236, 241, 247, 0.96);
}

.navigator-board__hint {
  margin: 0;
  font-size: var(--fs-xs);
  color: rgba(148, 163, 184, 0.8);
}

.navigator-board__count {
  font-size: var(--fs-sm);
  color: rgba(125, 211, 252, 0.9);
  white-space: nowrap;
}

.navigator-groups {
  display: grid;
  gap: var(--space-3);
}

.navigator-group {
  display: grid;
  gap: var(--space-2);
}

.navigator-group__title {
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(148, 163, 184, 0.75);
}

.navigator-item {
  list-style: none;
}

.navigator-item button {
  width: 100%;
  text-align: left;
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3);
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  background: rgba(12, 22, 32, 0.55);
  color: rgba(236, 241, 247, 0.94);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.navigator-item button:hover,
.navigator-item button:focus-visible {
  border-color: rgba(125, 211, 252, 0.6);
  background: rgba(15, 24, 38, 0.75);
}

.navigator-item__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.navigator-item__date {
  font-weight: 600;
}

.navigator-item__badge {
  font-size: var(--fs-xs);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(26, 35, 58, 0.8);
  color: rgba(226, 240, 247, 0.92);
}

.navigator-item__badge[data-gap="blank"] {
  background: rgba(248, 113, 113, 0.25);
  color: rgba(248, 113, 113, 0.95);
}

.navigator-item__name-list {
  font-size: var(--fs-xs);
  color: rgba(148, 163, 184, 0.8);
}

.navigator-item__progress {
  font-size: var(--fs-xs);
  color: rgba(148, 163, 184, 0.75);
}

.navigator-item--empty,
.navigator-item--more {
  text-align: center;
  font-size: var(--fs-xs);
  color: rgba(148, 163, 184, 0.75);
}

.navigator-item--empty {
  padding: var(--space-3);
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.15);
  background: rgba(12, 22, 32, 0.45);
}

#sidebar input:not([type="checkbox"]):not([type="radio"]),
#sidebar select {
  height: 40px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  padding: 0 var(--space-3);
  color: rgba(236, 241, 247, 0.94);
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

#sidebar input:not([type="checkbox"]):not([type="radio"]):hover,
#sidebar select:hover {
  opacity: 0.98;
}

#sidebar input::placeholder,
#sidebar select::placeholder {
  color: rgba(148, 163, 184, 0.7);
}

#sidebar input:not([type="checkbox"]):not([type="radio"]):focus-visible,
#sidebar select:focus-visible,
#sidebar button:focus-visible,
.chip-control:focus-visible,
.sidebar-accordion__summary:focus-visible {
  outline: none;
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.6);
}

#sidebar input[type="checkbox"] {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  accent-color: var(--accent-teal);
}

.sidebar-accordion {
  width: 100%;
}

.sidebar-accordion__summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-1) 0;
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: rgba(226, 232, 240, 0.92);
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.sidebar-accordion__summary:hover {
  opacity: 0.98;
  background: rgba(56, 189, 248, 0.1);
}

.sidebar-accordion__summary::-webkit-details-marker {
  display: none;
}

.sidebar-accordion__summary::after {
  content: '\203A';
  transform: rotate(90deg);
  transition: transform 0.2s ease;
  font-size: 18px;
  color: rgba(148, 163, 184, 0.8);
}

.sidebar-accordion[open] .sidebar-accordion__summary::after {
  transform: rotate(-90deg);
}

.sidebar-accordion__body {
  margin-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

#sidebar button {
  border-width: 1px;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

#sidebar button:not(.chip-control) {
  min-height: 40px;
  border-radius: 12px;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(14, 24, 38, 0.7);
  color: rgba(226, 232, 240, 0.96);
  font-weight: 600;
}

#sidebar button:not(.chip-control):hover {
  opacity: 0.98;
}

#sidebar button:not(.chip-control):active {
  opacity: 0.85;
  transform: none;
}

#sidebar button.secondary-action:not(.chip-control) {
  background: rgba(15, 23, 42, 0.5);
  color: rgba(203, 213, 225, 0.9);
}

.sidebar-notice {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(9, 17, 28, 0.92);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  color: rgba(203, 213, 225, 0.9);
  font-size: var(--fs-sm);
}

.sidebar-notice__body {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  text-transform: none;
}

.sidebar-notice__body strong {
  font-weight: 700;
  color: rgba(241, 245, 249, 0.96);
}

.sidebar-notice__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.sidebar-notice__actions button {
  flex: 1 1 auto;
}

.sidebar-notice--row {
  flex-direction: column;
  gap: var(--space-2);
}

.sidebar-notice__meta {
  font-size: var(--fs-xs);
  color: rgba(148, 163, 184, 0.75);
}

.navigator-stats {
  display: none;
}

.navigator-stats:not([hidden]) {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

.navigator-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.navigator-stat__label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(148, 163, 184, 0.75);
  white-space: nowrap;
}

.navigator-stat__value {
  font-size: var(--fs-md);
  color: rgba(241, 245, 249, 0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1080px) {
  #sidebar {
    width: 100%;
  }
  .take-sidebar {
    padding: var(--space-2) 0 var(--space-4);
  }
  .take-sidebar__sticky {
    position: static;
    padding: var(--space-2) 0;
  }
  .take-sidebar__scroll,
  #sidebar-scroll {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

/*
Acceptance test checklist:
- Resize viewport 1024px–1920px; confirm sticky sidebar clears header and no horizontal scroll appears.
- Open date/session controls to confirm floating UI has room and no clipping occurs.
- Tab through controls to verify focus rings and zero layout shift.
- Check navigator stats: three columns stay on one line with truncation for overflow.
- Scroll on macOS/Windows to confirm scrollbar-gutter prevents layout jump.
*/
