/**
 * DevKit - 开发者工具集
 * 设计系统 v2.0
 * 参考: Linear, Raycast, Vercel Dashboard
 */

/* ===== 设计令牌 ===== */
:root {
  /* 主色调 - 更鲜艳的紫色系 */
  --accent-primary: #8b5cf6;
  --accent-secondary: #a78bfa;
  --accent-glow: rgba(139, 92, 246, 0.4);
  --accent-glow-soft: rgba(139, 92, 246, 0.15);

  /* 背景 - 深蓝灰基调 */
  --bg-primary: #0f0f1a;
  --bg-secondary: #16162a;
  --bg-tertiary: #1e1e3a;
  --bg-card: rgba(30, 30, 58, 0.6);
  --bg-card-hover: rgba(38, 38, 70, 0.8);
  --bg-glass: rgba(22, 22, 42, 0.8);

  /* 边框 */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(139, 92, 246, 0.3);
  --border-active: rgba(139, 92, 246, 0.5);

  /* 文字 */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.15);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.03);

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* 过渡 */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* ===== 全局背景 - 多层光晕 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'SF Pro Display', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  position: relative;
  overflow-x: hidden;
}

/* 背景光晕层 */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -20%;
  width: 70%;
  height: 100%;
  background: radial-gradient(ellipse 60% 50% at 30% 20%, rgba(139, 92, 246, 0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -30%;
  right: -10%;
  width: 60%;
  height: 80%;
  background: radial-gradient(ellipse 50% 40% at 70% 80%, rgba(168, 130, 255, 0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ===== 导航栏 ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 64px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.nav-brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-primary), #7c3aed);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.nav-search {
  position: relative;
  flex: 1;
  max-width: 400px;
  margin: 0 24px;
}

.nav-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.nav-search input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all var(--transition-fast);
}

.nav-search input::placeholder {
  color: var(--text-muted);
}

.nav-search input:focus {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-hover);
  box-shadow: 0 0 0 3px var(--accent-glow-soft);
}

.nav-search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', monospace;
}

.nav-github {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.nav-github:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-default);
  color: var(--text-primary);
}

/* ===== 主内容区 ===== */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

/* ===== 分类标签 ===== */
.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.category-tab {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.category-tab:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.category-tab.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* ===== 工具网格 ===== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ===== 工具卡片 ===== */
.tool-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  text-decoration: none !important;
}

/* 顶部渐变条 */
.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), #c4b5fd);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

/* 悬停光晕 */
.tool-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, var(--accent-glow-soft) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-normal);
  pointer-events: none;
}

.tool-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.tool-card:hover::before,
.tool-card:hover::after {
  opacity: 1;
}

.tool-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.tool-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(167, 139, 250, 0.1));
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.tool-card:hover .tool-icon {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(167, 139, 250, 0.2));
  border-color: rgba(139, 92, 246, 0.4);
  transform: scale(1.05);
}

.tool-info { flex: 1; }

.tool-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  transition: color var(--transition-fast);
}

.tool-card:hover .tool-name {
  color: var(--accent-secondary);
}

.tool-desc {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
  flex: 1;
  position: relative;
  z-index: 1;
}

.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  position: relative;
  z-index: 1;
}

.tool-tag {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.tool-card:hover .tool-tag {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.15);
  color: var(--text-secondary);
}

/* ===== 搜索高亮 ===== */
.search-highlight {
  background: rgba(139, 92, 246, 0.3);
  color: var(--accent-secondary);
  padding: 0 2px;
  border-radius: 3px;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
}

/* ===== 页脚 ===== */
.footer {
  text-align: center;
  padding: 32px 24px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 48px;
}

.footer a {
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.footer a:hover {
  color: var(--accent-secondary);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .navbar {
    padding: 0 16px;
  }
  .nav-search {
    margin: 0 12px;
    max-width: none;
  }
  .nav-search-kbd {
    display: none;
  }
  .main-content {
    padding: 20px 16px 32px;
  }
  .tools-grid {
    grid-template-columns: 1fr;
  }
  .category-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .category-tab {
    white-space: nowrap;
  }
}

/* ===== 反馈浮动按钮 ===== */
.feedback-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 200;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), #7c3aed);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4), var(--shadow-lg);
  transition: all var(--transition-normal);
}

.feedback-fab:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 6px 28px rgba(139, 92, 246, 0.5), var(--shadow-lg);
}

.feedback-fab:active {
  transform: scale(0.95);
}

/* ===== 反馈弹窗 ===== */
.feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.feedback-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.feedback-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 90%;
  max-width: 480px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(139, 92, 246, 0.1);
  transform: translateY(20px) scale(0.95);
  transition: transform var(--transition-normal);
}

.feedback-overlay.active .feedback-modal {
  transform: translateY(0) scale(1);
}

.feedback-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.feedback-modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.feedback-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.feedback-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.feedback-field {
  margin-bottom: 18px;
}

.feedback-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.feedback-field select,
.feedback-field input[type="text"],
.feedback-field textarea {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
  resize: vertical;
}

.feedback-field select:focus,
.feedback-field input[type="text"]:focus,
.feedback-field textarea:focus {
  border-color: var(--border-hover);
  box-shadow: 0 0 0 3px var(--accent-glow-soft);
  background: rgba(255, 255, 255, 0.05);
}

.feedback-field select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.feedback-type-group {
  display: flex;
  gap: 10px;
}

.feedback-type-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 13px;
  color: var(--text-secondary);
}

.feedback-type-option:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-default);
}

.feedback-type-option input[type="radio"] {
  display: none;
}

.feedback-type-option input[type="radio"]:checked + span {
  color: var(--accent-secondary);
  font-weight: 600;
}

.feedback-type-option:has(input:checked) {
  background: var(--accent-glow-soft);
  border-color: var(--border-hover);
}

.feedback-char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.feedback-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.feedback-btn-cancel {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.feedback-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.feedback-btn-submit {
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--accent-primary), #7c3aed);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 12px rgba(139, 92, 246, 0.3);
}

.feedback-btn-submit:hover:not(:disabled) {
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.4);
  transform: translateY(-1px);
}

.feedback-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== 反馈成功 ===== */
.feedback-success {
  text-align: center;
  padding: 32px 16px;
}

.feedback-success-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.feedback-success p {
  font-size: 16px;
  color: var(--text-primary);
}

.feedback-success-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.feedback-success-hint a {
  color: var(--accent-secondary);
  text-decoration: underline;
}

/* ===== 响应式 - 反馈 ===== */
@media (max-width: 768px) {
  .feedback-fab {
    bottom: 20px;
    right: 20px;
    width: 46px;
    height: 46px;
  }

  .feedback-modal {
    padding: 20px;
    width: 95%;
  }

  .feedback-type-group {
    flex-direction: column;
    gap: 8px;
  }
}
