/* ═══════════════════════════════════════════════════════════
   RIS - Rezept Index System
   Modul E - Activity Dashboard Styles
   ═══════════════════════════════════════════════════════════ */

/* Dashboard Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--bg-border);
}

.dashboard-title-group {
  flex: 1;
}

.dashboard-title {
  font-size: var(--font-2xl);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-xs) 0;
}

.dashboard-subtitle {
  font-size: var(--font-md);
  color: var(--text-secondary);
  margin: 0;
}

.dashboard-controls {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Auto-Refresh Toggle */
.auto-refresh-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  user-select: none;
}

.auto-refresh-toggle input[type="checkbox"] {
  display: none;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--font-sm);
  transition: all var(--transition-base);
}

.auto-refresh-toggle:hover .toggle-label {
  border-color: var(--accent);
}

.auto-refresh-toggle input:checked + .toggle-label {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-base);
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--transition-base);
}

.auto-refresh-toggle input:checked + .toggle-label .pulse-indicator {
  background: white;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  transition: all var(--transition-base);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.stat-icon {
  font-size: 32px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: var(--font-2xl);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: var(--space-xs);
}

.stat-label {
  font-size: var(--font-sm);
  color: var(--text-muted);
  margin: 0;
}

/* Kreisdiagramm Card (als 5. stat-card) */
.stat-card.chart-card .stat-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  height: 100%;
}

.chart-title {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  text-align: center;
}

.chart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  flex: 1;
}

.pie-chart {
  width: 100px;
  height: 100px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
}

.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  font-size: 11px;
  line-height: 1.2;
}

.legend-color {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 6px;
  flex-shrink: 0;
}

.legend-label {
  flex: 1;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 10px;
}

.legend-value {
  font-weight: 600;
  color: var(--text-primary);
  margin-left: 4px;
  font-size: 11px;
}

.legend-percentage {
  color: var(--text-muted);
  font-size: 10px;
  margin-left: 3px;
}

/* Dashboard Section */
.dashboard-section {
  margin-bottom: var(--space-2xl);
}

.section-title {
  font-size: var(--font-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-lg) 0;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--bg-border);
}

/* Activity Table */
.table-container {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.activity-table thead {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bg-border);
}

.activity-table th {
  padding: var(--space-md) var(--space-lg);
  text-align: left;
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.activity-table td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--bg-border);
  color: var(--text-primary);
}

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

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

.table-empty {
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-2xl) !important;
}

/* Badges */
.indexierung-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--font-xs);
  font-weight: 600;
  white-space: nowrap;
}

.indexierung-badge.ki-korrekt {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.indexierung-badge.ki-korrigiert {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
}

.indexierung-badge.manuell {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--font-xs);
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.approved {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.status-badge.pending {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
}

.status-badge.rejected {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Activity Feed */
.activity-feed {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  max-height: 600px;
  overflow-y: auto;
}

/* Notiz Feed */
.notiz-feed {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-lg);
}

.notiz-feed-card {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  box-shadow: var(--shadow-sm);
}

.notiz-feed-card-header,
.notiz-feed-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-sm);
}

.notiz-feed-category {
  text-transform: uppercase;
  font-size: var(--font-xs);
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-secondary);
}

.notiz-feed-category--allgemein { color: #a1a1aa; }
.notiz-feed-category--einkauf { color: #38bdf8; }
.notiz-feed-category--lager { color: #fb923c; }
.notiz-feed-category--rezept { color: #22c55e; }
.notiz-feed-category--menu { color: #c084fc; }

.notiz-feed-title {
  font-size: var(--font-lg);
  font-weight: var(--font-weight-semibold);
  margin: 0;
}

.notiz-feed-text {
  color: var(--text-secondary);
  margin: 0;
  line-height: var(--line-height-relaxed);
}

.notiz-feed-author {
  color: var(--text-muted);
}

.notiz-feed-status {
  font-weight: var(--font-weight-semibold);
  color: var(--accent);
}

.notiz-feed-status.is-done {
  color: var(--status-ok);
}

.notiz-feed-empty {
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--bg-border);
  border-radius: var(--radius-lg);
}

.activity-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  border-left: 2px solid var(--bg-border);
  margin-left: 20px;
  position: relative;
  transition: all var(--transition-base);
}

.activity-item:hover {
  background: var(--bg-surface);
  border-left-color: var(--accent);
}

.activity-item::before {
  content: '';
  position: absolute;
  left: -9px;
  top: 20px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--accent);
}

.activity-icon {
  font-size: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

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

.activity-title {
  font-size: var(--font-md);
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 var(--space-xs) 0;
}

.activity-description {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin: 0 0 var(--space-xs) 0;
}

.activity-time {
  font-size: var(--font-xs);
  color: var(--text-muted);
  cursor: help;
}

.activity-empty {
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-2xl);
}

/* Chat-Log Grid */
.chat-log-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.chat-log-card {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
}

.chat-log-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.chat-log-message {
  font-size: var(--font-sm);
  color: var(--text-primary);
  margin: 0 0 var(--space-md) 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat-log-time {
  font-size: var(--font-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.chat-log-time::before {
  content: '💬';
  font-size: 14px;
}

.chat-log-empty {
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-2xl);
  grid-column: 1 / -1;
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    gap: var(--space-lg);
  }
  
  .stats-row {
    grid-template-columns: 1fr;
  }
  
  .activity-table {
    font-size: var(--font-sm);
  }
  
  .activity-table th,
  .activity-table td {
    padding: var(--space-sm) var(--space-md);
  }
  
  .chat-log-grid {
    grid-template-columns: 1fr;
  }
}
