/**
 * XHS Monitor - Premium Light Theme
 * Based on Pixso high-score template aesthetics
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  color-scheme: light;

  /* Background Colors - Warm Gray Tones */
  --color-bg-body: #F8F9FC;
  --color-bg-card: #FFFFFF;
  --color-bg-sidebar: linear-gradient(180deg, #FDFEFF 0%, #F8FAFD 100%);
  --color-bg-sidebar-solid: #FAFBFD;
  --color-bg-input: #F4F6F9;
  --color-bg-table-header: #F8F9FC;
  --color-bg-hover: #F0F3F7;
  --color-bg-selected: rgba(99, 102, 241, 0.08);

  /* Text Colors - Softer Contrast */
  --color-text-main: #1E293B;
  --color-text-muted: #64748B;
  --color-text-tertiary: #94A3B8;
  --color-text-primary: #1E293B;
  --color-text-secondary: #64748B;

  /* Theme Colors - Richer Palette */
  --color-indigo-500: #6366F1;
  --color-purple-500: #8B5CF6;
  --color-indigo-400: #818CF8;
  --color-indigo-600: #4F46E5;
  --color-slate-800: #1E293B;
  --color-accent: #6366F1;

  /* Borders - Subtle */
  --color-border: #E2E8F0;
  --color-border-input: #CBD5E1;
  --color-border-focus: #6366F1;

  /* Gradients - Premium Feel */
  --gradient-primary: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
  --gradient-sidebar: linear-gradient(180deg, #FDFEFF 0%, #F8FAFD 100%);
  --gradient-card-hover: linear-gradient(135deg, rgba(99, 102, 241, 0.03) 0%, rgba(139, 92, 246, 0.03) 100%);

  /* Card Styles - Elevated */
  --glass-bg: #FFFFFF;
  --glass-border: rgba(226, 232, 240, 0.8);
  --glass-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  --glass-blur: 0px;

  /* Shadows - Layered Depth */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.04), 0 10px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.04), 0 20px 40px rgba(0, 0, 0, 0.08);

  /* Radius */
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;

  /* Status Colors - Vibrant */
  --color-success: #10B981;
  --color-success-bg: rgba(16, 185, 129, 0.08);
  --color-danger: #EF4444;
  --color-danger-bg: rgba(239, 68, 68, 0.08);
  --color-warning: #F59E0B;
  --color-warning-bg: rgba(245, 158, 11, 0.08);

  /* Fonts */
  --font-cn: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Extended Typography */
