/* ========================================
   AI宣传产品 - 通用样式文件
   版本: 1.0
   最后更新: 2026-05-13
======================================== */

/* ========== CSS Reset & 基础样式 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 手机优化点击 */
button, a, input, select, textarea {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  line-height: 1.6;
  color: var(--text-main);
  background-color: var(--bg-page);
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========== CSS 变量定义 ========== */
/* 浅色模式（默认）*/
:root {
  --bg-page: #ffffff;
  --bg-card: #f8fafc;
  --text-main: #1f2937;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --btn-bg: #2563eb;
  --btn-text: #ffffff;
  
  --primary-color: #2563eb;
  --primary-dark: #1e40af;
  --primary-light: #3b82f6;
  --secondary-color: #64748b;
  --text-color: #1f2937;
  --text-light: #6b7280;
  --bg-color: #ffffff;
  --bg-light: #f8fafc;
  --gray-light: #f3f4f6;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-base: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-xxl: 4rem;
  
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-md: 1.125rem;
  --font-size-lg: 1.25rem;
  --font-size-xl: 1.5rem;
  --font-size-xxl: 2rem;
  --font-size-xxxl: 2.5rem;
  
  --border-radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

/* 深色模式（手动触发）*/
html.dark {
  --bg-page: #121212;
  --bg-card: #1e1e1e;
  --text-main: #e5e5e5;
  --text-secondary: #a0a0a0;
  --border-color: #333333;
  --btn-bg: #337ecc;
  --btn-text: #ffffff;
  
  --text-color: #f9fafb;
  --text-light: #d1d5db;
  --bg-color: #111827;
  --bg-light: #1f2937;
  --gray-light: #374151;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
}

/* 跟随系统自动深色 */
@media (prefers-color-scheme: dark) {
  html:not(.light) {
    --bg-page: #121212;
    --bg-card: #1e1e1e;
    --text-main: #e5e5e5;
    --text-secondary: #a0a0a0;
    --border-color: #333333;
    --btn-bg: #337ecc;
    --btn-text: #ffffff;
    
    --text-color: #f9fafb;
    --text-light: #d1d5db;
    --bg-color: #111827;
    --bg-light: #1f2937;
    --gray-light: #374151;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
  }
}

/* ========== 布局系统 ========== */
main {
  flex: 1;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-base);
}

.section {
  padding: var(--spacing-xxl) 0;
}

.section-title {
  font-size: var(--font-size-xxl);
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--spacing-xl);
  color: var(--text-main);
}

.section-subtitle {
  font-size: var(--font-size-md);
  text-align: center;
  color: var(--text-light);
  margin-top: calc(var(--spacing-base) * -1);
  margin-bottom: var(--spacing-xl);
}

/* 网格布局 */
.grid {
  display: grid;
  gap: var(--spacing-lg);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Flexbox 布局 */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

/* ========== 导航栏样式 ========== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  padding: var(--spacing-base) 0;
  transition: background-color 0.3s ease;
}

html.dark .navbar {
  background: rgba(30, 30, 30, 0.98);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  text-decoration: none;
  color: var(--primary-color);
  font-size: var(--font-size-lg);
  font-weight: 700;
}

.navbar-brand img {
  height: 40px;
  width: auto;
}

.navbar-menu {
  display: flex;
  list-style: none;
  gap: var(--spacing-sm);
  align-items: center;
  flex-wrap: nowrap;
}

.navbar-menu li {
  display: flex;
  align-items: center;
}

.navbar-menu a {
  text-decoration: none;
  color: var(--text-main);
  font-weight: 500;
  transition: var(--transition);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--border-radius);
  white-space: nowrap;
  font-size: var(--font-size-sm);
}

.navbar-menu a:hover,
.navbar-menu a.active {
  color: var(--primary-color);
  background: var(--gray-light);
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--spacing-sm);
}

.navbar-toggle span {
  display: block;
  width: 25px;
  height: 3px;
  background: var(--text-main);
  margin: 5px 0;
  transition: var(--transition);
}

/* ========== 按钮组件 ========== */
.btn {
  display: inline-block;
  padding: var(--spacing-base) var(--spacing-xl);
  font-size: var(--font-size-base);
  font-weight: 600;
  text-decoration: none;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: white;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ========== 卡片组件 ========== */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  padding: var(--spacing-lg);
  transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--border-color);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.card-icon {
  font-size: var(--font-size-xxl);
  margin-bottom: var(--spacing-base);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  color: var(--text-main);
}

.card-text {
  color: var(--text-light);
  line-height: 1.8;
}

/* ========== 表单样式 ========== */
.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 600;
  color: var(--text-main);
}

.form-input,
.form-textarea {
  width: 100%;
  padding: var(--spacing-base);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: var(--font-size-base);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  font-family: inherit;
  background: var(--bg-page);
  color: var(--text-main);
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ========== 页脚样式 ========== */
.footer,
footer {
  background: #1f2937;
  color: white;
  padding: var(--spacing-xxl) 0 var(--spacing-lg);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
}

.footer-section h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--spacing-base);
  color: white;
}

