/**
 * Customer Page CSS - Gray-White Theme with Dark Mode Support
 * Clean and modern design with responsive grid layout
 */

/* CSS Variables - Light Theme (Default) */
:root {
  --bg-main: #f5f5f7;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f0f0f2;
  --bg-sidebar: #e8e8ed;
  --border-color: #d1d1d6;
  --text-primary: #1d1d1f;
  --text-secondary: #424245;
  --text-muted: #86868b;
  --accent-color: #0071e3;
  --accent-hover: #0077ed;
  --success-color: #34c759;
  --warning-color: #ff9500;
  --danger-color: #ff3b30;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: all 0.2s ease;
}

/* Dark Theme - Auto-detect via media query */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-main: #1c1c1e;
    --bg-secondary: #2c2c2e;
    --bg-card: #2c2c2e;
    --bg-hover: #3a3a3c;
    --bg-sidebar: #1c1c1e;
    --border-color: #3a3a3c;
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-muted: #8e8e93;
    --accent-color: #0a84ff;
    --accent-hover: #409cff;
    --success-color: #30d158;
    --warning-color: #ff9f0a;
    --danger-color: #ff453a;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.4);
  }
}

/* Base Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Language Switch */
.lang-switch {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  z-index: 100;
}

.lang-switch:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent-color);
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  margin-bottom: 28px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px; /* Rounded corners */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.header h1 {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.last-update {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.update-label {
  color: var(--text-muted);
}

#last-updated {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Header Info Container */
.header-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

/* Schedule Info */
.schedule-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.schedule-label {
  color: var(--text-muted);
}

.schedule-separator {
  color: var(--border-color);
  margin: 0 4px;
}

#last-check-time,
#next-check-time {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Loading State */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 20px;
  opacity: 0.7;
}

.empty-state h2 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 1rem;
}

/* Model List - Grid Layout */
.model-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  flex: 1;
}

/* Model Card */
.model-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 16px; /* Reduced padding */
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.model-card:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

/* Model Header */
.model-header {
  display: flex;
  justify-content: space-between;
  align-items: center; /* Better alignment */
  margin-bottom: 10px; /* Reduced margin */
  gap: 8px;
}

.model-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.model-logo {
  width: 32px; /* Smaller logo */
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  flex-shrink: 0;
  background: var(--bg-secondary);
  padding: 3px;
}

.model-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-id {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status Badge */
.model-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px; /* Smaller padding */
  border-radius: 50px;
  font-size: 0.75rem; /* Slightly smaller font */
  font-weight: 500;
  flex-shrink: 0;
}

.model-status.online {
  background: rgba(52, 199, 89, 0.15);
  color: var(--success-color);
}

.model-status.offline {
  background: rgba(255, 59, 48, 0.15);
  color: var(--danger-color);
}

.model-status.unknown {
  background: rgba(142, 142, 147, 0.15);
  color: var(--text-muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

/* Progress bar slot styles */

.progress-slot {
  flex: 1;
  border-radius: 2px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.progress-slot::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-sidebar);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 10;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}

.progress-slot:hover::after {
  opacity: 1;
  visibility: visible;
}

.progress-slot.success {
  background: var(--success-color);
}

.progress-slot.failure {
  background: var(--danger-color);
}

.progress-slot.unknown {
  background: var(--border-color);
}

/* Progress Bar Container with Rate Badge */
.progress-section {
  display: flex;
  gap: 12px; /* Reduced gap */
  align-items: flex-start;
  margin-bottom: 8px; /* Reduced margin */
}

.progress-bar-container {
  flex: 1;
}

.progress-bar {
  display: flex;
  gap: 2px;
  height: 20px; /* Smaller height */
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  overflow: hidden;
  padding: 2px;
}

/* Time Ticks under progress bar */
.progress-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 2px;
}

/* Rate Badge */
.rate-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 60px; /* Smaller width */
  padding: 6px 10px; /* Smaller padding */
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.rate-badge.good {
  background: rgba(52, 199, 89, 0.1);
  border-color: var(--success-color);
}

