/* === Premium Dashboard CSS Overlay === */
/* Injected on top of existing dashboard to add premium UX elements */

/* Metric KPI Tiles - Premium version */
.premium-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.kpi-tile {
  background: #0c0c18;
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.kpi-tile:hover {
  border-color: rgba(99,102,241,0.15);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon svg {
  width: 18px;
  height: 18px;
}

.kpi-body {
  flex: 1;
  min-width: 0;
}

.kpi-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #f0f0f5;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.kpi-label {
  font-size: 0.7rem;
  color: #68687a;
  font-weight: 500;
  margin-top: 2px;
}

.kpi-trend {
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
}

.kpi-trend.up { color: #22c55e; }
.kpi-trend.down { color: #ef4444; }
.kpi-trend.neutral { color: #68687a; }

/* Filter Chip Bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.filter-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.chip {
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.06);
  background: transparent;
  color: #68687a;
  transition: all 0.15s;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chip:hover {
  border-color: rgba(255,255,255,0.12);
  color: #b4b4c0;
}

.chip.active {
  background: rgba(99,102,241,0.1);
  border-color: rgba(99,102,241,0.2);
  color: #a5b4fc;
}

.chip .count {
  background: rgba(255,255,255,0.04);
  padding: 1px 6px;
  border-radius: 100px;
  font-size: 0.65rem;
  min-width: 16px;
  text-align: center;
}

.chip.active .count {
  background: rgba(99,102,241,0.15);
}

.filter-search {
  flex: 1;
  max-width: 240px;
  position: relative;
}

.filter-search input {
  width: 100%;
  padding: 6px 10px 6px 28px;
  background: #0a0a14;
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 0.75rem;
  outline: none;
  font-family: inherit;
}

.filter-search input:focus {
  border-color: rgba(99,102,241,0.2);
}

.filter-search svg {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  color: #444;
  pointer-events: none;
}

/* Active filter tags */
.active-filters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.65rem;
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.1);
  color: #a5b4fc;
  cursor: pointer;
  transition: all 0.12s;
}

.filter-tag:hover {
  background: rgba(99,102,241,0.12);
}

.filter-tag .x {
  font-size: 0.7rem;
  opacity: 0.6;
}

/* Premium Site Rows */
.premium-list .site-card {
  background: #0c0c18;
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 12px;
  margin-bottom: 4px;
  transition: all 0.2s;
  overflow: hidden;
}

.premium-list .site-card:hover {
  border-color: rgba(99,102,241,0.1);
  background: #0e0e1c;
}

.premium-list .site-main {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 0;
  padding: 12px 16px;
  cursor: pointer;
  align-items: center;
}

.premium-list .status-bar {
  width: 4px;
  border-radius: 2px;
  height: 32px;
  margin-right: 12px;
  flex-shrink: 0;
}

.premium-list .status-bar.up { background: #22c55e; }
.premium-list .status-bar.down { background: #ef4444; }
.premium-list .status-bar.paused { background: #f59e0b; }
.premium-list .status-bar.ssl { background: #f59e0b; }
.premium-list .status-bar.pending { background: #68687a; }

.premium-list .site-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: 12px;
  flex: 1;
}

.premium-list .site-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #e8e8f0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.premium-list .site-url {
  font-size: 0.68rem;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.premium-list .site-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.premium-list .resp-badge {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(99,102,241,0.08);
  color: #a5b4fc;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.premium-list .resp-badge.slow {
  background: rgba(239,68,68,0.08);
  color: #ef4444;
}

.premium-list .resp-badge.medium {
  background: rgba(245,158,11,0.08);
  color: #f59e0b;
}

.premium-list .uptime-badge {
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 48px;
  text-align: right;
}

.premium-list .uptime-badge.high { color: #22c55e; }
.premium-list .uptime-badge.medium { color: #f59e0b; }
.premium-list .uptime-badge.low { color: #ef4444; }

/* Sparkline inline */
.site-sparkline {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 20px;
  margin-right: 8px;
  flex-shrink: 0;
  width: 80px;
}

.spark-bar {
  flex: 1;
  min-width: 2px;
  border-radius: 1px;
  transition: background 0.2s;
}

.spark-bar.up { background: rgba(99,102,241,0.3); }
.spark-bar.up.high { background: rgba(99,102,241,0.5); }
.spark-bar.mid { background: rgba(99,102,241,0.15); }
.spark-bar.down { background: rgba(239,68,68,0.5); }

/* Last checked */
.last-checked {
  font-size: 0.62rem;
  color: #555;
  white-space: nowrap;
}

/* Expandable detail */
.site-detail {
  display: none;
  border-top: 1px solid rgba(255,255,255,0.03);
  padding: 16px 20px;
  background: rgba(0,0,0,0.1);
}

.site-detail.open {
  display: block;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 500px; }
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.detail-stat {
  text-align: center;
  padding: 8px;
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
}

.detail-stat .value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f0f0f5;
}

.detail-stat .label {
  font-size: 0.65rem;
  color: #68687a;
  margin-top: 2px;
}

.detail-chart {
  height: 120px;
  margin-bottom: 12px;
  position: relative;
}

.detail-chart svg {
  width: 100%;
  height: 100%;
}

.detail-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

/* Shimmer Loading */
.shimmer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #0c0c18;
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 4px;
}

.shimmer-dot {
  width: 4px;
  height: 32px;
  border-radius: 2px;
  background: linear-gradient(90deg, #1a1a24 25%, #222233 50%, #1a1a24 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.shimmer-text {
  height: 14px;
  flex: 1;
  border-radius: 4px;
  background: linear-gradient(90deg, #1a1a24 25%, #222233 50%, #1a1a24 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.shimmer-badge {
  width: 60px;
  height: 20px;
  border-radius: 6px;
  background: linear-gradient(90deg, #1a1a24 25%, #222233 50%, #1a1a24 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: #333;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  color: #68687a;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state p {
  color: #555;
  font-size: 0.82rem;
  max-width: 360px;
  margin: 0 auto 18px;
  line-height: 1.6;
}

/* Real-time indicator */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.live-indicator.connected {
  background: rgba(34,197,94,0.08);
  color: #22c55e;
  border: 1px solid rgba(34,197,94,0.15);
}

.live-indicator.connected .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  animation: livePulse 1.5s ease-in-out infinite;
}

.live-indicator.stale {
  background: rgba(245,158,11,0.08);
  color: #f59e0b;
  border: 1px solid rgba(245,158,11,0.15);
}

.live-indicator.stale .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f59e0b;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Toast */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  color: #fff;
  animation: toastSlideIn 0.3s ease;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.toast.info { background: #6366f1; }
.toast.success { background: #22c55e; }
.toast.error { background: #ef4444; }
.toast.warning { background: #f59e0b; }

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-removing {
  animation: toastSlideOut 0.2s ease forwards;
}

@keyframes toastSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .kpi-tile {
    padding: 12px;
  }
  .kpi-value {
    font-size: 1.1rem;
  }
  .premium-list .site-main {
    grid-template-columns: 8px 1fr;
    gap: 8px;
  }
  .premium-list .site-metrics {
    grid-column: 1 / -1;
    justify-content: flex-start;
    margin-top: 4px;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-search {
    max-width: 100%;
  }
  .site-sparkline {
    display: none;
  }
}