.footer-section p,
.footer-section a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  line-height: 2;
  transition: var(--transition);
}

.footer-section a:hover {
  color: white;
}

.footer-bottom {
  text-align: center;
  padding-top: var(--spacing-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

.footer-bottom a {
  color: #93c5fd;
  text-decoration: none;
  transition: var(--transition);
}

.footer-bottom a:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* ========== 消息提示 ========== */
.message {
  position: fixed;
  top: 80px;
  right: 20px;
  padding: var(--spacing-base) var(--spacing-lg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  animation: slideInRight 0.3s ease;
  max-width: 400px;
}

.message-success {
  background: var(--success-color);
  color: white;
}

.message-error {
  background: var(--error-color);
  color: white;
}

.message-warning {
  background: var(--warning-color);
  color: white;
}

/* ========== 加载动画 ========== */
.loading {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ========== 主题过渡通用规则 ========== */
.card, .container-box, .content-wrap, 
.filters-sidebar, .detail-card, .sidebar-card,
.tools-header, .accordion-header,
.form-input, .form-textarea,
.navbar, .footer, footer {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* 搜索框白色背景特殊处理 */
input[type="text"][style*="background: white"],
input#tool-search-input, input#page-search-input {
  background: var(--bg-page) !important;
  color: var(--text-main) !important;
}

/* ========== 骨架屏 ========== */
.skeleton {
  background: linear-gradient(90deg, var(--gray-light) 25%, var(--bg-light) 50%, var(--gray-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--border-radius);
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-title {
  height: 1.5em;
  width: 60%;
  margin-bottom: 1em;
}

.skeleton-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ========== 回到顶部按钮 ========== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: var(--font-size-xl);
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
  opacity: 0;
  visibility: hidden;
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-5px);
}

/* ========== 深色模式切换按钮 ========== */
.theme-toggle {
  position: fixed;
  bottom: 90px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--bg-color);
  color: var(--text-color);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  cursor: pointer;
  font-size: var(--font-size-xl);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}

/* ========== 徽章样式 ========== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
  text-align: center;
}

.badge-primary {
  background: var(--primary-light);
  color: white;
}

.badge-success {
  background: var(--success-color);
  color: white;
}

.badge-warning {
  background: var(--warning-color);
  color: white;
}

/* 难度等级徽章 */
.difficulty-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  text-align: center;
}

.difficulty-1 {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.difficulty-2 {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.difficulty-3 {
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
}

/* 路径卡片图标 */
.path-icon {
  font-size: 2.5rem;
  margin-bottom: var(--spacing-sm);
}

/* ========== 动画效果 ========== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.fade-in {
  animation: fadeInUp 0.6s ease;
}

/* ========== 工具类 ========== */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-base); }
.mt-3 { margin-top: var(--spacing-lg); }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-base); }
.mb-3 { margin-bottom: var(--spacing-lg); }

.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}

/* ========== 响应式设计 ========== */
@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .footer-content {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* 平板端导航栏优化 */
  .navbar-menu {
    gap: var(--spacing-xs);
  }
  
  .navbar-menu a {
    padding: 4px 8px;
    font-size: 16px;
  }
  
  /* 平板端优化 */
  .section {
    padding: var(--spacing-xl) 0;
  }
  
  :root {
    --font-size-xxxl: 2.25rem;
    --font-size-xxl: 1.75rem;
  }
}