.rate-badge.warning {
  background: rgba(255, 149, 0, 0.1);
  border-color: var(--warning-color);
}

.rate-badge.bad {
  background: rgba(255, 59, 48, 0.1);
  border-color: var(--danger-color);
}

.rate-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: inherit;
}

.rate-badge.good .rate-value {
  color: var(--success-color);
}

.rate-badge.warning .rate-value {
  color: var(--warning-color);
}

.rate-badge.bad .rate-value {
  color: var(--danger-color);
}

.rate-badge.neutral .rate-value {
  color: var(--text-muted);
}

.rate-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Deprecated: Stats Row - keeping for backward compatibility */
.stats-row {
  display: none;
}

.stat-item {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
  border: 1px solid var(--border-color);
}

.stat-label {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 600;
}

.stat-value.good {
  color: var(--success-color);
}

.stat-value.warning {
  color: var(--warning-color);
}

.stat-value.bad {
  color: var(--danger-color);
}

.stat-value.neutral {
  color: var(--text-muted);
}

/* Error Info */
.error-info {
  background: rgba(255, 59, 48, 0.08);
  border: 1px solid rgba(255, 59, 48, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: auto;
}

.error-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--danger-color);
  margin-bottom: 4px;
}

.error-message {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-word;
}

.error-code {
  display: inline-block;
  background: rgba(255, 59, 48, 0.2);
  color: var(--danger-color);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 6px;
}

/* Footer */
.footer {
  margin-top: auto;
  padding-top: 28px;
  text-align: center;
}

.footer p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .model-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .container {
    padding: 20px 24px;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  .model-list {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .header h1 {
    font-size: 1.3rem;
  }

  .stats-row {
    grid-template-columns: repeat(4, 1fr);
  }

  .model-card {
    padding: 18px;
  }

  .lang-switch {
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 1.1rem;
  }

  .model-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .model-logo {
    width: 32px;
    height: 32px;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-item {
    padding: 8px;
  }

  .stat-value {
    font-size: 0.95rem;
  }

  .progress-bar {
    height: 16px;
  }
}

/* =========================================
   Tech / Neural Network Theme Overrides
   ========================================= */

/* Particles Background Container */
#tsparticles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none !important; /* Ensure interactions pass through */
}

/* Glassmorphism Card Style */
/* Glassmorphism Card Style */
.model-card {
  background: rgba(255, 255, 255, 0.45) !important; /* Increased transparency */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  border-radius: var(--radius-lg);
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.05),
    0 2px 4px -1px rgba(0, 0, 0, 0.03),
    0 0 0 1px rgba(0, 0, 0, 0.02) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.model-card:hover {
  transform: translateY(-4px); 
  background: rgba(255, 255, 255, 0.65) !important; /* Slightly more opaque on hover */
  border-color: rgba(255, 255, 255, 0.8) !important;
  box-shadow: 
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04),
    0 0 0 1px rgba(0, 0, 0, 0.05) !important;
}

/* Container background cleanup to let particles show */
body {
  background-color: #f8fafc; 
  background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%); /* Slightly darker gradient for contrast */
  min-height: 100vh;
}

/* Tech-style Header */
.header {
  background: rgba(255, 255, 255, 0.45) !important; /* Matches model cards */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); /* Softer shadow */
  border-radius: var(--radius-lg) !important; /* Rounded corners */
  margin-top: 20px; /* Add some top spacing if needed, or rely on container padding */
}

/* Typography Enhancements */
.model-name {
  font-weight: 600 !important;
  letter-spacing: -0.01em;
  color: #0f172a !important; /* Slate 900 */
}

.status-text {
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Status Dot Glow */
.status-dot {
  box-shadow: 0 0 8px currentColor;
}

/* Rate Badge Refinement */
.rate-badge {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(0,0,0,0.04);
}

