/* Dashboard CSS - Phase 4.4 */

/* Override body flex centering from style-enhanced.css */
body {
  display: block !important;
  padding: 0 !important;
  align-items: stretch !important;
  background: #f0f2f5 !important;
}

.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  min-height: calc(100vh - 52px);
  background: #f0f2f5;
  width: 100%;
  box-sizing: border-box;
}

/* Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e0e0e0;
}

.dashboard-header h1 {
  margin: 0;
  color: #1976d2;
  font-size: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.last-update {
  font-size: 12px;
  color: #999;
}

/* KPI Leiste */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.kpi-icon {
  font-size: 32px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  flex-shrink: 0;
}

.kpi-icon.meetings { background: #e3f2fd; }
.kpi-icon.auftraege { background: #fff3e0; }
.kpi-icon.deadlines { background: #fce4ec; }
.kpi-icon.notifications { background: #e8f5e9; }

.kpi-content {
  flex: 1;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: #333;
  line-height: 1;
}

.kpi-label {
  font-size: 13px;
  color: #999;
  margin-top: 4px;
}

/* Widget Grid */
.widget-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 20px;
  margin-bottom: 24px;
}

.widget {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.widget.full-width {
  grid-column: 1 / -1;
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafbfc;
}

.widget-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

.widget-actions {
  display: flex;
  gap: 8px;
}

.widget-body {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
  max-height: 400px;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-primary { background: #1976d2; color: white; }
.btn-primary:hover { background: #1565c0; }
.btn-secondary { background: #f5f5f5; color: #333; }
.btn-secondary:hover { background: #e0e0e0; }
.btn-small { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; min-width: 32px; justify-content: center; }

/* Status Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-warning { background: #fff3e0; color: #e65100; }
.badge-danger { background: #ffebee; color: #c62828; }
.badge-info { background: #e3f2fd; color: #1565c0; }
.badge-neutral { background: #f5f5f5; color: #666; }

/* Timeline */
.timeline {
  position: relative;
  padding-left: 30px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e0e0e0;
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: #fafbfc;
  border-radius: 8px;
  border-left: 3px solid #1976d2;
  cursor: pointer;
  transition: background 0.2s;
}

.timeline-item:hover {
  background: #f0f4ff;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -26px;
  top: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1976d2;
  border: 2px solid white;
  box-shadow: 0 0 0 2px #1976d2;
}

.timeline-item.completed::before { background: #4caf50; box-shadow: 0 0 0 2px #4caf50; }
.timeline-item.completed { border-left-color: #4caf50; }
.timeline-item.cancelled::before { background: #999; box-shadow: 0 0 0 2px #999; }
.timeline-item.cancelled { border-left-color: #999; }
.timeline-item.running::before { background: #ff9800; box-shadow: 0 0 0 2px #ff9800; animation: pulse 1.5s infinite; }
.timeline-item.running { border-left-color: #ff9800; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.timeline-date {
  font-size: 12px;
  color: #999;
  margin-bottom: 4px;
}

.timeline-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.timeline-meta {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
  display: flex;
  gap: 12px;
}

/* Auftraege Board */
.board-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.board-column {
  background: #f7f8fa;
  border-radius: 8px;
  padding: 12px;
}

.board-column-header {
  font-size: 13px;
  font-weight: 600;
  color: #666;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.board-column-count {
  background: #e0e0e0;
  color: #666;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

.board-card {
  background: white;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.board-card:hover {
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.board-card-title {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  margin-bottom: 8px;
  line-height: 1.4;
}

.board-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #999;
}

.board-card-assignee {
  display: flex;
  align-items: center;
  gap: 4px;
}

.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.priority-dot.hoch { background: #f44336; }
.priority-dot.mittel { background: #ff9800; }
.priority-dot.niedrig { background: #4caf50; }

/* Fristen Kalender */
.deadline-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.deadline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

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

.deadline-date {
  min-width: 80px;
  font-size: 13px;
  font-weight: 600;
}

.deadline-date.overdue { color: #c62828; }
.deadline-date.critical { color: #e65100; }
.deadline-date.warning { color: #f9a825; }
.deadline-date.ok { color: #2e7d32; }

.deadline-text {
  flex: 1;
  font-size: 13px;
  color: #333;
}

.deadline-assignee {
  font-size: 12px;
  color: #999;
}

/* Service Status */
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.service-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fafbfc;
  border-radius: 8px;
}

.service-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.service-dot.active { background: #4caf50; }
.service-dot.inactive { background: #ccc; }
.service-dot.error { background: #f44336; }

.service-name {
  font-size: 13px;
  color: #333;
  font-weight: 500;
}

.service-detail {
  font-size: 11px;
  color: #999;
}

/* Notification Log */
.notification-log-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
}

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

.notification-time {
  min-width: 70px;
  color: #999;
  font-size: 11px;
}

.notification-text {
  flex: 1;
  color: #333;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 14px;
}

/* Live Indicator */
.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #4caf50;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4caf50;
  animation: pulse 2s infinite;
}

/* Responsive */
@media (max-width: 1024px) {
  .widget-grid {
    grid-template-columns: 1fr;
  }
  .board-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .dashboard-container {
    padding: 8px;
  }
  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .kpi-card {
    padding: 12px;
  }
  .kpi-card .kpi-value {
    font-size: 24px;
  }
  .kpi-card .kpi-label {
    font-size: 11px;
  }
  .widget-grid {
    gap: 12px;
  }
  .widget {
    padding: 12px;
  }
  .widget-header {
    font-size: 14px;
  }
  .btn {
    min-height: 44px;
    min-width: 44px;
  }
  .timeline-item, .board-card, .notification-item {
    padding: 10px;
  }
}

/* PWA Standalone Mode */
@media (display-mode: standalone) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* Push Permission Banner */
.push-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  font-size: 14px;
  animation: slideDown 0.3s ease;
}

.push-banner-text {
  flex: 1;
}

.push-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.push-banner .btn-push-allow {
  background: white;
  color: #667eea;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}

.push-banner .btn-push-dismiss {
  background: rgba(255,255,255,0.2);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
}

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

/* Offline Indicator */
.offline-indicator {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #ff9800;
  color: white;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}

.offline-indicator.visible {
  display: flex;
}

.offline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
}