/* Lingyue's Homepage - 公共样式 */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

/* CSS 变量 - 深色模式 */
:root, [data-theme="dark"] {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12101a;
  --card-bg: rgba(15,12,25,0.78);
  --card-bg-hover: rgba(20,16,35,0.85);
  --card-border: rgba(255,255,255,0.08);
  --card-border-hover: rgba(255,255,255,0.15);
  --sidebar-bg: rgba(12,10,20,0.92);
  --sidebar-width: 220px;
  --sidebar-collapsed: 64px;
  --text-primary: #e8e4f0;
  --text-secondary: #a09bb0;
  --text-muted: #6b6580;
  --input-bg: rgba(255,255,255,0.06);
  --accent: #8b7cf8;
  --accent-rgb: 139,124,248;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 16px;
  --radius-sm: 10px;
  --blur: 40px;
  --saturate: 1.5;
}

/* 浅色模式 */
[data-theme="light"] {
  --bg-primary: #f5f3f7;
  --bg-secondary: #eae7ef;
  --card-bg: rgba(255,255,255,0.82);
  --card-bg-hover: rgba(255,255,255,0.92);
  --card-border: rgba(0,0,0,0.08);
  --card-border-hover: rgba(0,0,0,0.15);
  --sidebar-bg: rgba(255,255,255,0.95);
  --text-primary: #1a1525;
  --text-secondary: #4a4560;
  --text-muted: #8a8598;
  --input-bg: rgba(0,0,0,0.04);
  --accent: #7c6df0;
  --accent-rgb: 124,109,240;
  --danger: #dc2626;
  --success: #059669;
  --warning: #d97706;
}

/* 基础样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { 
  scroll-behavior: smooth;
  background: var(--bg-primary);
}
body {
  min-height: 100vh;
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-primary);
  background: transparent;
  overflow-x: hidden;
  transition: color 0.3s;
}

/* 背景图 */
.bg-container {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}
.bg-container img,
.bg-container .bg-slide {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1s ease-in-out;
  position: absolute;
  top: 0;
  left: 0;
}
.bg-container img.active,
.bg-container .bg-slide.active {
  opacity: 1;
}
.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(10,10,15,0.02) 0%, rgba(10,10,15,0.08) 100%);
  transition: background 0.3s;
}
[data-theme="light"] .bg-overlay {
  background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.3) 100%);
}

/* 侧栏 */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-collapsed);
  height: 100vh;
  background: var(--sidebar-bg);
  backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  border-right: 1px solid var(--card-border);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.sidebar:hover {
  width: var(--sidebar-width);
}
.sidebar-header {
  padding: 0 16px 16px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.sidebar-name {
  font-family: 'Space Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s 0.1s;
}
.sidebar:hover .sidebar-name {
  opacity: 1;
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: all 0.2s;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover,
.nav-item.active {
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.nav-item .nav-label {
  opacity: 0;
  transition: opacity 0.2s 0.1s;
}
.sidebar:hover .nav-item .nav-label {
  opacity: 1;
}
.sidebar-footer {
  padding: 12px 8px 0;
  border-top: 1px solid var(--card-border);
  margin-top: 12px;
}

/* 主内容区 */
.main-content {
  margin-left: var(--sidebar-collapsed);
  padding: 32px;
  position: relative;
  z-index: 1;
  transition: margin-left 0.3s;
}
.page {
  max-width: 760px;
  margin: 0 auto;
}

/* 毛玻璃卡片 */
.glass {
  background: var(--card-bg);
  backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  transition: all 0.3s;
}
.glass:hover {
  background: var(--card-bg-hover);
  border-color: var(--card-border-hover);
}

/* 区域标签 */
.section-label {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.btn-danger { background: var(--danger); }
.btn-success { background: var(--success); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-group {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* 表单 */
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="datetime-local"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: all 0.2s;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(var(--accent-rgb), 0.5);
  background: rgba(var(--accent-rgb), 0.05);
}
textarea {
  min-height: 80px;
  resize: vertical;
}
select {
  cursor: pointer;
}
select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* 返回链接 */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 20px;
  transition: color 0.2s;
}
.back-link:hover {
  color: var(--text-primary);
}
.back-link svg {
  width: 14px;
  height: 14px;
}

/* Toast */
.toast {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 12px 20px;
  background: rgba(var(--accent-rgb), 0.9);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 13px;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s;
  z-index: 1000;
  backdrop-filter: blur(10px);
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast.error {
  background: rgba(239, 68, 68, 0.9);
}
.toast.success {
  background: rgba(16, 185, 129, 0.9);
}

/* 主题切换按钮 */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.theme-toggle:hover {
  background: var(--card-bg-hover);
}
.theme-toggle svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}
.theme-toggle-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* 移动端菜单按钮 */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 36px;
  height: 36px;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.mobile-toggle svg {
  width: 18px;
  height: 18px;
}

/* 隐藏类 */
.hidden {
  display: none !important;
}

/* 响应式 - 平板 */
@media (max-width: 768px) {
  .mobile-toggle {
    display: flex;
  }
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar:hover {
    width: var(--sidebar-width);
  }
  .main-content {
    margin-left: 0;
    padding: 60px 16px 24px;
  }
  .theme-toggle {
    top: 12px;
    right: 56px;
    padding: 6px 10px;
  }
  .theme-toggle svg {
    width: 14px;
    height: 14px;
  }
  .glass {
    padding: 20px;
    border-radius: 12px;
  }
  .page {
    padding: 0;
  }
}

/* 响应式 - 手机竖屏 */
@media (max-width: 480px) {
  .sidebar {
    width: 100%;
    --sidebar-width: 100%;
  }
  .sidebar.open {
    width: 100%;
  }
  .main-content {
    padding: 56px 12px 20px;
  }
  .glass {
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 12px;
  }
  .theme-toggle {
    top: 10px;
    right: 52px;
    padding: 5px 8px;
    border-radius: 16px;
  }
  .mobile-toggle {
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    border-radius: 6px;
  }
  .mobile-toggle svg {
    width: 16px;
    height: 16px;
  }
  .toast {
    top: 10px;
    right: 10px;
    left: 10px;
    font-size: 12px;
    padding: 10px 16px;
    border-radius: 8px;
  }
  .btn {
    padding: 8px 14px;
    font-size: 12px;
  }
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="file"],
  textarea,
  select {
    padding: 8px 12px;
    font-size: 13px;
  }
  .section-label {
    font-size: 10px;
    margin-bottom: 12px;
  }
  .back-link {
    font-size: 12px;
    margin-bottom: 16px;
  }
  .back-link svg {
    width: 12px;
    height: 12px;
  }
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2);
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.1);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.2);
}

/* 动画 */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.animate-slide-up {
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.animate-fade-in {
  animation: fadeIn 0.3s forwards;
}