@media (max-width: 768px) {
  :root {
    --font-size-xxxl: 1.75rem;
    --font-size-xxl: 1.5rem;
    --font-size-xl: 1.25rem;
    --font-size-lg: 1.125rem;
    --spacing-xxl: 2.5rem;
    --spacing-xl: 2rem;
    --spacing-lg: 1.25rem;
  }
  
  /* 页面容器手机端优化 */
  .container {
    padding: 0 16px;
  }
  
  /* 导航栏移动端优化 */
  .navbar {
    padding: var(--spacing-sm) 0;
  }
  
  .navbar-menu {
    position: fixed;
    top: 60px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 60px);
    background: white;
    flex-direction: column;
    padding: var(--spacing-lg);
    transition: left 0.3s ease;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    font-size: 16px;
    gap: var(--spacing-sm);
  }
  
  .navbar-menu.active {
    left: 0;
  }
  
  .navbar-menu a {
    padding: 12px 16px;
    font-size: 16px;
    width: 100%;
    text-align: center;
  }
  
  .navbar-toggle {
    display: block;
    padding: 8px;
  }
  
  .navbar-toggle span {
    width: 24px;
    height: 2px;
    margin: 5px 0;
  }
  
  /* 网格布局移动端优化 */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
    gap: var(--spacing-base);
  }
  
  /* Hero区域移动端优化 */
  .hero-section h1 {
    font-size: var(--font-size-xxl);
    line-height: 1.3;
  }
  
  .hero-section p {
    font-size: var(--font-size-base);
  }
  
  /* Section间距优化 */
  .section {
    padding: var(--spacing-xl) 0;
  }
  
  .section-title {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-lg);
  }
  
  .section-subtitle {
    font-size: var(--font-size-base);
    margin-bottom: var(--spacing-lg);
  }
  
  /* 页脚移动端优化 */
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: var(--spacing-lg);
  }
  
  .footer-section h3 {
    font-size: var(--font-size-base);
    margin-bottom: var(--spacing-sm);
  }
  
  .footer-section p,
  .footer-section a {
    font-size: var(--font-size-sm);
    line-height: 1.8;
  }
  
  /* 按钮移动端优化 - 确保触摸目标足够大 */
  .btn {
    padding: 12px 20px;
    font-size: 16px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  /* 卡片移动端优化 */
  .card {
    padding: var(--spacing-base);
    border-radius: 6px;
  }
  
  .card-title {
    font-size: var(--font-size-base);
  }
  
  .card-text {
    font-size: var(--font-size-sm);
  }
  
  /* 表单元素移动端优化 - 防止iOS自动缩放 */
  .form-input,
  .form-textarea,
  select.form-input {
    padding: 12px;
    font-size: 16px;
    min-height: 44px;
  }
  
  .form-label {
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-xs);
  }
  
  /* 消息提示移动端优化 */
  .message {
    left: 10px;
    right: 10px;
    max-width: none;
    top: 70px;
    font-size: var(--font-size-sm);
    padding: var(--spacing-sm) var(--spacing-base);
  }
  
  /* 浮动按钮移动端优化 */
  .back-to-top,
  .theme-toggle {
    width: 44px;
    height: 44px;
    font-size: var(--font-size-base);
    bottom: 16px;
    right: 16px;
  }
  
  .theme-toggle {
    bottom: 68px;
  }
  
  /* 触摸反馈优化 */
  .btn:active, 
  .card:active, 
  .filter-option:active,
  .navbar-menu a:active {
    transform: scale(0.98);
    opacity: 0.9;
    transition: transform 0.1s ease, opacity 0.1s ease;
  }
  
  /* 加载动画移动端优化 */
  .loading {
    width: 32px;
    height: 32px;
    border-width: 3px;
  }
}

@media (max-width: 480px) {
  :root {
    --font-size-xxxl: 1.5rem;
    --font-size-xxl: 1.375rem;
    --font-size-xl: 1.125rem;
    --font-size-lg: 1rem;
    --spacing-xxl: 2rem;
    --spacing-xl: 1.5rem;
    --spacing-lg: 1rem;
    --spacing-base: 0.875rem;
  }
  
  .container {
    padding: 0 var(--spacing-sm);
  }
  
  /* Hero区域超小屏幕优化 */
  .hero-section {
    min-height: 70vh;
    padding: var(--spacing-xl) 0;
  }
  
  .hero-section h1 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-sm);
  }
  
  .hero-section p {
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-lg);
  }
  
  /* CTA按钮组优化 */
  .cta-buttons {
    flex-direction: column;
    width: 100%;
    gap: var(--spacing-sm);
  }
  
  .btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
  }
  
  /* Section标题优化 */
  .section-title {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-base);
  }
  
  .section-subtitle {
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-base);
  }
  
  /* 卡片超小屏幕优化 */
  .card {
    padding: var(--spacing-sm);
  }
  
  .card-icon {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-sm);
  }
  
  .card-title {
    font-size: var(--font-size-base);
    margin-bottom: var(--spacing-xs);
  }
  
  .card-text {
    font-size: 13px;
    line-height: 1.6;
  }
  
  /* 网格间距优化 */
  .grid {
    gap: var(--spacing-sm);
  }
  
  /* 页脚超小屏幕优化 */
  .footer {
    padding: var(--spacing-xl) 0 var(--spacing-base);
  }
  
  .footer-content {
    gap: var(--spacing-base);
    margin-bottom: var(--spacing-base);
  }
  
  .footer-bottom {
    padding-top: var(--spacing-base);
    font-size: 12px;
  }
  
  /* 消息提示超小屏幕优化 */
  .message {
    left: 8px;
    right: 8px;
    top: 65px;
    padding: 10px 12px;
    font-size: 13px;
  }
  
  /* 浮动按钮超小屏幕优化 */
  .back-to-top,
  .theme-toggle {
    width: 40px;
    height: 40px;
    font-size: 14px;
    bottom: 12px;
    right: 12px;
  }
  
  .theme-toggle {
    bottom: 60px;
  }
  
  /* 徽章超小屏幕优化 */
  .badge {
    padding: 3px 8px;
    font-size: 11px;
  }
}

/* 横屏适配 */
@media (max-width: 1024px) and (orientation: landscape) {
  .hero-section {
    min-height: auto;
    padding: var(--spacing-xl) 0;
  }
  
  .hero-section h1 {
    font-size: var(--font-size-xl);
  }
  
  .section {
    padding: var(--spacing-lg) 0;
  }
  
  .carousel-slide img {
    height: 250px;
  }
  
  /* 横屏模式下导航栏优化 */
  .navbar-menu {
    top: 50px;
    height: calc(100vh - 50px);
  }
}

/* ========== 打印样式 ========== */
@media print {
  .navbar,
  .footer,
  .back-to-top,
  .carousel-controls {
    display: none !important;
  }
  
  body {
    color: black;
    background: white;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
}
