/* ============================================
   周迹 - 现代化UI样式 + 完全响应式
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap');

/* ===== 基础重置 ===== */
* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  overscroll-behavior-y: none;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
  min-height: 100vh;
}

.dark body {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
}

/* ===== 渐变背景 ===== */
.bg-gradient-primary {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
}

.bg-gradient-soft {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
}

/* ===== 现代卡片样式 ===== */
.card-modern {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  box-shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.08), 0 2px 8px -2px rgba(0, 0, 0, 0.04);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark .card-modern {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.3), 0 2px 8px -2px rgba(0, 0, 0, 0.2);
}

.card-modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px -8px rgba(99, 102, 241, 0.15), 0 4px 16px -4px rgba(0, 0, 0, 0.08);
}

/* ===== 现代按钮 ===== */
.btn-modern {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border-radius: 14px;
  font-weight: 600;
  font-size: 15px;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  min-height: 48px;
}

.btn-modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
}

.btn-modern:active {
  transform: translateY(0);
}

.btn-modern-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.8);
  color: #475569;
  border-radius: 14px;
  font-weight: 500;
  font-size: 15px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: all 0.3s;
  min-height: 48px;
}

.btn-modern-secondary:hover {
  background: rgba(255, 255, 255, 1);
}

.dark .btn-modern-secondary {
  background: rgba(30, 41, 59, 0.8);
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.1);
}

/* ===== 渐变文字 ===== */
.gradient-text {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== 动画 ===== */
.fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.float {
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #94a3b8, #64748b);
}
.dark ::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #475569, #334155);
}

/* ===== 加载遮罩 ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dark .loading-overlay {
  background: rgba(15, 23, 42, 0.85);
}

/* ===== 骨架屏 ===== */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.dark .skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%;
}

/* ===== 输入框美化 ===== */
.input-modern {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.8);
  border: 1.5px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  font-size: 15px;
  transition: all 0.3s;
  outline: none;
}
.input-modern:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
  background: white;
}
.dark .input-modern {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(255, 255, 255, 0.1);
  color: white;
}
.dark .input-modern:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.2);
  background: rgba(30, 41, 59, 1);
}

/* ===== 导航项美化 ===== */
.nav-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-radius: 14px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  color: #64748b;
  font-weight: 500;
  font-size: 14px;
}
.nav-item:hover {
  background: rgba(99, 102, 241, 0.08);
  color: #6366f1;
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
  color: #6366f1;
  font-weight: 600;
}
.dark .nav-item { color: #94a3b8; }
.dark .nav-item:hover {
  background: rgba(129, 140, 248, 0.15);
  color: #a5b4fc;
}
.dark .nav-item.active {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.2), rgba(167, 139, 250, 0.15));
  color: #a5b4fc;
}

/* ===== 统计卡片 ===== */
.stat-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.8));
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid rgba(255,255,255,0.5);
  transition: all 0.3s;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}
.dark .stat-card {
  background: linear-gradient(135deg, rgba(30,41,59,0.9), rgba(30,41,59,0.75));
  border-color: rgba(255,255,255,0.08);
}

/* ============================================
   完全响应式布局 - 核心优化
   ============================================ */

/* ===== 桌面端 (>= 1024px) ===== */
@media (min-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 40;
    overflow-y: auto;
  }
  .main-content {
    margin-left: 260px;
    min-height: 100vh;
  }
  .bottom-nav { display: none !important; }
}

/* ===== 平板端 (768px - 1023px) ===== */
@media (min-width: 768px) and (max-width: 1023px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 220px;
    z-index: 40;
    overflow-y: auto;
  }
  .main-content {
    margin-left: 220px;
    min-height: 100vh;
  }
  .bottom-nav { display: none !important; }
}

