/* ============================================================================
   Dashboard Layout & Container
   ============================================================================ */

.wr-dashboard-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  gap: 1rem;
}

.wr-dashboard-loading .wr-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-soft, #e5e7eb);
  border-top-color: var(--accent-blue, #0ea5e9);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.wr-dashboard-loading p {
  color: var(--text-secondary, #6b7280);
  font-size: 0.875rem;
}

.wr-dashboard-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 0;
  background: var(--wr-bg, #ffffff);
}

.wr-dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-soft, #e5e7eb);
}

.wr-dashboard-header-title h1 {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary, #111827);
  margin: 0;
}

.wr-dashboard-header-title p {
  font-size: 0.875rem;
  color: var(--text-secondary, #6b7280);
  margin: 0.25rem 0 0 0;
}

.wr-dashboard-header-controls {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.wr-dashboard-control-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.wr-dashboard-control-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary, #111827);
}

.wr-dashboard-control-group input[type="number"] {
  width: 100px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 4px;
  background: var(--wr-surface, #f9fafb);
  color: var(--text-primary, #111827);
  font-size: 0.875rem;
}

.wr-dashboard-button-group {
  display: flex;
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 4px;
  background: var(--wr-surface, #f9fafb);
  overflow: hidden;
}

.wr-dashboard-toggle-btn,
.wr-dashboard-granularity-btn {
  flex: 1;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.wr-dashboard-toggle-btn:not(:last-child),
.wr-dashboard-granularity-btn:not(:last-child) {
  border-right: 1px solid var(--border-soft, #e5e7eb);
}

.wr-dashboard-toggle-btn.active,
.wr-dashboard-granularity-btn.active {
  background: var(--accent-blue, #0ea5e9);
  color: white;
}

.wr-dashboard-toggle-btn:hover,
.wr-dashboard-granularity-btn:hover {
  background: var(--accent-hover, #f3f4f6);
}

.wr-dashboard-toggle-btn.active:hover,
.wr-dashboard-granularity-btn.active:hover {
  background: var(--accent-blue-dark, #0284c7);
}

.wr-dashboard-refresh-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 4px;
  background: var(--wr-surface, #f9fafb);
  color: var(--text-primary, #111827);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.wr-dashboard-refresh-btn:hover {
  background: var(--accent-hover, #f3f4f6);
  transform: rotate(180deg);
}

/* ============================================================================
   KPI Strip (4-column card layout)
   ============================================================================ */

.wr-dashboard-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.wr-dashboard-kpi-card {
  padding: 1.25rem;
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 8px;
  background: var(--wr-surface, #f9fafb);
  position: relative;
  transition: all 0.2s ease;
}

.wr-dashboard-kpi-card:hover {
  border-color: var(--border-strong, #d1d5db);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wr-dashboard-kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary, #6b7280);
  margin-bottom: 0.5rem;
}

.wr-dashboard-kpi-value {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary, #111827);
  margin-bottom: 0.75rem;
  word-break: break-word;
}

.wr-dashboard-kpi-trend {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
}

.wr-dashboard-kpi-trend.positive {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.wr-dashboard-kpi-trend.negative {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.wr-dashboard-kpi-indicator {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-soft, #e5e7eb);
}

.wr-dashboard-kpi-status-green .wr-dashboard-kpi-indicator {
  background: #10b981;
}

.wr-dashboard-kpi-status-orange .wr-dashboard-kpi-indicator {
  background: #f59e0b;
}

.wr-dashboard-kpi-status-red .wr-dashboard-kpi-indicator {
  background: #ef4444;
}

/* ============================================================================
   Sections (einspaltiges Layout)
   ============================================================================ */

.wr-dashboard-section-header {
  margin-bottom: 1.5rem;
}

.wr-dashboard-section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary, #111827);
  margin: 0 0 0.25rem 0;
}

.wr-dashboard-section-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary, #6b7280);
  margin: 0;
}

/* ============================================================================
   Chart Container
   ============================================================================ */

.wr-dashboard-chart-placeholder {
  padding: 3rem 1.5rem;
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 8px;
  background: var(--wr-surface, #f9fafb);
  text-align: center;
}

.wr-dashboard-chart-placeholder .wr-btn {
  padding: 0.75rem 1.5rem;
  background: var(--accent-blue, #0ea5e9);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.wr-dashboard-chart-placeholder .wr-btn:hover {
  background: var(--accent-blue-dark, #0284c7);
}

.wr-dashboard-chart-container {
  padding: 1.5rem;
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 8px;
  background: var(--wr-surface, #f9fafb);
}

.wr-dashboard-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.wr-dashboard-chart-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary, #111827);
  margin: 0;
}

.wr-dashboard-chart-controls {
  display: flex;
  gap: 0.5rem;
}

.wr-dashboard-chart {
  width: 100%;
  height: 300px;
  overflow-x: auto;
}

.wr-dashboard-chart-svg {
  width: 100%;
  height: 100%;
  min-width: 600px;
}

/* ============================================================================
   Sections (einspaltiges Layout)
   ============================================================================ */

.wr-dashboard-section-header {
  margin-bottom: 1.5rem;
}

.wr-dashboard-section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary, #111827);
  margin: 0 0 0.25rem 0;
}

.wr-dashboard-section-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary, #6b7280);
  margin: 0;
}

/* ============================================================================
   Attention Section
   ============================================================================ */

.wr-dashboard-attention-section {
  margin-top: 2rem;
}

.wr-dashboard-attention-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  gap: 1rem;
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 8px;
  background: var(--wr-surface, #f9fafb);
}

.wr-attention-empty-icon {
  width: 48px;
  height: 48px;
  stroke: #10b981;
  stroke-width: 2;
  fill: none;
}

.wr-dashboard-attention-empty p {
  font-size: 0.875rem;
  color: var(--text-secondary, #6b7280);
  margin: 0;
}

.wr-dashboard-attention-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.wr-dashboard-attention-card {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 8px;
  background: var(--wr-bg, #ffffff);
  transition: all 0.2s ease;
}

.wr-dashboard-attention-card[data-attention-route]:not([data-attention-route=""]) {
  cursor: pointer;
}

.wr-dashboard-attention-card[data-attention-route]:not([data-attention-route=""]):hover {
  border-color: var(--accent-blue, #0ea5e9);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.1);
}

.wr-attention-info {
  border-left: 3px solid #0ea5e9;
}

.wr-attention-warn {
  border-left: 3px solid #f59e0b;
}

.wr-attention-critical {
  border-left: 3px solid #ef4444;
}

.wr-attention-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.wr-attention-info .wr-attention-icon {
  background: rgba(14, 165, 233, 0.1);
}

.wr-attention-warn .wr-attention-icon {
  background: rgba(245, 158, 11, 0.1);
}

.wr-attention-critical .wr-attention-icon {
  background: rgba(239, 68, 68, 0.1);
}

.wr-attention-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  fill: none;
}

.wr-attention-info .wr-attention-icon svg {
  stroke: #0ea5e9;
}

.wr-attention-warn .wr-attention-icon svg {
  stroke: #f59e0b;
}

.wr-attention-critical .wr-attention-icon svg {
  stroke: #ef4444;
}

.wr-attention-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wr-attention-text {
  font-size: 0.875rem;
  color: var(--text-primary, #111827);
  margin: 0;
  line-height: 1.5;
}

.wr-attention-cta {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-blue, #0ea5e9);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* ============================================================================
   Module Section
   ============================================================================ */

.wr-dashboard-modules-section {
  margin-top: 2rem;
}

.wr-dashboard-modules-section .wr-dashboard-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

@media (max-width: 768px) {
  .wr-dashboard-modules-section .wr-dashboard-module-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   Module Cards
   ============================================================================ */

.wr-dashboard-modules-container {
  padding: 1.5rem;
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 8px;
  background: var(--wr-surface, #f9fafb);
}

.wr-dashboard-modules-container h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #111827);
  margin: 0 0 0.25rem 0;
}

.wr-dashboard-modules-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary, #6b7280);
  margin: 0 0 1rem 0;
}

.wr-dashboard-module-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.wr-dashboard-module-card {
  padding: 1rem;
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 6px;
  background: var(--wr-bg, #ffffff);
  transition: all 0.2s ease;
}

.wr-dashboard-module-card.complete {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}

.wr-dashboard-module-card.partial {
  border-color: var(--border-soft, #e5e7eb);
}

/* Active Module */
.wr-module-active {
  cursor: pointer;
}

.wr-module-active:hover {
  border-color: var(--accent-blue, #0ea5e9);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.1);
}

/* Coming Soon Module */
.wr-module-coming-soon {
  opacity: 0.7;
  cursor: not-allowed;
  position: relative;
}

.wr-module-coming-soon::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--wr-surface, #f9fafb);
  opacity: 0.3;
  border-radius: 6px;
  pointer-events: none;
}

/* Locked Module */
.wr-module-locked {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.05);
  cursor: pointer;
}

.wr-module-locked:hover {
  border-color: #d97706;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}

.wr-dashboard-module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.wr-module-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wr-module-icon-small {
  width: 16px;
  height: 16px;
  stroke: var(--text-secondary, #6b7280);
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
}

.wr-dashboard-module-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary, #111827);
}

.wr-dashboard-module-status {
  font-size: 0.75rem;
  color: var(--text-secondary, #6b7280);
  background: var(--wr-surface, #f9fafb);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Module Badges */
.wr-dashboard-module-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid;
}

.wr-badge-coming-soon {
  color: var(--text-secondary, #6b7280);
  background: var(--wr-surface, #f3f4f6);
  border-color: var(--border-soft, #e5e7eb);
}

.wr-badge-locked {
  color: #d97706;
  background: #fef3c7;
  border-color: #fde68a;
}

/* Module Placeholder (Coming Soon / Locked) */
.wr-dashboard-module-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  gap: 0.5rem;
  text-align: center;
}

.wr-module-icon {
  width: 32px;
  height: 32px;
  stroke: var(--text-secondary, #9ca3af);
  stroke-width: 1.5;
  fill: none;
  opacity: 0.5;
}

.wr-dashboard-module-placeholder p {
  font-size: 0.75rem;
  color: var(--text-secondary, #6b7280);
  margin: 0;
}

.wr-module-lock-hint {
  max-width: 180px;
}

/* Module Hint (Active empty) */
.wr-dashboard-module-hint {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-soft, #e5e7eb);
  font-size: 0.75rem;
  color: var(--text-secondary, #6b7280);
  font-style: italic;
}

/* Module Meta Lines */
.wr-dashboard-module-meta {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-soft, #e5e7eb);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.wr-module-meta-line {
  font-size: 0.75rem;
  color: var(--text-secondary, #6b7280);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wr-dashboard-module-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.wr-dashboard-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border-soft, #e5e7eb);
  border-radius: 3px;
  overflow: hidden;
}

.wr-dashboard-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue, #0ea5e9), #10b981);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.wr-dashboard-progress-label {
  font-size: 0.75rem;
  color: var(--text-secondary, #6b7280);
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}

.wr-dashboard-module-issues {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-soft, #e5e7eb);
}

.wr-dashboard-issue {
  font-size: 0.75rem;
  color: #f59e0b;
  margin-bottom: 0.25rem;
}

/* ============================================================================
   Attention List (Sidebar right)
   ============================================================================ */

.wr-dashboard-attention-container {
  padding: 1.5rem;
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 8px;
  background: var(--wr-surface, #f9fafb);
}

.wr-dashboard-attention-container h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #111827);
  margin: 0 0 1rem 0;
}

.wr-dashboard-attention-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.wr-dashboard-attention-item {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 6px;
  background: var(--wr-bg, #ffffff);
  transition: all 0.2s ease;
}

.wr-dashboard-attention-item.wr-dashboard-attention-error {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
}

.wr-dashboard-attention-item.wr-dashboard-attention-warn {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.05);
}

.wr-dashboard-attention-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.wr-dashboard-attention-content {
  flex: 1;
}

.wr-dashboard-attention-content p {
  font-size: 0.875rem;
  color: var(--text-primary, #111827);
  margin: 0 0 0.5rem 0;
}

.wr-dashboard-attention-cta {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-blue, #0ea5e9);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-blue, #0ea5e9);
  transition: all 0.2s ease;
}

.wr-dashboard-attention-cta:hover {
  color: var(--accent-blue-dark, #0284c7);
  border-color: var(--accent-blue-dark, #0284c7);
}

/* ============================================================================
   Error State
   ============================================================================ */

.wr-dashboard-error {
  padding: 2rem;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.05);
  color: #dc2626;
  text-align: center;
  font-weight: 500;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 768px) {
  .wr-dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .wr-dashboard-header-controls {
    width: 100%;
    flex-direction: column;
  }

  .wr-dashboard-kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .wr-dashboard-main {
    grid-template-columns: 1fr;
  }

  .wr-dashboard-chart {
    height: 250px;
  }

  .wr-dashboard-actions-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .wr-dashboard-wrapper {
    gap: 1rem;
  }

  .wr-dashboard-kpi-strip {
    grid-template-columns: 1fr;
  }

  .wr-dashboard-kpi-card {
    padding: 1rem;
  }

  .wr-dashboard-kpi-value {
    font-size: 1.5rem;
  }

  .wr-dashboard-header-title h1 {
    font-size: 1.5rem;
  }

  .wr-dashboard-chart {
    height: 200px;
  }
}

/* ============================================================================
   Dark Mode Support
   ============================================================================ */

@media (prefers-color-scheme: dark) {
  .wr-dashboard-wrapper {
    background: var(--wr-bg-dark, #1f2937);
  }

  .wr-dashboard-header-title h1 {
    color: var(--text-primary-dark, #f3f4f6);
  }

  .wr-dashboard-header-title p {
    color: var(--text-secondary-dark, #9ca3af);
  }

  .wr-dashboard-kpi-card {
    background: var(--wr-surface-dark, #374151);
    border-color: var(--border-soft-dark, #4b5563);
  }

  .wr-dashboard-chart-container,
  .wr-dashboard-modules-container,
  .wr-dashboard-attention-section {
    background: var(--wr-surface-dark, #374151);
    border-color: var(--border-soft-dark, #4b5563);
  }
}
