/* ============================================================================
   DASHBOARD STYLES - Premium Server Management Dashboard
   DayZ Server Manager Pro v3.0
   ============================================================================ */

/* ---- Stats Row ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stats-row .stat-card {
  position: relative;
  padding: 22px 24px;
  gap: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Glow orb behind each stat card on hover */
.stats-row .stat-card::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.5s ease;
  filter: blur(50px);
  pointer-events: none;
}

/* Top highlight line */
.stats-row .stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.06) 50%, transparent 100%);
  pointer-events: none;
}

.stats-row .stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.stats-row .stat-card:hover::before {
  opacity: 1;
}

.stats-row .stat-card:nth-child(1)::before { background: var(--accent); }
.stats-row .stat-card:nth-child(2)::before { background: var(--accent-secondary); }
.stats-row .stat-card:nth-child(3)::before { background: var(--accent-blue); }
.stats-row .stat-card:nth-child(4)::before { background: var(--warning); }

/* Colored top accent per card */
.stats-row .stat-card:nth-child(1) { border-top: 2px solid rgba(0, 255, 136, 0.4); }
.stats-row .stat-card:nth-child(2) { border-top: 2px solid rgba(124, 58, 237, 0.4); }
.stats-row .stat-card:nth-child(3) { border-top: 2px solid rgba(59, 130, 246, 0.4); }
.stats-row .stat-card:nth-child(4) { border-top: 2px solid rgba(245, 158, 11, 0.4); }

.stats-row .stat-card .stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stats-row .stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 8px;
  transition: transform var(--transition-base);
}

.stats-row .stat-card:hover .stat-icon {
  transform: scale(1.1);
}

.stats-row .stat-card .stat-value {
  font-size: 34px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.stats-row .stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.stats-row .stat-card .stat-change {
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.stat-change.positive {
  color: var(--success);
  background: var(--success-dim);
}

.stat-change.negative {
  color: var(--danger);
  background: var(--danger-dim);
}

.stat-change .trend-arrow {
  font-size: 10px;
}

.stat-change.positive .trend-arrow::before {
  content: '\25B2';
}

.stat-change.negative .trend-arrow::before {
  content: '\25BC';
}

/* ---- Instance Cards ---- */
.instance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.instance-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
}

.instance-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
}

.instance-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.instance-card-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.instance-card-header h3 {
  font-size: 15px;
  font-weight: 650;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.instance-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all var(--transition-base);
}

.instance-status-dot.online {
  background: var(--success);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
  animation: pulse-dot 2s ease-in-out infinite;
}

.instance-status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.instance-status-dot.restarting {
  background: var(--warning);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
  animation: pulse-dot 1s ease-in-out infinite;
}

.instance-card-body {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.instance-card-body .info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.instance-card-body .info-row .label {
  color: var(--text-secondary);
}

.instance-card-body .info-row .value {
  color: var(--text-primary);
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}

/* Player count bar */
.player-count-bar {
  margin-top: 4px;
}

.player-count-bar .bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.player-count-bar .bar-header .count {
  color: var(--text-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.player-count-bar .progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.player-count-bar .progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent), var(--accent-muted));
  transition: width 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
}

.player-count-bar .progress-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  animation: shimmer 2.5s ease infinite;
}

.player-count-bar .progress-bar-fill.high {
  background: linear-gradient(90deg, var(--warning), #fbbf24);
}

.player-count-bar .progress-bar-fill.critical {
  background: linear-gradient(90deg, var(--danger), #f87171);
}

.instance-card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.instance-card-footer .btn {
  flex: 1;
}

/* ---- Chart Container ---- */
.chart-container {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 28px;
  transition: all var(--transition-base);
  position: relative;
}

.chart-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
}

.chart-container:hover {
  border-color: var(--border-light);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.chart-header h3 {
  font-size: 16px;
  font-weight: 650;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.02em;
}

.chart-period-selector {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.chart-period-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--transition-base);
}

.chart-period-btn:hover {
  color: var(--text-primary);
}

.chart-period-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.chart-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 220px;
}

.chart-canvas-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ---- Activity Log ---- */
.activity-log {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}

.activity-log:hover {
  border-color: var(--border-light);
}

.activity-log-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 650;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: -0.02em;
}

.activity-log-body {
  max-height: 400px;
  overflow-y: auto;
}

.activity-item {
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  transition: background var(--transition-fast);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.activity-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: transform var(--transition-base);
}

.activity-item:hover .activity-icon {
  transform: scale(1.08);
}

