/* Attendency Design System — DLH QR Attendance Prototype
 * Brand: Digital Learning Hub (dlh.lu)
 * Colors sourced from live CSS at dlh.lu — see CLAUDE.md for full reference */

/* Roboto served locally — no external CDN dependency (RVW3-6) */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/static/fonts/roboto-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/roboto-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/roboto-700.woff2') format('woff2');
}

:root {
  /* DLH Primary palette */
  --color-secondary: #133182;        /* DLH navy — headers, secondary buttons */
  --color-secondary-light: #1a3f9e;
  --color-secondary-dark: #0f2768;
  --color-primary: #ab4fff;         /* DLH purple — CTAs, links, interactive */
  --color-primary-light: #9143d9;
  --color-primary-dark: #893fcc;
  --color-link-on-grey: #6c00cf;  /* Link color on cc2 grey backgrounds */

  /* Surfaces — Odoo standard */
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-muted: #f2f2f2;  /* Odoo o_cc2 */
  --color-border: #e8e5e0;
  --color-border-light: #f0ede8;

  /* Text */
  --color-text: #212529;
  --color-text-muted: #6b7280;
  --color-text-light: #767676;     /* min 4.54:1 contrast on white (WCAG AA) */
  --color-text-inverse: #ffffff;

  /* Status colors — functional, not brand — intentionally distinct */
  --status-present: #059669;
  --status-present-bg: #d1fae5;
  --status-late: #d97706;
  --status-late-bg: #fef3c7;
  --status-absent: #dc2626;
  --status-absent-bg: #fee2e2;
  --status-not-checked-in: #6b7280;
  --status-not-checked-in-bg: #f3f4f6;
  --status-early-leaver: #7c3aed;
  --status-early-leaver-bg: #ede9fe;
  --status-manual: #2563eb;
  --status-manual-bg: #dbeafe;
  --status-excused: #6b7280;
  --status-excused-bg: #f9fafb;

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

  /* Typography — Roboto as per DLH brand */
  --font-body: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", monospace;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-4xl: 2.5rem;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.4rem;   /* matches DLH btn border-radius */
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-primary-light); }

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container--narrow {
  max-width: 640px;
}

.container--wide {
  max-width: 1400px;
}

/* Header — white navbar matching DLH My Account style */
.app-header {
  background: #ffffff;
  color: var(--color-text);
  padding: var(--space-sm) var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: none;
  border-bottom: 1px solid var(--color-border);
}

.app-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: var(--font-size-lg);
  letter-spacing: -0.01em;
  color: var(--color-text);
  text-decoration: none;
}

/* DLH logo underscore accent */
.app-header__brand-underscore {
  color: var(--color-secondary);
}

.app-header__brand-icon {
  width: 32px;
  height: 32px;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
}

.app-header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.app-header__nav a {
  color: var(--color-primary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.app-header__nav a:hover {
  color: var(--color-primary);
  background: var(--color-surface-muted);
}

/* Cards */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card--elevated {
  box-shadow: var(--shadow-md);
}

.card--elevated:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.card--interactive {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.card--interactive:active {
  transform: scale(0.98);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.625rem 1.25rem;
  font-size: var(--font-size-sm);
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 44px;
  min-width: 44px;
  text-decoration: none;
  line-height: 1;
}

.btn--primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-md);
}
.btn--primary:hover {
  background: var(--color-primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--accent {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn--accent:hover {
  background: var(--color-primary-dark);
}

.btn--outline {
  background: transparent;
  border: 2px solid var(--color-border);
  color: var(--color-text);
}
.btn--outline:hover {
  border-color: var(--color-secondary);
  color: var(--color-secondary);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.btn--ghost:hover {
  background: var(--color-surface-muted);
  color: var(--color-text);
}

.btn--danger {
  background: var(--status-absent);
  color: white;
}
.btn--danger:hover {
  background: #b91c1c;
}

.btn--sm {
  padding: 0.375rem 0.75rem;
  font-size: var(--font-size-xs);
  min-height: 36px;
}

.btn--lg {
  padding: 0.875rem 1.75rem;
  font-size: var(--font-size-lg);
}

.btn--full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Status chips */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

.status-chip--present { background: var(--status-present-bg); color: var(--status-present); }
.status-chip--late { background: var(--status-late-bg); color: var(--status-late); }
.status-chip--absent { background: var(--status-absent-bg); color: var(--status-absent); }
.status-chip--not_checked_in { background: var(--status-not-checked-in-bg); color: var(--status-not-checked-in); }
.status-chip--early_leaver { background: var(--status-early-leaver-bg); color: var(--status-early-leaver); }
.status-chip--manual_present { background: var(--status-manual-bg); color: var(--status-manual); }
.status-chip--excused { background: var(--status-excused-bg); color: var(--status-excused); }

/* Avatar */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--font-size-sm);
  color: white;
  flex-shrink: 0;
}

.avatar--sm { width: 32px; height: 32px; font-size: var(--font-size-xs); }
.avatar--lg { width: 48px; height: 48px; font-size: var(--font-size-base); }

/* Metric cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-md);
}

.metric-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
}

.metric-card__value {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.metric-card__label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Input */
.input {
  width: 100%;
  padding: 0.625rem 1rem;
  font-size: var(--font-size-base);
  font-family: inherit;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition-fast);
  min-height: 44px;
}

.input:focus {
  outline: none;
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.input--search {
  padding-left: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.75rem center;
}

/* Toast */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 300px;
  max-width: 420px;
  animation: slideIn 0.3s ease;
  transition: all 0.3s ease;
}

.toast--success { border-left: 4px solid var(--status-present); }
.toast--warning { border-left: 4px solid var(--status-late); }
.toast--error { border-left: 4px solid var(--status-absent); }
.toast--info { border-left: 4px solid var(--color-primary); }

.toast.hiding {
  opacity: 0;
  transform: translateX(100%);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

/* TASK-035b / TASK-041: participant card color semantics */
.participant-card.card--mine {
  border-color: var(--status-present);
  background: var(--status-present-bg);
  /* RVW9-001: pointer-events NOT disabled — own card must be tappable for wrong-name */
  opacity: 0.9;
}

.participant-card.card--taken {
  border-color: var(--color-border);
  background: var(--color-surface-muted); /* TASK-041: grey background, NOT grey text */
  color: var(--color-text);               /* normal text color */
  cursor: pointer;
}

/* suppress purple hover on taken cards */
.participant-card.card--taken:hover {
  border-color: var(--color-border);
  background: var(--color-surface-muted);
  transform: none;
  box-shadow: none;
}

/* Keep legacy classes as no-ops */
.participant-card.checked-in,
.participant-card.checked-in-late {
  pointer-events: none;
  opacity: 0.7;
}
.participant-card.holding {
  background: rgba(230, 126, 34, 0.08);
  border-color: var(--color-primary);
}

/* Hold progress bar — increased height for visibility (RVW-U04) */
.hold-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 6px;
  background: var(--color-primary);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  width: 0%;
  transition: none;
}

.hold-progress.active {
  transition: width 1.2s linear;
  width: 100%;
}

/* Skip navigation link (RVW-U15) */
.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;
}
.sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  padding: var(--space-sm) var(--space-md);
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-md);
  z-index: 9999;
}

