/* ============================================
   Align Health Collective — Dashboard Demo Styles
   Loaded on: dashboard-demo.html only
   Dark sidebar + light content area
   ============================================ */

/* Dashboard Layout — offset below consulting nav (64px / 4rem) */
.dashboard-layout {
  display: flex;
  min-height: calc(100vh - 4rem);
  margin-top: 4rem;
}

/* Sidebar */
.dashboard-sidebar {
  width: 260px;
  background: #1E293B;
  color: #CBD5E1;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 4rem;
  left: 0;
  bottom: 0;
  z-index: 40;
  overflow-y: auto;
}

.dashboard-sidebar-logo {
  padding: 1.5rem;
  border-bottom: 1px solid #334155;
}

.dashboard-sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.dashboard-sidebar-nav a,
.dashboard-sidebar-nav button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.625rem 1.5rem;
  font-size: 0.875rem;
  color: #94A3B8;
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease;
  text-align: left;
}

.dashboard-sidebar-nav a:hover,
.dashboard-sidebar-nav button:hover {
  color: #E2E8F0;
  background: #334155;
}

.dashboard-sidebar-nav .nav-active {
  color: #FFFFFF;
  background: #334155;
  border-right: 3px solid #0D9488;
}

.dashboard-sidebar-nav .nav-disabled {
  color: #475569;
  cursor: not-allowed;
  pointer-events: none;
}

.dashboard-sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid #334155;
  font-size: 0.75rem;
}

/* Main Content Area */
.dashboard-main {
  flex: 1;
  margin-left: 260px;
  background: #F8FAFC;
  min-height: 100vh;
}

/* Dashboard Header */
.dashboard-header {
  background: #FFFFFF;
  border-bottom: 1px solid #E2E8F0;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

/* KPI Category Toggle */
.kpi-category-toggle {
  display: flex;
  gap: 0.25rem;
  background: #F1F5F9;
  border-radius: 0.5rem;
  padding: 0.25rem;
}

.kpi-cat-btn {
  padding: 0.375rem 0.875rem;
  border-radius: 0.375rem;
  border: none;
  background: transparent;
  color: #64748B;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.kpi-cat-btn.is-active {
  background: #0D9488;
  color: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.kpi-cat-btn:hover:not(.is-active) {
  color: #0D9488;
}

/* Recommendation Cards */
.recommendation-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 0.75rem;
  padding: 1.25rem;
  border-left: 4px solid #7C3AED;
}

.recommendation-action {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #FFFFFF;
  background: #7C3AED;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.recommendation-action:hover {
  background: #6D28D9;
}

/* Metric Cards */
.metric-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 0.75rem;
  padding: 1.25rem;
  transition: box-shadow 200ms ease;
}

.metric-card:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.metric-value {
  font-variant-numeric: tabular-nums;
}

.metric-change--positive {
  color: #10B981;
}

.metric-change--negative {
  color: #EF4444;
}

/* Chart Containers */
.chart-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.chart-canvas-container {
  position: relative;
  width: 100%;
}

/* Tab Switcher */
.tab-group {
  display: flex;
  gap: 0.25rem;
  background: #F1F5F9;
  border-radius: 0.5rem;
  padding: 0.25rem;
}

.tab-btn {
  padding: 0.375rem 0.875rem;
  border-radius: 0.375rem;
  border: none;
  background: transparent;
  color: #64748B;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.tab-btn.is-active {
  background: #FFFFFF;
  color: #0F172A;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tab-btn:hover:not(.is-active) {
  color: #0F172A;
}

/* Mobile sidebar toggle */
.dashboard-mobile-toggle {
  display: none;
}

/* Mobile sidebar overlay */
.dashboard-sidebar-overlay {
  display: none;
}

