/* =========================================================
   Token 工具箱 - 主样式文件
   ========================================================= */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --secondary: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --dark: #1e293b;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --transition: all 0.2s ease;
}

/* 全局重置 */
.aitools * {
  box-sizing: border-box;
}

.aitools body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--gray-50);
  color: var(--dark);
  line-height: 1.6;
}

/* 导航栏 */
.aitools .tk-nav {
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.aitools .tk-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 64px;
  gap: 16px;
}

.aitools .tk-nav-brand {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.aitools .tk-nav-brand:hover {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
}

.aitools .tk-nav-brand i {
  font-size: 24px;
}

.aitools .tk-nav-links {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
}

.aitools .tk-nav-links::-webkit-scrollbar {
  display: none;
}

.aitools .tk-nav-link {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: var(--transition);
  cursor: pointer;
}

.aitools .tk-nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.15);
  text-decoration: none;
}

.aitools .tk-nav-link.active {
  color: #fff;
  background: rgba(255,255,255,0.2);
}

/* 主容器 */
.aitools .tk-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* 工具面板 */
.aitools .tk-panel {
  display: none;
  animation: tkFadeIn 0.3s ease;
}

.aitools .tk-panel.active {
  display: block;
}

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

/* 卡片 */
.aitools .tk-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
  transition: var(--transition);
}

.aitools .tk-card:hover {
  box-shadow: var(--shadow-md);
}

.aitools .tk-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--gray-100);
}

.aitools .tk-card-header .tk-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  flex-shrink: 0;
}

.aitools .tk-card-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.aitools .tk-card-header p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--gray-500);
}

/* 工具描述横幅 */
.aitools .tk-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  border-radius: var(--radius);
  padding: 32px;
  color: #fff;
  margin-bottom: 24px;
  text-align: center;
}

.aitools .tk-hero h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px;
}

.aitools .tk-hero p {
  font-size: 15px;
  opacity: 0.9;
  margin: 0;
  max-width: 600px;
  margin: 0 auto;
}

/* 功能网格（首页） */
.aitools .tk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.aitools .tk-grid-item {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
  text-align: center;
}

.aitools .tk-grid-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.aitools .tk-grid-item .tk-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  margin: 0 auto 12px;
}

.aitools .tk-grid-item h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px;
}

.aitools .tk-grid-item p {
  font-size: 13px;
  color: var(--gray-500);
  margin: 0 0 12px;
  line-height: 1.5;
}

.aitools .tk-grid-item .tk-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.aitools .tk-badge-p0 {
  background: #fee2e2;
  color: #dc2626;
}

.aitools .tk-badge-p1 {
  background: #fef3c7;
  color: #d97706;
}

.aitools .tk-badge-p2 {
  background: #dbeafe;
  color: #2563eb;
}

.aitools .tk-badge-p3 {
  background: #f3e8ff;
  color: #7c3aed;
}

/* 表单控件 */
.aitools .tk-form-group {
  margin-bottom: 16px;
}

.aitools .tk-form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--gray-700);
}

.aitools .tk-form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
  background: #fff;
  color: var(--dark);
}

.aitools .tk-form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.aitools .tk-form-control::placeholder {
  color: var(--gray-400);
}

.aitools textarea.tk-form-control {
  min-height: 100px;
  resize: vertical;
}

.aitools select.tk-form-control {
  cursor: pointer;
}

/* 按钮 */
.aitools .tk-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.aitools .tk-btn-primary {
  background: var(--primary);
  color: #fff;
}

.aitools .tk-btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.aitools .tk-btn-success {
  background: var(--success);
  color: #fff;
}

.aitools .tk-btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
}

.aitools .tk-btn-outline {
  background: transparent;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-600);
}

.aitools .tk-btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.aitools .tk-btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* 表格 */
.aitools .tk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.aitools .tk-table th {
  background: var(--gray-50);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 2px solid var(--gray-200);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.aitools .tk-table th:hover {
  color: var(--primary);
}

.aitools .tk-table th .sort-icon {
  margin-left: 4px;
  opacity: 0.3;
}

.aitools .tk-table th.sort-active .sort-icon {
  opacity: 1;
  color: var(--primary);
}

.aitools .tk-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.aitools .tk-table tr:hover td {
  background: var(--gray-50);
}

.aitools .tk-table .tk-provider-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  background: var(--gray-100);
  color: var(--gray-600);
}

/* 结果卡片 */
.aitools .tk-result-card {
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  border-left: 4px solid var(--info);
}

.aitools .tk-result-card.warning {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-left-color: var(--warning);
}

.aitools .tk-result-card.danger {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border-left-color: var(--danger);
}

.aitools .tk-result-card.success {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  border-left-color: var(--success);
}

.aitools .tk-result-card .tk-result-amount {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  margin: 8px 0;
}

.aitools .tk-result-card .tk-result-label {
  font-size: 13px;
  color: var(--gray-500);
  margin: 0;
}

/* 比较行（一句话消耗器） */
.aitools .tk-compare-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
}