.text-huge {
  font-size: clamp(2.1rem, 4.6vw, 4.4rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: rgba(16, 185, 129, 0.95);
  color: white;
  padding: 12px 24px;
  border-radius: 99px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  margin-bottom: 10px;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Logs Area */
.logs-area {
  font-family: var(--font-mono);
  font-size: 11px !important;
  line-height: 1.4;
  overflow-y: auto;
  color: var(--color-text-muted);
}

/* Base Styles */
body {
  font-family: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, var(--font-cn);
  background: var(--color-bg-body);
  color: var(--color-text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Helper Classes */
[v-cloak] { display: none !important; }

/* Component: Card */
.glass-card, .card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover, .card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Component: Input */
.glass-input, .input, select {
  background: var(--color-bg-input);
  border: 1px solid var(--color-border-input);
  color: var(--color-text-main);
  transition: all 0.2s;
  border-radius: var(--radius-sm);
  padding: 0 12px;
  height: 36px;
  line-height: 36px;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}

.glass-input:focus, .input:focus, select:focus {
  background: #FFFFFF;
  border-color: var(--color-border-focus);
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.glass-input::placeholder, .input::placeholder {
  color: var(--color-text-tertiary);
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  color-scheme: light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2364748B'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 20px;
  padding-right: 32px !important;
  cursor: pointer;
}

select option {
  background: #FFFFFF;
  color: var(--color-text-main);
  padding: 8px;
}

#currentUserLabel {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-indigo-500);
}

/* Component: Primary Button */
.btn-gradient, .btn-primary {
  background: var(--gradient-primary);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
  transition: all 0.3s ease;
  border: none;
  color: white;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  height: 36px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  cursor: pointer;
}

.btn-gradient:hover, .btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.btn-gradient:active, .btn-primary:active {
  transform: scale(0.98);
}

button:disabled, .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none !important;
  transform: none !important;
}

/* Component: Secondary Button */
.btn-secondary {
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
  transition: all 0.2s;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  height: 36px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.btn-secondary:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-border-input);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: scale(0.98);
}

.btn-danger {
  background: var(--color-danger-bg);
  border: 1px solid rgba(245, 63, 63, 0.2);
  color: var(--color-danger);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  height: 36px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: rgba(245, 63, 63, 0.15);
  transform: translateY(-1px);
}

.btn-danger:active {
  transform: scale(0.98);
}

/* Component: Tag Chip */
.tag-chip {
  background: rgba(78, 110, 242, 0.08);
  border: 1px solid rgba(78, 110, 242, 0.2);
  color: var(--color-indigo-500);
  border-radius: 6px;
  transition: all 0.2s;
  padding: 2px 8px;
  font-size: 12px;
}

.tag-chip:hover {
  background: rgba(78, 110, 242, 0.15);
  border-color: rgba(78, 110, 242, 0.35);
}

.tag-chip.active {
  background: var(--gradient-primary);
  border: none;
  color: white;
  box-shadow: 0 2px 8px rgba(78, 110, 242, 0.25);
}

/* Component: Table */
.glass-table {
  width: 100%;
  border-collapse: collapse;
}

.glass-table thead th {
  background: var(--color-bg-table-header);
  color: var(--color-text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border);
  padding: 12px;
  text-align: left;
  font-size: 13px;
}

.glass-table tbody tr {
  transition: background 0.2s;
  border-bottom: 1px solid var(--color-border);
}

.glass-table tbody tr:hover {
  background: var(--color-bg-hover);
}

.glass-table td {
  color: var(--color-text-main);
  padding: 12px;
}

/* Component: Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid var(--color-border);
  border-radius: 50%;
  border-top-color: var(--color-indigo-500);
  animation: spin 1s ease-in-out infinite;
}

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

/* Animation: Fade In */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.5s ease-out forwards; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }

/* Selection */
::selection { background: rgba(78, 110, 242, 0.15); color: var(--color-text-main); }

/* Utility Classes */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mb-12 { margin-bottom: 48px; }
.w-full { width: 100%; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-lg { font-size: 18px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-center { text-align: center; }
.hidden { display: none !important; }

/* Text Colors */
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-secondary { color: var(--color-text-muted); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-accent { color: var(--color-indigo-500); }

/* Extended Utilities */
.h-32 { height: 128px; }
.h-64 { height: 256px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }
.opacity-80 { opacity: 0.8; }
.justify-end { justify-content: flex-end; }
.relative { position: relative; }
.absolute { position: absolute; }
.top-4 { top: 16px; }
.right-4 { right: 16px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.pr-8 { padding-right: 32px; }
.pr-12 { padding-right: 48px; }
.font-mono { font-family: var(--font-mono); }
.max-w-full { max-width: 100%; }
.whitespace-nowrap { white-space: nowrap; }

/* Icon sizes */
.icon { width: 18px; height: 18px; fill: currentColor; }
.icon-lg { width: 24px; height: 24px; fill: currentColor; }

/* More Utilities */
.z-10 { z-index: 10; }
.rounded-full { border-radius: 9999px; }
.rounded-lg { border-radius: 8px; }
.rounded-xl { border-radius: 12px; }
.h-full { height: 100%; }
.w-600px { width: 600px; }
.h-300px { height: 300px; }
.bg-white-5 { background-color: rgba(0, 0, 0, 0.02); }
.bg-white-10 { background-color: rgba(0, 0, 0, 0.04); }
.hover-bg-white-10:hover { background-color: rgba(0, 0, 0, 0.06); }
.transition-colors { transition-property: background-color, border-color, color, fill, stroke; transition-duration: 0.2s; }
.cursor-pointer { cursor: pointer; }
.leading-tight { line-height: 1.25; }
.leading-relaxed { line-height: 1.625; }
.shrink-0 { flex-shrink: 0; }
.border { border-width: 1px; border-style: solid; }
.border-white-5 { border-color: var(--color-border); }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.min-w-0 { min-width: 0; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-y-auto { overflow-y: auto; }
.text-base { font-size: 16px; }
.text-xl { font-size: 20px; }
.text-3xl { font-size: 30px; line-height: 36px; }
.text-main { color: var(--color-text-main); }
.tracking-tight { letter-spacing: -0.02em; }
.h-40 { height: 160px; }

/* HiDPI / Retina */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .glass-card, .card { border-width: 0.5px; }
  .glass-input, .input, select { border-width: 0.5px; }
  .glass-table tbody tr { border-bottom-width: 0.5px; }
}

@media (max-width: 1024px) {
  .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .grid-cols-4, .grid-cols-2 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
}