/* View Tabs */
.view-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0 2rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.view-tab {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748B;
  background: transparent;
  border: 1px solid #E2E8F0;
  border-radius: 0.5rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.view-tab:hover {
  color: #0D9488;
  border-color: #0D9488;
}

.view-tab--active {
  color: #FFFFFF;
  background: #0D9488;
  border-color: #0D9488;
}

/* AI Insights Panel */
.insight-panel {
  margin-bottom: 0;
  max-width: 100%;
  overflow: hidden;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 600;
  color: #0D9488;
  background: #CCFBF1;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.insight-card {
  background: #FFFFFF;
  border-radius: 0.75rem;
  padding: 1.25rem;
  border: 1px solid #E2E8F0;
  border-left: 4px solid transparent;
}

.insight-card--high { border-left: 4px solid #EF4444 !important; }
.insight-card--medium { border-left: 4px solid #F97316 !important; }
.insight-card--low { border-left: 4px solid #EAB308 !important; }

/* Priority badges */
.insight-priority {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.5625rem;
  font-weight: 700;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.insight-priority--high { color: #991B1B; background: #FEE2E2; }
.insight-priority--medium { color: #9A3412; background: #FFEDD5; }
.insight-priority--low { color: #854D0E; background: #FEF9C3; }

.insight-action {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #92400E;
  background: #FEF3C7;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.insight-action:hover { background: #FDE68A; }
.insight-action--high { color: #991B1B; background: #FEE2E2; }
.insight-action--high:hover { background: #FECACA; }
.insight-action--medium { color: #9A3412; background: #FFEDD5; }
.insight-action--medium:hover { background: #FED7AA; }
.insight-action--low { color: #854D0E; background: #FEF9C3; }
.insight-action--low:hover { background: #FEF08A; }

/* Desktop: horizontal scroll for insight cards — show 3 at a time, scroll for rest */
@media (min-width: 1024px) {
  .insight-scroll-container {
    display: flex !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .insight-scroll-container .insight-scroll-item {
    flex: 0 0 calc(33.333% - 0.75rem);
  }
}

/* Spreadsheet Section */
.spreadsheet-section {
  margin-top: 0;
}

.spreadsheet-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 0.75rem;
  overflow: hidden;
}

.spreadsheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #E2E8F0;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.spreadsheet-tabs {
  display: flex;
  gap: 0.25rem;
}

.spreadsheet-tab {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748B;
  background: transparent;
  border: 1px solid #E2E8F0;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease;
}

.spreadsheet-tab:hover { color: #0D9488; border-color: #0D9488; }
.spreadsheet-tab--active { color: #FFFFFF; background: #0D9488; border-color: #0D9488; }

.spreadsheet-body {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  font-size: 0.8125rem;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  color: #334155;
  border-bottom: 1px solid #F1F5F9;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table .ai-col {
  position: relative;
}

.ai-col-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.0625rem 0.375rem;
  font-size: 0.5625rem;
  font-weight: 700;
  color: #0D9488;
  background: #CCFBF1;
  border-radius: 9999px;
  margin-left: 0.25rem;
  vertical-align: middle;
}

.risk-low { color: #059669; font-weight: 600; }
.risk-medium { color: #D97706; font-weight: 600; }
.risk-high { color: #DC2626; font-weight: 600; }
.risk-critical { color: #991B1B; font-weight: 700; }

.status-active { color: #059669; }
.status-at-risk { color: #D97706; }
.status-lapsed { color: #DC2626; }
.status-approved { color: #059669; }
.status-pending { color: #D97706; }
.status-review { color: #2563EB; }

/* Charts section wrapper for view toggling */
.charts-section { transition: opacity 200ms ease; }
.charts-section.is-hidden { display: none; }

/* Responsive — mobile: collapse sidebar */
@media (max-width: 1023px) {
  .dashboard-sidebar {
    transform: translateX(-100%);
    transition: transform 300ms ease;
  }

  .dashboard-sidebar.is-open {
    transform: translateX(0);
  }

  .dashboard-sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 39;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
  }

  .dashboard-sidebar-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .dashboard-main {
    margin-left: 0;
    overflow-x: hidden;
  }

  .dashboard-header {
    padding: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .dashboard-mobile-toggle {
    display: flex;
  }
}

/* Small screens: stack header controls vertically */
@media (max-width: 640px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-header > .flex:last-child {
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
  }
}

/* Metric cards: prevent text overflow */
.metric-card {
  min-width: 0;
  overflow: hidden;
}

.metric-card p {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Spreadsheet section responsive */
.spreadsheet-section {
  max-width: 100%;
  overflow: hidden;
}