.aitools .tk-compare-row:last-child {
  border-bottom: none;
}

.aitools .tk-compare-row .model-name {
  font-weight: 600;
  font-size: 14px;
  min-width: 160px;
}

.aitools .tk-compare-row .model-price {
  font-size: 14px;
  color: var(--gray-600);
}

.aitools .tk-compare-row .model-bar {
  flex: 1;
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  margin: 0 16px;
  overflow: hidden;
}

.aitools .tk-compare-row .model-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* 价格变化指示器 */
.aitools .tk-price-up {
  color: var(--danger);
}

.aitools .tk-price-down {
  color: var(--success);
}

/* 省省卡 */
.aitools .tk-savings-big {
  font-size: 42px;
  font-weight: 800;
  color: var(--success);
  text-align: center;
  padding: 20px 0;
}

.aitools .tk-savings-big .unit {
  font-size: 18px;
  font-weight: 600;
}

/* 换算器结果 */
.aitools .tk-convert-result {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.aitools .tk-convert-item {
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  transition: var(--transition);
}

.aitools .tk-convert-item:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
}

.aitools .tk-convert-item .emoji {
  font-size: 32px;
  margin-bottom: 8px;
}

.aitools .tk-convert-item .count {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.aitools .tk-convert-item .label {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* 历史价格时间线 */
.aitools .tk-timeline {
  position: relative;
  padding: 20px 0;
}

.aitools .tk-timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gray-200);
}

.aitools .tk-timeline-item {
  position: relative;
  padding-left: 52px;
  padding-bottom: 24px;
}

.aitools .tk-timeline-item:last-child {
  padding-bottom: 0;
}

.aitools .tk-timeline-dot {
  position: absolute;
  left: 12px;
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: var(--shadow);
}

.aitools .tk-timeline-content {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.aitools .tk-timeline-content .date {
  font-size: 12px;
  color: var(--gray-400);
  font-weight: 600;
}

.aitools .tk-timeline-content .event {
  font-size: 14px;
  margin-top: 4px;
}

.aitools .tk-timeline-content .price-tag {
  display: inline-block;
  background: var(--success);
  color: #fff;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}

/* 优先级标签 */
.aitools .tk-priority {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

/* 行内表单 */
.aitools .tk-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

/* 响应式 */
@media (max-width: 768px) {
  .aitools .tk-nav {
    padding: 0 12px;
  }

  .aitools .tk-nav-inner {
    height: 56px;
    gap: 8px;
  }

  .aitools .tk-nav-brand {
    font-size: 16px;
  }

  .aitools .tk-nav-brand i {
    font-size: 20px;
  }

  .aitools .tk-nav-link {
    padding: 6px 10px;
    font-size: 12px;
  }

  .aitools .tk-container {
    padding: 16px 12px;
  }

  .aitools .tk-card {
    padding: 16px;
  }

  .aitools .tk-hero {
    padding: 20px 16px;
  }

  .aitools .tk-hero h1 {
    font-size: 22px;
  }

  .aitools .tk-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
  }

  .aitools .tk-table {
    font-size: 12px;
  }

  .aitools .tk-table th,
  .aitools .tk-table td {
    padding: 8px 10px;
  }

  .aitools .tk-result-card .tk-result-amount {
    font-size: 24px;
  }

  .aitools .tk-savings-big {
    font-size: 32px;
  }

  .aitools .tk-convert-result {
    grid-template-columns: repeat(2, 1fr);
  }

  .aitools .tk-compare-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .aitools .tk-compare-row .model-name {
    min-width: 120px;
  }

  .aitools .tk-compare-row .model-bar {
    width: 100%;
    order: 3;
    margin: 4px 0;
  }

  .aitools .tk-form-row {
    grid-template-columns: 1fr;
  }
}

/* 价格标签颜色 */
.aitools .tag-high {
  background: #fee2e2;
  color: #dc2626;
}
.aitools .tag-medium {
  background: #fef3c7;
  color: #d97706;
}
.aitools .tag-low {
  background: #d1fae5;
  color: #059669;
}

/* 过滤栏 */
.aitools .tk-filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}

.aitools .tk-filter-bar .tk-form-control {
  width: auto;
  min-width: 160px;
}

/* 工具提示和辅助文本 */
.aitools .tk-hint {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
}

/* 特殊效果 */
.aitools .tk-glow {
  animation: tkGlow 2s ease-in-out infinite;
}

@keyframes tkGlow {
  0%, 100% { box-shadow: 0 0 5px rgba(99,102,241,0.3); }
  50% { box-shadow: 0 0 20px rgba(99,102,241,0.6); }
}

/* 模型 logo 占位 */
.aitools .tk-model-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-right: 8px;
}

/* 页脚 */
.aitools .tk-footer {
  text-align: center;
  padding: 24px;
  color: var(--gray-400);
  font-size: 13px;
}

/* 动画数字 */
.aitools .tk-count-up {
  display: inline-block;
  transition: all 0.3s ease;
}