/* ============================================================
   TeamPulse — Design System
   Dark glassmorphism theme · Inter font · CSS custom properties
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- Custom Properties ---- */
:root {
  /* Background — Light theme (default) */
  --bg-primary: #f1f5f9;
  --bg-secondary: #e2e8f0;
  --bg-tertiary: #cbd5e1;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-card-border: rgba(0, 0, 0, 0.08);
  --bg-input: rgba(0, 0, 0, 0.04);
  --bg-sidebar: rgba(255, 255, 255, 0.95);

  /* Accent colors */
  --accent-green: #10b981;
  --accent-green-dim: rgba(16, 185, 129, 0.15);
  --accent-amber: #f59e0b;
  --accent-amber-dim: rgba(245, 158, 11, 0.15);
  --accent-red: #ef4444;
  --accent-red-dim: rgba(239, 68, 68, 0.15);
  --accent-blue: #3b82f6;
  --accent-blue-dim: rgba(59, 130, 246, 0.15);
  --accent-purple: #8b5cf6;
  --accent-purple-dim: rgba(139, 92, 246, 0.15);

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-inverse: #f1f5f9;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.8125rem;
  --font-size-base: 0.875rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.2);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.2);
  --shadow-glow-purple: 0 0 20px rgba(139, 92, 246, 0.2);

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height: 64px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Z-index */
  --z-sidebar: 100;
  --z-topbar: 90;
  --z-overlay: 200;
  --z-modal: 300;
}

/* ---- Dark theme overrides ---- */
[data-theme="dark"] {
  --bg-primary: #0a0e1a;
  --bg-secondary: #0f1424;
  --bg-tertiary: #151b2e;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --bg-input: rgba(255, 255, 255, 0.06);
  --bg-sidebar: rgba(10, 14, 26, 0.95);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-inverse: #0a0e1a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-purple);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-md); }
h6 { font-size: var(--font-size-base); }

img {
  max-width: 100%;
  height: auto;
}

ul, ol {
  list-style: none;
}

/* ---- Custom Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* ================================================================
   LAYOUT
   ================================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--bg-card-border);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  transition: transform var(--transition-slow);
  overflow-y: auto;
}

.sidebar-brand {
  padding: var(--space-6) var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--bg-card-border);
}

.sidebar-brand .brand-name {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.sidebar-brand .brand-tagline {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
}

.nav-section-title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-4) var(--space-3) var(--space-2);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  transition: all var(--transition-normal);
  margin-bottom: 2px;
  position: relative;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent-blue);
  border-radius: var(--radius-full);
}

.nav-link-icon {
  font-size: var(--font-size-lg);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-4);
  border-top: 1px solid var(--bg-card-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Topbar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  height: var(--topbar-height);
  background: var(--bg-sidebar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--bg-card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-8);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.topbar-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: var(--font-size-xl);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--bg-card);
}

.page-content {
  flex: 1;
  padding: var(--space-8);
  max-width: 1440px;
  width: 100%;
}

/* ================================================================
   COMPONENTS
   ================================================================ */

/* ---- Card ---- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-normal);
  animation: fadeIn 0.4s ease forwards;
}

.card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

.card-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
}

.card-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.card-body {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
}

.card-footer {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--bg-card-border);
}

.card-flat:hover {
  transform: none;
  box-shadow: none;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-normal);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

.btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
  box-shadow: var(--shadow-glow-blue);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--bg-card-border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
}

.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.btn-success {
  background: var(--accent-green);
  color: #fff;
  border-color: var(--accent-green);
}

.btn-success:hover {
  background: #059669;
  border-color: #059669;
  box-shadow: var(--shadow-glow-green);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
}

.btn-lg {
  padding: var(--space-3) var(--space-8);
  font-size: var(--font-size-md);
}

.btn-icon {
  padding: var(--space-2);
  width: 36px;
  height: 36px;
}

/* ---- Status Badges ---- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 10px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge--checked-in {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}
.status-badge--checked-in::before { background: var(--accent-green); }

.status-badge--checked-out {
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
}
.status-badge--checked-out::before { background: var(--accent-blue); }

.status-badge--missed {
  background: var(--accent-red-dim);
  color: var(--accent-red);
}
.status-badge--missed::before { background: var(--accent-red); }

.status-badge--pending {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-tertiary);
}
.status-badge--pending::before { background: var(--text-tertiary); }

/* ---- Blocker Badge ---- */
.blocker-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 10px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.blocker-badge--open {
  background: var(--accent-amber-dim);
  color: var(--accent-amber);
  animation: pulse-amber 2s ease-in-out infinite;
}

.blocker-badge--in-progress {
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
}

.blocker-badge--resolved {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}

/* ---- Avatar ---- */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: #fff;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  overflow: hidden;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.avatar--lg {
  width: 56px;
  height: 56px;
  font-size: var(--font-size-lg);
}

