/* ============================================
   墨白工作站 · 驾驶舱全局样式 v1.0
   深色太空主题 + 毛玻璃效果
   ============================================ */

/* === 主题变量 === */
:root {
  /* 背景 */
  --bg-deep: #0a0a1a;
  --bg-space-1: #0a0a1a;
  --bg-space-2: #1a1035;
  --bg-space-3: #0d1b2a;
  
  /* 主色调 */
  --primary: #6fc4e8;
  --primary-hover: #8dd4f0;
  --primary-glow: rgba(111, 196, 232, 0.3);
  --secondary: #6fc4d8;
  --accent: #b388ff;
  --accent-glow: rgba(179, 136, 255, 0.3);
  
  /* 文本 */
  --text-primary: #e8eaf6;
  --text-secondary: #9e9eb8;
  --text-muted: #6e6e8a;
  --text-accent: #6fc4e8;
  
  /* 状态 */
  --success: #4caf50;
  --warning: #ff9800;
  --danger: #f44336;
  --info: #29b6f6;
  
  /* 毛玻璃 */
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  
  /* 间距 */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  
  /* 字体 */
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Roboto Mono", "Consolas", monospace;
  
  /* 布局 */
  --sidebar-width: 220px;
  --header-height: 64px;
}

/* === 重置 === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: linear-gradient(135deg, var(--bg-space-1) 0%, var(--bg-space-2) 50%, var(--bg-space-3) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* === 星空背景 === */
.starry-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  animation: twinkle var(--duration) ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: var(--min-opacity); }
  50% { opacity: 1; }
}

.shooting-star {
  position: absolute;
  width: 100px;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0.8), transparent);
  transform: rotate(-45deg);
  animation: shoot 1s ease-in-out forwards;
  opacity: 0;
}

@keyframes shoot {
  0% { opacity: 0; transform: translateX(0) translateY(0) rotate(-45deg); }
  10% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-300px) translateY(300px) rotate(-45deg); }
}

/* === 布局 === */
.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

/* === 侧边栏 === */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: rgba(10, 10, 26, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 24px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 16px;
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 20px var(--primary-glow);
}

.sidebar-logo .logo-text {
  font-size: 18px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  text-decoration: none;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
  transition: height 0.2s ease;
  box-shadow: 0 0 10px var(--primary);
}

.nav-item:hover {
  background: rgba(111, 196, 232, 0.08);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(111, 196, 232, 0.12);
  color: var(--primary);
}

.nav-item.active::before {
  height: 24px;
}

.nav-item .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.nav-item .nav-text {
  font-size: 14px;
  font-weight: 500;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: var(--bg-deep);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* 宠物按钮 */
.pet-toggle {
  margin-top: auto;
  padding: 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.pet-toggle:hover {
  background: rgba(111, 196, 232, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

/* === 主内容区 === */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px 32px;
  min-height: 100vh;
}

.module-view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.module-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === 毛玻璃卡片 === */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--glass-shadow);
  transition: all 0.3s ease;
}

.glass-card:hover {
  border-color: rgba(111, 196, 232, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(111, 196, 232, 0.05);
}

.glass-card.glow-primary {
  box-shadow: 0 0 30px rgba(111, 196, 232, 0.15);
}

.glass-card.glow-accent {
  box-shadow: 0 0 30px rgba(179, 136, 255, 0.15);
}

/* === 标题 === */
.module-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.module-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === 网格布局 === */
.grid {
  display: grid;
  gap: 20px;
}

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

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 180px; }
  .main-content { margin-left: 180px; }
}

/* === 按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #5ba8d4);
  color: var(--bg-deep);
  box-shadow: 0 4px 15px rgba(111, 196, 232, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(111, 196, 232, 0.4);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
  color: var(--primary);
}

/* === 标签 === */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(111, 196, 232, 0.15);
  color: var(--primary);
  border: 1px solid rgba(111, 196, 232, 0.2);
}

.tag-accent {
  background: rgba(179, 136, 255, 0.15);
  color: var(--accent);
  border-color: rgba(179, 136, 255, 0.2);
}

/* === 输入框 === */
.input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(111, 196, 232, 0.1);
  background: rgba(111, 196, 232, 0.05);
}

.input::placeholder {
  color: var(--text-muted);
}

/* === 环形进度 === */
.ring-progress {
  position: relative;
  width: 120px;
  height: 120px;
}

.ring-progress svg {
  transform: rotate(-90deg);
}

.ring-progress .bg-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 8;
}

.ring-progress .progress-ring {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}

.ring-progress .center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.ring-progress .ring-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-mono);
}

.ring-progress .ring-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* === 时钟 === */
.clock {
  font-family: var(--font-mono);
  font-size: 48px;
  font-weight: 700;
  color: var(--primary);
  text-shadow: 0 0 30px var(--primary-glow);
  letter-spacing: 2px;
}

.clock-date {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.countdown {
  font-family: var(--font-mono);
  font-size: 32px;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
}

/* === 心情选择 === */
.mood-selector {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.mood-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 2px solid var(--glass-border);
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.mood-btn:hover, .mood-btn.selected {
  border-color: var(--primary);
  background: rgba(111, 196, 232, 0.15);
  transform: scale(1.1);
  box-shadow: 0 0 15px var(--primary-glow);
}

/* === 滚动条 === */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* === 工具类 === */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-mono { font-family: var(--font-mono); }
.w-full { width: 100%; }

/* === 宠物样式 === */
.desktop-pet {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  cursor: grab;
  user-select: none;
}

.desktop-pet:active {
  cursor: grabbing;
}

.pet-avatar {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #ff6b6b, #ffa502);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
  animation: float 3s ease-in-out infinite;
  position: relative;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.pet-bubble {
  position: absolute;
  bottom: 90px;
  right: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  max-width: 200px;
  font-size: 13px;
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.pet-bubble.show {
  opacity: 1;
  transform: translateY(0);
}

.pet-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 30px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--glass-border);
}

/* === 换肤皮肤 === */
[data-skin="default"] { --skin-primary: #6fc4e8; --skin-accent: #b388ff; }
[data-skin="sunset"] { --skin-primary: #ff8a65; --skin-accent: #ffcdd9; }
[data-skin="forest"] { --skin-primary: #81c784; --skin-accent: #a5d6a7; }
[data-skin="ocean"] { --skin-primary: #4fc3f7; --skin-accent: #80deea; }
[data-skin="rose"] { --skin-primary: #f48fb1; --skin-accent: #f8bbd9; }
[data-skin="gold"] { --skin-primary: #ffd54f; --skin-accent: #ffe082; }