/* Toast mobile fix (RVW-U16) */
@media (max-width: 480px) {
  .toast-container {
    left: var(--space-md);
    right: var(--space-md);
  }
  .toast {
    min-width: 0;
    width: 100%;
  }
}

/* Activity feed */
.feed-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border-light);
  animation: fadeIn 0.3s ease;
}

.feed-item__time {
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
  min-width: 45px;
  font-family: var(--font-mono);
}

.feed-item__text {
  font-size: var(--font-size-sm);
  color: var(--color-text);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-lg);
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal__title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-bottom: var(--space-md);
}

.modal__actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

/* Participant card (for check-in list) */
.participant-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: all var(--transition-fast);
  overflow: hidden;
  min-height: 64px;
}

.participant-card:hover {
  border-color: var(--color-primary-light);
  background: var(--color-surface-muted);
}

.participant-card:active {
  border-color: var(--color-primary);
}

.participant-card.checked-in {
  border-color: var(--status-present);
  background: var(--status-present-bg);
  pointer-events: none;
  opacity: 0.7;
}

.participant-card.checked-in-late {
  border-color: var(--status-late);
  background: var(--status-late-bg);
  pointer-events: none;
  opacity: 0.7;
}

.participant-card__name {
  font-weight: 600;
  font-size: var(--font-size-base);
}

.participant-card__status {
  margin-left: auto;
}

/* Page sections */
.page-hero {
  padding: var(--space-3xl) 0 var(--space-2xl);
  text-align: center;
}

.page-hero h1 {
  margin-bottom: var(--space-sm);
}

.page-hero__subtitle {
  color: var(--color-text-muted);
  font-size: var(--font-size-lg);
}

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--space-lg); }

/* Countdown / clock */
.clock-display {
  font-family: var(--font-mono);
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-secondary);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface-muted);
  border-radius: var(--radius-md);
  display: inline-block;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  color: var(--color-text-muted);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state__text {
  font-size: var(--font-size-lg);
}

/* Loading */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
  :root {
    --space-lg: 1rem;
    --space-xl: 1.5rem;
    --space-2xl: 2rem;
    --space-3xl: 2.5rem;
  }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }

  .app-header__nav { display: none; }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  h1 { font-size: var(--font-size-2xl); }
  h2 { font-size: var(--font-size-xl); }
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }

  .metric-card {
    padding: var(--space-md);
  }

  .metric-card__value {
    font-size: var(--font-size-2xl);
  }
}

/* Print styles */
@media print {
  .app-header,
  .btn,
  .toast-container,
  .no-print {
    display: none !important;
  }

  body {
    background: white;
    font-size: 11pt;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }

  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #333;
  }

  .print-footer {
    display: block !important;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #ccc;
    font-size: 9pt;
    color: #666;
  }

  table {
    width: 100%;
    border-collapse: collapse;
  }

  th, td {
    border: 1px solid #ddd;
    padding: 4px 8px;
    font-size: 9pt;
    text-align: left;
  }

  th { background: #f5f5f5; font-weight: 600; }
}

/* Utility classes */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.text-center { text-align: center; }
.text-sm { font-size: var(--font-size-sm); }
.text-muted { color: var(--color-text-muted); }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.print-header, .print-footer { display: none; }