.avatar--xl {
  width: 80px;
  height: 80px;
  font-size: var(--font-size-2xl);
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-normal);
  animation: fadeIn 0.4s ease forwards;
}

.stat-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
}

.stat-card-icon--green { background: var(--accent-green-dim); }
.stat-card-icon--blue { background: var(--accent-blue-dim); }
.stat-card-icon--red { background: var(--accent-red-dim); }
.stat-card-icon--amber { background: var(--accent-amber-dim); }
.stat-card-icon--purple { background: var(--accent-purple-dim); }

.stat-card-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
}

.stat-card-value {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  line-height: 1;
  margin-top: var(--space-1);
}

/* ---- Table ---- */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--bg-card-border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.table thead {
  background: var(--bg-tertiary);
}

.table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.table td {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--bg-card-border);
  color: var(--text-primary);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--transition-fast);
}

.table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.table tbody tr:hover {
  background: var(--bg-card-hover);
}

.table-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.table-user-name {
  font-weight: var(--font-weight-medium);
}

/* ---- Progress Ring ---- */
.progress-ring {
  position: relative;
  width: 64px;
  height: 64px;
}

.progress-ring svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.progress-ring-bg {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 4;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--accent-green);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 175.93;
  stroke-dashoffset: 175.93;
  transition: stroke-dashoffset 0.6s ease;
}

.progress-ring-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
}

/* ---- Heatmap ---- */
.heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  max-width: 420px;
}

.heatmap-day-label {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  text-align: center;
  padding-bottom: var(--space-1);
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--bg-tertiary);
  position: relative;
  cursor: default;
  transition: transform var(--transition-fast);
}

.heatmap-cell:hover {
  transform: scale(1.2);
  z-index: 1;
}

.heatmap-cell--checked-in {
  background: var(--accent-green);
}

.heatmap-cell--checked-out {
  background: var(--accent-green);
  opacity: 0.7;
}

.heatmap-cell--missed {
  background: var(--accent-red);
}

.heatmap-cell--pending {
  background: var(--accent-amber);
  opacity: 0.5;
}

.heatmap-cell--off {
  background: var(--bg-tertiary);
  opacity: 0.3;
}

.heatmap-cell[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: var(--font-size-xs);
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.heatmap-cell:hover[data-tooltip]::after {
  opacity: 1;
}

/* ---- Insight Card ---- */
.insight-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition-normal);
  animation: fadeIn 0.4s ease forwards;
  display: flex;
  gap: var(--space-4);
}

.insight-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.insight-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  flex-shrink: 0;
}

.insight-icon--free_rider    { background: var(--accent-red-dim);    color: var(--accent-red); }
.insight-icon--overloaded     { background: var(--accent-amber-dim);  color: var(--accent-amber); }
.insight-icon--underutilized  { background: var(--accent-blue-dim);   color: var(--accent-blue); }
.insight-icon--bottleneck     { background: var(--accent-red-dim);    color: var(--accent-red); }
.insight-icon--declining      { background: var(--accent-amber-dim);  color: var(--accent-amber); }
.insight-icon--positive       { background: var(--accent-green-dim);  color: var(--accent-green); }

.insight-content {
  flex: 1;
  min-width: 0;
}

.insight-type {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.insight-summary {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}

.insight-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-3);
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

.confidence-bar {
  width: 60px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.confidence-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent-purple);
  transition: width var(--transition-slow);
}

/* ---- Empty State ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.3;
}

.empty-state-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state-description {
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
  max-width: 360px;
}

/* ---- Form Elements ---- */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-input);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  transition: border-color var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ---- Section ---- */
.section {
  margin-bottom: var(--space-8);
}

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

.section-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

/* ---- Grid layouts ---- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-6);
}

/* ---- Member Card ---- */
.member-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  transition: all var(--transition-normal);
  animation: fadeIn 0.4s ease forwards;
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
}

.member-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-blue);
  color: inherit;
}

.member-card .avatar {
  margin: 0 auto var(--space-4);
}

.member-card-name {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-1);
}

.member-card-role {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.member-card-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

.member-card-stat-value {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  display: block;
}

/* ---- Profile Header ---- */
.profile-header {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  padding: var(--space-6);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  animation: fadeIn 0.4s ease forwards;
}

.profile-info {
  flex: 1;
}

.profile-name {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-1);
}

.profile-details {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.profile-detail {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* ---- Checkin Card Component ---- */
.checkin-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition-normal);
  animation: fadeIn 0.4s ease forwards;
}