/* ===== 手机端 (<= 767px) - 核心优化 ===== */
@media (max-width: 767px) {
  /* 隐藏侧边栏 */
  .sidebar { display: none !important; }
  
  /* 主内容区适配 */
  .main-content {
    margin-left: 0 !important;
    padding: 16px !important;
    padding-bottom: 90px !important; /* 给底部导航留空间 */
    min-height: 100vh;
  }
  
  /* 显示底部导航栏 */
  .bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
  }
  
  /* 卡片紧凑化 */
  .card-modern {
    border-radius: 16px;
    padding: 16px !important;
  }
  
  /* 统计卡片100%宽度 */
  .stat-card {
    width: 100% !important;
    min-width: 100% !important;
    padding: 16px !important;
  }
  
  /* 字体缩小 */
  h1 { font-size: 22px !important; }
  h2 { font-size: 18px !important; }
  h3 { font-size: 16px !important; }
  body { font-size: 14px; }
  
  /* 按钮紧凑 */
  .btn-modern, .btn-modern-secondary {
    padding: 10px 16px;
    min-height: 44px;
    font-size: 14px;
  }
  
  /* 输入框紧凑 */
  .input-modern {
    padding: 12px 14px;
    font-size: 14px;
  }
  
  /* 网格改为单列 */
  .grid-cols-2, .grid-cols-3, .grid-cols-4 {
    grid-template-columns: 1fr !important;
  }
  
  /* 间距缩小 */
  .gap-6, .gap-8 { gap: 12px !important; }
  .p-6, .p-8 { padding: 16px !important; }
  .m-6, .m-8 { margin: 12px !important; }
}

/* ===== 小屏手机 (<= 480px) 额外优化 ===== */
@media (max-width: 480px) {
  .main-content { padding: 12px !important; }
  .card-modern { padding: 14px !important; }
  .stat-card { padding: 14px !important; }
}

/* ===== 底部导航栏（移动端专用） ===== */
.bottom-nav {
  display: none !important; /* 桌面端默认隐藏 */
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 99999 !important;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding: 8px 4px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  justify-content: space-evenly;
  align-items: center;
  gap: 0px;
}
.dark .bottom-nav {
  background: rgba(15, 23, 42, 0.95);
  border-top-color: rgba(255, 255, 255, 0.08);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  border-radius: 8px;
  color: #64748b;
  font-size: 9px;
  font-weight: 500;
  transition: all 0.25s;
  min-width: 40px;
  flex: 1;
  cursor: pointer;
  border: none;
  background: transparent;
}
.bottom-nav-item.active {
  color: #86C8BC;
  background: rgba(134, 200, 188, 0.12);
}
.bottom-nav-item i {
  font-size: 16px;
  margin-bottom: 2px;
}
.dark .bottom-nav-item { color: #94a3b8; }
.dark .bottom-nav-item.active {
  color: #86C8BC;
  background: rgba(134, 200, 188, 0.2);
}

/* ===== 移动端侧边栏 ===== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 100;
    transition: left 0.3s ease;
  }
  
  .sidebar.mobile-show {
    left: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }
  
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
  }
  
  .sidebar-overlay.show {
    display: block;
  }
  
  /* 主内容底部留白，防止被导航挡住 */
  main, .main-content, #app > div > div:last-child {
    padding-bottom: 80px !important;
  }
  
  .bottom-nav {
    display: flex !important;
  }
  
  /* 移动端侧边栏默认隐藏 */
  .sidebar {
    left: -280px !important;
  }
}

/* ===== 终极强制：底部导航只在移动端显示 ===== */
.bottom-nav {
  display: none !important;
}
@media (max-width: 768px) {
  .bottom-nav {
    display: flex !important;
  }
}

/* ===== 隐藏滚动条 ===== */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar { display: none; }

/* ===== 番茄钟动画 ===== */
.pomodoro-active {
  animation: pomodoroPulse 1.5s ease-in-out infinite;
}
@keyframes pomodoroPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 20px rgba(239, 68, 68, 0); }
}

.pomodoro-break {
  animation: breakPulse 1.5s ease-in-out infinite;
}
@keyframes breakPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 0 20px rgba(16, 185, 129, 0); }
}

/* ===== 模态框 ===== */
.modal-backdrop { animation: modalFade 0.25s ease-out; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }

.modal-content { animation: modalSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes modalSlide {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ===== 触摸友好 ===== */
.touch-btn { min-height: 48px; min-width: 48px; }
.touch-target { padding: 12px; }
