/*
 * MMCL Staff Dashboard - Styles
 * York University Branding - AODA Compliant
 */

/* ========== Google Fonts ========== */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Serif:wght@400;500&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ========== York Brand Colors ========== */
:root {
  /* Primary Colors */
  --york-red: #E31837;
  --york-red-medium: #AF0D1A;
  --york-red-dark: #810001;

  /* Neutrals */
  --light-grey: #E1DFDC;
  --pewter: #D6CFCA;
  --grey-dark: #686260;
  --white: #FFFFFF;
  --black: #000000;

  /* Accent */
  --bright-blue: #3AC2EF;

  /* Status Colors */
  --status-confirmed: var(--york-red);
  --status-tentative: #F59E0B;
  --status-pending: #14B8A6;
  --status-checked-in: #10B981;
  --status-completed: var(--grey-dark);

  /* Typography */
  --font-primary: 'IBM Plex Sans', sans-serif;
  --font-secondary: 'IBM Plex Serif', serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-xxl: 3rem;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* ========== Reset & Base ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  font-size: 16px;
  line-height: 1.5;
  color: var(--black);
  background-color: var(--light-grey);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== Zone A: Header ========== */
.dashboard-header {
  background-color: var(--york-red-dark);
  color: var(--white);
  padding: var(--spacing-lg) var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-md);
}

.location-info h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: var(--spacing-xs);
}

.location-info .service-type {
  font-size: 1.125rem;
  opacity: 0.9;
  font-weight: 500;
}

.header-meta {
  text-align: right;
}

.current-date {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
}

.last-updated {
  font-size: 0.875rem;
  opacity: 0.85;
  font-family: var(--font-mono);
}

.shift-info {
  background-color: rgba(255, 255, 255, 0.1);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  display: inline-block;
}

.shift-label {
  font-size: 1rem;
  font-weight: 600;
}

/* ========== Zone B: Peak Load Timeline ========== */
.peak-load-section {
  background-color: var(--white);
  padding: var(--spacing-lg);
  margin: 0 var(--spacing-xl) var(--spacing-xl) var(--spacing-xl);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.peak-load-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--york-red-dark);
  margin-bottom: var(--spacing-xs);
}

.timeline-description {
  font-size: 0.875rem;
  color: var(--grey-dark);
  margin-bottom: var(--spacing-md);
  font-style: italic;
}

.timeline {
  display: flex;
  gap: var(--spacing-xs);
  height: 120px;
  align-items: stretch;
}

.timeline-hour {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: var(--spacing-xs);
}

.timeline-bar {
  width: 100%;
  background-color: var(--york-red);
  border-radius: var(--radius-sm);
  min-height: 4px;
  transition: background-color 0.3s ease;
}

.timeline-hour.past .timeline-bar {
  background-color: var(--grey-dark);
  opacity: 0.5;
}

.timeline-hour-label {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--grey-dark);
}

.timeline-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--black);
}

/* ========== Filters ========== */
.filters-section {
  margin: var(--spacing-md) var(--spacing-xl);
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  flex-wrap: wrap;
}

.filters-label {
  font-weight: 600;
  color: var(--grey-dark);
  margin-right: var(--spacing-xs);
}

.filter-button {
  padding: var(--spacing-xs) var(--spacing-md);
  border: 2px solid var(--york-red);
  background-color: var(--white);
  color: var(--york-red);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  user-select: none;
}

.filter-button:hover {
  background-color: var(--light-grey);
}

.filter-button.active {
  background-color: var(--york-red);
  color: var(--white);
}

.filter-button:focus {
  outline: 2px solid var(--york-red);
  outline-offset: 2px;
}

/* Hidden by filter */
.booking-card.filter-hidden {
  display: none;
}

/* ========== Zone C: Main Booking List ========== */
.main-content {
  margin: 0 var(--spacing-xl);
}

.shift-group {
  margin-bottom: var(--spacing-xxl);
}

.shift-group-header {
  background-color: var(--york-red);
  color: var(--white);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
}

.shift-group-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

.shift-group-header .booking-count {
  font-size: 0.875rem;
  opacity: 0.9;
  margin-top: var(--spacing-xs);
}

/* ========== Hour Groups (within shift blocks) ========== */
.hour-group {
  margin-bottom: var(--spacing-md);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--light-grey);
}

.hour-group-header {
  background-color: var(--light-grey);
  padding: var(--spacing-sm) var(--spacing-md);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: background-color 0.2s ease;
}

.hour-group-header:hover {
  background-color: var(--pewter);
}

.hour-group-label {
  display: flex;
  align-items: baseline;
  gap: var(--spacing-sm);
}

.hour-group-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--black);
}

.hour-group-count {
  font-size: 0.8rem;
  color: var(--grey-dark);
}

.hour-group-icon {
  font-size: 0.9rem;
  color: var(--grey-dark);
  transition: transform 0.2s ease;
}