.activity-icon.join    { background: var(--accent-dim);  color: var(--accent); }
.activity-icon.leave   { background: var(--danger-dim);  color: var(--danger); }
.activity-icon.kill    { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.activity-icon.restart { background: var(--warning-dim); color: var(--warning); }
.activity-icon.admin   { background: var(--accent-secondary-dim); color: var(--accent-secondary); }
.activity-icon.system  { background: var(--info-dim);    color: var(--info); }
.activity-icon.economy { background: rgba(245, 158, 11, 0.12); color: var(--warning); }

.activity-text {
  flex: 1;
  color: var(--text-primary);
  line-height: 1.4;
}

.activity-text strong {
  font-weight: 600;
}

.activity-event-badge {
  display: inline-flex;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 6px;
}

.activity-event-badge.join    { background: var(--accent-dim);  color: var(--accent); }
.activity-event-badge.leave   { background: var(--danger-dim);  color: var(--danger); }
.activity-event-badge.kill    { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.activity-event-badge.restart { background: var(--warning-dim); color: var(--warning); }
.activity-event-badge.admin   { background: var(--accent-secondary-dim); color: var(--accent-secondary); }
.activity-event-badge.system  { background: var(--info-dim);    color: var(--info); }

.activity-time {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ---- Quick Actions ---- */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.quick-action-btn {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  color: var(--text-primary);
  text-decoration: none;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.quick-action-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0, 255, 136, 0.03) 100%);
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.quick-action-btn:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow-accent);
}

.quick-action-btn:hover::after {
  opacity: 1;
}

.quick-action-btn:active {
  transform: translateY(-1px);
}

.quick-action-btn .action-icon {
  font-size: 24px;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  transition: all var(--transition-base);
}

.quick-action-btn:hover .action-icon {
  background: var(--accent-dim);
  color: var(--accent);
  transform: scale(1.08);
}

.quick-action-btn .action-label {
  font-size: 12px;
  font-weight: 550;
}

/* ---- Economy Health ---- */
.economy-health {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.health-metric {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: all var(--transition-base);
  position: relative;
}

.health-metric::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
}

.health-metric:hover {
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.metric-name {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.metric-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.health-metric .progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.health-metric .progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
}

.health-metric .progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 2.5s ease infinite;
}

.health-metric .progress-fill.healthy {
  background: linear-gradient(90deg, var(--success), #34d399);
}

.health-metric .progress-fill.moderate {
  background: linear-gradient(90deg, var(--warning), #fbbf24);
}

.health-metric .progress-fill.critical {
  background: linear-gradient(90deg, var(--danger), #f87171);
}

.health-metric .metric-detail {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ---- Server Status Indicators ---- */
.server-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition-base);
}

.server-status.online {
  background: var(--success-dim);
  color: var(--success);
}

.server-status.online .status-dot {
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  animation: pulse-dot 2s ease-in-out infinite;
}

.server-status.offline {
  background: var(--danger-dim);
  color: var(--danger);
}

.server-status.offline .status-dot {
  background: var(--danger);
}

.server-status.restarting {
  background: var(--warning-dim);
  color: var(--warning);
}

.server-status.restarting .status-dot {
  background: var(--warning);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
  animation: pulse-dot 1s ease-in-out infinite;
}

/* ---- Dashboard Welcome / Empty State ---- */
.dashboard-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 32px;
  text-align: center;
  animation: fadeIn 0.5s ease;
}

.dashboard-welcome .welcome-icon {
  font-size: 72px;
  color: var(--text-muted);
  margin-bottom: 28px;
  opacity: 0.35;
}

.dashboard-welcome h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}

.dashboard-welcome p {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 480px;
  margin-bottom: 32px;
  line-height: 1.7;
}

.dashboard-welcome .btn {
  font-size: 14px;
  padding: 10px 28px;
}

/* ---- Two Column Layout ---- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

/* ---- Dashboard Section Headers ---- */
.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dash-section-header h2 {
  font-size: 18px;
  font-weight: 650;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.dash-section-header .section-actions {
  display: flex;
  gap: 8px;
}

/* ---- Uptime Display ---- */
.uptime-display {
  display: flex;
  gap: 14px;
  align-items: center;
}

.uptime-segment {
  text-align: center;
}

.uptime-segment .uptime-val {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.uptime-segment .uptime-unit {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 3px;
}

.uptime-separator {
  font-size: 20px;
  color: var(--text-dim);
  font-weight: 300;
  margin-top: -10px;
  animation: pulse 2s ease-in-out infinite;
}

/* ---- Recent Restarts Timeline ---- */
.restart-timeline {
  position: relative;
  padding-left: 22px;
}

.restart-timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--border), var(--border));
  border-radius: 1px;
}

.restart-item {
  position: relative;
  padding: 10px 0;
  padding-left: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: opacity var(--transition-base);
}

.restart-item:hover {
  opacity: 0.85;
}

.restart-item::before {
  content: '';
  position: absolute;
  left: -18px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--accent);
  transition: all var(--transition-base);
}

.restart-item:first-child::before {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.restart-item .restart-time {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 550;
}

.restart-item .restart-reason {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ---- Responsive ---- */
@media (max-width: 1200px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .stats-row {
    grid-template-columns: 1fr;
  }

  .instance-grid {
    grid-template-columns: 1fr;
  }

  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .economy-health {
    grid-template-columns: 1fr;
  }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .chart-canvas-wrapper {
    height: 180px;
  }
}

@media (max-width: 480px) {
  .stats-row .stat-card .stat-value {
    font-size: 26px;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .dashboard-welcome {
    padding: 48px 20px;
  }

  .dashboard-welcome h2 {
    font-size: 22px;
  }
}