.checkin-card:hover {
  background: var(--bg-card-hover);
}

.checkin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.checkin-card-time {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

.checkin-card-tasks {
  margin-top: var(--space-3);
}

.checkin-card-tasks h5 {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.task-list {
  list-style: none;
  padding: 0;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.task-item::before {
  content: '▸';
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.task-item--done::before {
  content: '✓';
  color: var(--accent-green);
}

/* ---- Weekly Card ---- */
.weekly-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  animation: fadeIn 0.4s ease forwards;
  transition: all var(--transition-normal);
}

.weekly-card:hover {
  background: var(--bg-card-hover);
}

.weekly-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

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

.weekly-section-title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}

/* ---- Theme Toggle ---- */
.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-full);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  font-size: var(--font-size-base);
  color: var(--text-secondary);
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* ---- Blocker list item ---- */
.blocker-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4);
  border-bottom: 1px solid var(--bg-card-border);
}

.blocker-item:last-child {
  border-bottom: none;
}

.blocker-info {
  flex: 1;
  min-width: 0;
}

.blocker-description {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.blocker-meta {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  display: flex;
  gap: var(--space-3);
}

/* ---- Chart container ---- */
.chart-container {
  position: relative;
  width: 100%;
  padding: var(--space-4);
}

.chart-container canvas {
  max-height: 300px;
}

/* ================================================================
   LOGIN PAGE
   ================================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
  top: -100px;
  right: -100px;
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.06) 0%, transparent 70%);
  bottom: -80px;
  left: -80px;
  pointer-events: none;
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-10);
  max-width: 420px;
  width: 100%;
  text-align: center;
  position: relative;
  z-index: 1;
  animation: fadeIn 0.6s ease forwards;
}

.login-brand {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-extrabold);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple), var(--accent-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-2);
  letter-spacing: -0.03em;
}

.login-tagline {
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--space-10);
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-6);
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
}

.btn-google:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  color: #3c4043;
}

.btn-google:active {
  background: #e8eaed;
}

.btn-google svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ================================================================
   ANIMATIONS
   ================================================================ */

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

@keyframes pulse-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

/* Stagger animation for cards */
.card:nth-child(1)  { animation-delay: 0.05s; }
.card:nth-child(2)  { animation-delay: 0.10s; }
.card:nth-child(3)  { animation-delay: 0.15s; }
.card:nth-child(4)  { animation-delay: 0.20s; }
.card:nth-child(5)  { animation-delay: 0.25s; }
.stat-card:nth-child(1)  { animation-delay: 0.05s; }
.stat-card:nth-child(2)  { animation-delay: 0.10s; }
.stat-card:nth-child(3)  { animation-delay: 0.15s; }
.stat-card:nth-child(4)  { animation-delay: 0.20s; }
.insight-card:nth-child(1) { animation-delay: 0.05s; }
.insight-card:nth-child(2) { animation-delay: 0.10s; }
.insight-card:nth-child(3) { animation-delay: 0.15s; }
.member-card:nth-child(1) { animation-delay: 0.05s; }
.member-card:nth-child(2) { animation-delay: 0.10s; }
.member-card:nth-child(3) { animation-delay: 0.15s; }
.member-card:nth-child(4) { animation-delay: 0.20s; }
.member-card:nth-child(5) { animation-delay: 0.25s; }
.member-card:nth-child(6) { animation-delay: 0.30s; }

/* ---- HTMX indicator ---- */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-flex;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--bg-card-border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ---- Sidebar overlay on mobile ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-sidebar) - 1);
}

.sidebar-overlay.active {
  display: block;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    animation: slideInLeft var(--transition-slow) ease;
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: flex;
  }

  .page-content {
    padding: var(--space-4);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

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

  .grid-auto {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 0 var(--space-4);
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
  }

  .profile-details {
    justify-content: center;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card-value {
    font-size: var(--font-size-2xl);
  }

  .login-card {
    padding: var(--space-8) var(--space-6);
  }

  .login-brand {
    font-size: var(--font-size-3xl);
  }

  .table th,
  .table td {
    padding: var(--space-2) var(--space-3);
  }

  .heatmap {
    gap: 2px;
  }

  .topbar-title {
    font-size: var(--font-size-md);
  }
}

/* ---- Utility classes ---- */
.text-green  { color: var(--accent-green); }
.text-amber  { color: var(--accent-amber); }
.text-red    { color: var(--accent-red); }
.text-blue   { color: var(--accent-blue); }
.text-purple { color: var(--accent-purple); }
.text-muted  { color: var(--text-secondary); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

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

.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