.hour-group.expanded .hour-group-icon {
  transform: rotate(180deg);
}

.hour-group-content {
  padding: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
}

.hour-group-content.collapsed {
  display: none;
}

.hour-group-content .booking-list {
  margin-top: var(--spacing-sm);
}

.outstanding-group .hour-group-header {
  background-color: #FFF7ED;
  border-left: 4px solid var(--status-tentative);
}

.outstanding-group .hour-group-header:hover {
  background-color: #FFEDD5;
}

.outstanding-group .hour-group-title {
  color: #92400E;
}

.outstanding-group .hour-group-count {
  color: #B45309;
}

.hour-group.filter-hidden {
  display: none;
}

/* ========== Prominent task time in card header ========== */
.task-time-prominent {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05em;
  color: var(--york-red);
  margin-right: 0.4rem;
}

.booking-list {
  display: grid;
  gap: var(--spacing-md);
}

/* ========== Booking Cards ========== */
.booking-card {
  background-color: var(--white);
  border-radius: var(--radius-md);
  padding: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-left: 4px solid var(--york-red);
  transition: box-shadow 0.2s ease;
  overflow: hidden;
}

.booking-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.booking-card-header-bar {
  position: relative;
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: var(--light-grey);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s ease;
  user-select: none;
}

.booking-card-header-bar:hover {
  background-color: var(--pewter);
}

.booking-card-summary {
  flex: 1;
}

.booking-card-summary-title {
  font-weight: 600;
  color: var(--black);
  margin-bottom: var(--spacing-xs);
}

.booking-card-summary-time {
  font-size: 0.875rem;
  color: var(--grey-dark);
}

.booking-card-expand-icon {
  font-size: 1.25rem;
  color: var(--grey-dark);
  transition: transform 0.2s ease;
  margin-left: var(--spacing-md);
}

.booking-card.expanded .booking-card-expand-icon {
  transform: rotate(180deg);
}

.booking-card-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 var(--spacing-md);
}

.booking-card.expanded .booking-card-content {
  max-height: 3000px;
  padding: var(--spacing-md);
}

.booking-card.equipment-loan {
  border-left-color: var(--bright-blue);
}

.booking-card.teaching-event {
  border-left-color: var(--grey-dark);
}

.booking-card.overdue {
  border-left-color: var(--status-tentative);
  background-color: #FFF7ED;
}

.booking-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-md);
}

.booking-title {
  flex: 1;
}

.booking-title h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--black);
  margin-bottom: var(--spacing-xs);
}

.booking-category {
  font-size: 0.875rem;
  color: var(--grey-dark);
}

.booking-badges {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.status-confirmed {
  background-color: var(--status-confirmed);
  color: var(--white);
}

.badge.status-tentative {
  background-color: var(--status-tentative);
  color: var(--white);
}

.badge.status-pending {
  background-color: var(--status-pending);
  color: var(--white);
}

.badge.status-checked-in {
  background-color: var(--status-checked-in);
  color: var(--white);
}

.badge.teaching-event-badge {
  background-color: var(--grey-dark);
  color: var(--white);
}

.badge.badge-task {
  background-color: var(--bright-blue);
  color: var(--white);
  font-weight: 700;
}

.badge.shift-boundary-flag {
  background-color: var(--bright-blue);
  color: var(--white);
}

.booking-details {
  display: grid;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.detail-row {
  display: flex;
  gap: var(--spacing-md);
  font-size: 0.9375rem;
}

.detail-label {
  font-weight: 600;
  color: var(--grey-dark);
  min-width: 80px;
}

.detail-value {
  color: var(--black);
}

.patron-info {
  font-family: var(--font-mono);
}

.booking-id {
  font-family: var(--font-mono);
  color: var(--grey-dark);
  font-size: 0.875rem;
}

/* ========== Equipment Indicators ========== */
.equipment-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  background-color: var(--light-grey);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

.equipment-indicator.pickup {
  background-color: #DBEAFE;
  color: #1E40AF;
}

.equipment-indicator.return {
  background-color: #D1FAE5;
  color: #065F46;
}

/* ========== Workflow Checklist (Phase 1: Read-only) ========== */
.workflow-panel {
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--light-grey);
}

.workflow-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
}

.workflow-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--york-red-dark);
}

.workflow-progress {
  font-size: 0.875rem;
  color: var(--grey-dark);
}

.workflow-steps {
  list-style: none;
  display: grid;
  gap: var(--spacing-sm);
}

.workflow-step {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  background-color: var(--light-grey);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background-color: var(--grey-dark);
  color: var(--white);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.step-description {
  flex: 1;
  color: var(--black);
}

/* --- Workflow progress bar in collapsed card header --- */
.workflow-header-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background-color: rgba(0, 0, 0, 0.25);
}

.workflow-header-progress-fill {
  height: 100%;
  background-color: var(--status-checked-in);
  transition: width 0.3s ease;
  width: 0%;
}

