/* ================================================================
 * v2.css — ChemSVG v2 专属样式
 *
 * 依赖：common.css（提供 CSS 变量 --color-*, --space-*, --radius-* 等）
 * 本文件不修改任何 v1 样式，完全独立。
 * ================================================================ */

/* ── 全局导航栏 ── */
#global-nav {
  background: linear-gradient(135deg, #1a5276, #2c3e50);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-xl);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 10px;
  z-index: 100;
}

.nav-inner {
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  height: 56px;
  gap: var(--space-sm);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  margin-right: var(--space-lg);
  flex-shrink: 0;
}

.nav-brand-icon {
  font-size: 24px;
}

.nav-brand-text {
  font-size: 18px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: rgba(255, 255, 255, 0.75);
  font-size: var(--text-base);
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-link:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.nav-link-active {
  color: white;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 600;
}

.nav-link-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.nav-link-classic {
  margin-left: 8px;
  padding-left: 16px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  font-size: var(--text-sm);
  opacity: 0.7;
}

.nav-link-classic:hover {
  opacity: 1;
}

.nav-link-icon {
  font-size: 16px;
}

/* ── 移动端汉堡菜单 ── */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
}

.nav-toggle-bar {
  width: 24px;
  height: 2px;
  background: white;
  border-radius: 1px;
  transition: all var(--transition-fast);
}

@media (max-width: 768px) {
  .nav-inner {
    flex-wrap: wrap;
    height: auto;
    padding: var(--space-md);
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    padding-top: var(--space-sm);
    margin-left: 0;
  }

  .nav-links-open {
    display: flex;
  }

  .nav-link {
    width: 100%;
    padding: 10px 14px;
  }

  .nav-link-classic {
    margin-left: 0;
    padding-left: 14px;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin-top: 4px;
    padding-top: 10px;
  }

  .nav-link-text {
    font-size: var(--text-md);
  }
}

/* ── 工具卡片网格（v2 首页入口区）── */
.tool-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.tool-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-lighter);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  text-decoration: none;
  color: var(--color-text);
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-primary);
}

.tool-card-icon {
  font-size: 36px;
  margin-bottom: var(--space-sm);
  display: block;
}

.tool-card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-secondary);
  margin-bottom: 4px;
}

.tool-card-desc {
  font-size: var(--text-sm);
  color: var(--color-text-lighter);
  line-height: 1.4;
}

.tool-card-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.tool-card-disabled:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
  border-color: var(--color-border-lighter);
}

.tool-card-badge {
  display: inline-block;
  background: var(--color-primary);
  color: white;
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: var(--space-sm);
}

/* ── v1 页面顶部 "新版上线" 提示条 ── */
.v1-upgrade-banner {
  background: linear-gradient(135deg, #1a5276, #2980b9);
  color: white;
  text-align: center;
  padding: 10px var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  font-size: var(--text-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.v1-upgrade-banner a {
  color: white;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.v1-upgrade-banner a:hover {
  color: #e8f4fc;
}

.v1-upgrade-banner-close {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  border-radius: var(--radius-circle);
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.v1-upgrade-banner-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ── 工具页共享组件 ── */

/* 大输入框（配平、计算器共用） */
.tool-input { flex: 1; padding: 14px 18px; border: 2px solid var(--color-primary); border-radius: var(--radius-lg); font-size: var(--text-lg); font-family: var(--font-family-code); }
.tool-input:focus { outline: none; border-color: var(--color-primary-dark); box-shadow: 0 0 0 3px var(--color-primary-light); }
.tool-input-row { display: flex; gap: var(--space-md); }
.tool-input-section { margin-bottom: var(--space-xl); }
.tool-input-section label { display: block; font-size: var(--text-lg); font-weight: 600; color: var(--color-secondary); margin-bottom: var(--space-sm); }

/* 错误提示（配平、计算器共用） */
.tool-error { background: #fde8e8; border: 1px solid #f5c6cb; border-radius: var(--radius-md); padding: 12px var(--space-lg); margin-bottom: var(--space-lg); color: #721c24; display: flex; align-items: center; gap: var(--space-sm); }

/* 示例列表（配平、计算器共用） */
.example-list { display: flex; flex-wrap: wrap; gap: var(--space-sm); justify-content: center; margin-top: var(--space-lg); }
.example-label { width: 100%; font-size: var(--text-sm); margin-bottom: var(--space-sm); }
.example-link { background: none; border: 1px solid var(--color-primary); color: var(--color-primary); padding: 6px 14px; border-radius: 20px; cursor: pointer; font-size: var(--text-sm); transition: all var(--transition-fast); }
.example-link:hover { background: var(--color-primary); color: white; }

/* 空状态（配平、计算器共用） */
.tool-empty { text-align: center; padding: var(--space-xl) 0; color: var(--color-text-lighter); }
.tool-empty-icon { font-size: 64px; margin-bottom: var(--space-md); }

/* ── 智能输入预览 ── */
.smart-preview {
  margin-top: 6px;
  font-size: var(--text-sm);
  color: var(--color-text-lighter);
  line-height: 1.5;
  padding: 6px 10px;
  background: var(--color-bg-compact);
  border-radius: var(--radius-sm);
  min-height: 1.5em;
  word-break: break-all;
}

/* ── 响应式：工具卡片 ── */
@media (max-width: 600px) {
  .tool-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }

  .tool-card {
    padding: var(--space-md);
    min-height: 100px;
  }

  .tool-card-icon {
    font-size: 28px;
  }

  .v1-upgrade-banner {
    font-size: var(--text-sm);
    padding: 8px var(--space-md);
    gap: var(--space-sm);
  }
}

@media (max-width: 400px) {
  .tool-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* --- QQ加群侧边栏 --- */
.qr-sidebar {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000;
  width: 180px;
}
.qr-container {
  background: white;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid #e0e6ed;
  text-align: center;
  position: relative;
  transition: all 0.3s ease;
}
.qr-container:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}
.qr-title {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid #3498db;
}
.qr-image {
  width: 150px;
  height: 150px;
  border-radius: 8px;
  border: 1px solid #e0e6ed;
  margin-bottom: 10px;
}
.qr-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
}
.qr-close-btn:hover {
  background: #c0392b;
  transform: scale(1.1);
}
.qr-description {
  font-size: 12px;
  color: #7f8c8d;
  line-height: 1.4;
  margin-top: 8px;
}
@media (max-width: 768px) {
  .qr-sidebar {
    display: none;
  }
}