/* --- Completed step state --- */
.workflow-step.step-completed {
  opacity: 0.65;
}

.workflow-step.step-completed .step-description {
  text-decoration: line-through;
  color: var(--grey-dark);
}

.workflow-step.step-completed .step-number {
  background-color: var(--status-checked-in);
}

/* --- Step checkbox --- */
.step-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--york-red);
  flex-shrink: 0;
  margin-top: 2px;
}

/* --- Inline progress bar (always-expanded in-progress job cards) --- */
.workflow-inline-progress {
  height: 4px;
  background-color: var(--pewter);
  border-radius: 2px;
  margin-bottom: var(--spacing-sm);
}

.workflow-inline-progress-fill {
  height: 100%;
  background-color: var(--status-checked-in);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

/* ========== Zone D: Persistent Sections ========== */
.persistent-sections {
  margin: var(--spacing-xxl) var(--spacing-xl);
}

.persistent-section {
  background-color: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid var(--york-red-dark);
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--york-red-dark);
}

.section-count {
  font-size: 1rem;
  font-weight: 600;
  color: var(--grey-dark);
}

.overdue-section .section-header {
  border-bottom-color: var(--status-tentative);
}

.overdue-section .section-header h2 {
  color: var(--status-tentative);
}

/* ========== Collapsible Section ========== */
.collapsible-section {
  margin-top: var(--spacing-md);
}

.collapse-toggle {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: var(--spacing-sm) 0;
  font-family: var(--font-primary);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--grey-dark);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color 0.2s ease;
}

.collapse-toggle:hover {
  color: var(--black);
}

.collapse-icon {
  transition: transform 0.2s ease;
}

.collapse-toggle[aria-expanded="true"] .collapse-icon {
  transform: rotate(180deg);
}

.collapse-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.collapse-content.open {
  max-height: 5000px;
}

/* ========== Empty States ========== */
.empty-state {
  text-align: center;
  padding: var(--spacing-xxl) var(--spacing-md);
  color: var(--grey-dark);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

.empty-state-message {
  font-size: 1.125rem;
  font-weight: 500;
}

/* ========== Warning Banners ========== */
.warning-banner {
  background-color: #FFF7ED;
  border-left: 4px solid var(--status-tentative);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  display: flex;
  gap: var(--spacing-md);
  align-items: flex-start;
}

.warning-icon {
  font-size: 1.5rem;
  color: var(--status-tentative);
}

.warning-content {
  flex: 1;
}

.warning-title {
  font-weight: 600;
  color: var(--black);
  margin-bottom: var(--spacing-xs);
}

.warning-message {
  font-size: 0.9375rem;
  color: var(--grey-dark);
}

/* ========== Responsive Design ========== */
@media (max-width: 1024px) {
  .header-top {
    flex-direction: column;
    gap: var(--spacing-md);
  }

  .header-meta {
    text-align: left;
  }

  .timeline {
    height: 100px;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .dashboard-header {
    padding: var(--spacing-md);
  }

  .main-content,
  .peak-load-section,
  .persistent-sections {
    margin-left: var(--spacing-md);
    margin-right: var(--spacing-md);
  }

  .location-info h1 {
    font-size: 1.5rem;
  }

  .timeline-hour-label {
    font-size: 0.625rem;
  }

  .booking-header {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .detail-row {
    flex-direction: column;
    gap: var(--spacing-xs);
  }
}

/* ========== Makerspace-Specific Styles ========== */
.booking-card.in-progress {
  border-left-color: var(--bright-blue);
  background-color: #F0F9FF;
}

.in-progress-section .section-header {
  border-bottom-color: var(--bright-blue);
}

.in-progress-section .section-header h2 {
  color: var(--bright-blue);
}

.workflow-step.safety-step {
  background-color: #FFF7ED;
  border-left: 3px solid var(--status-tentative);
}

.workflow-step.safety-step .step-number {
  background-color: var(--status-tentative);
}

/* ========== Status Legend ========== */
.status-legend {
  background-color: var(--light-grey);
  padding: var(--spacing-md) var(--spacing-xl);
  margin: var(--spacing-xxl) var(--spacing-xl) var(--spacing-md) var(--spacing-xl);
  border-radius: var(--radius-md);
  border-top: 3px solid var(--grey-dark);
}

.status-legend h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--grey-dark);
  margin-bottom: var(--spacing-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.legend-badge {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--white);
  min-width: 90px;
  text-align: center;
}

.legend-description {
  font-size: 0.875rem;
  color: var(--grey-dark);
}

/* ========== Print Styles ========== */
@media print {
  body {
    background-color: var(--white);
  }

  .dashboard-header {
    background-color: var(--white);
    color: var(--black);
    border-bottom: 2px solid var(--black);
  }

  .booking-card {
    page-break-inside: avoid;
    border: 1px solid var(--grey-dark);
  }

  .timeline {
    display: none;
  }
}
