/* 
 * MyCMS - 简化版现代主题样式
 * 兼容原有Tailwind CSS的自定义组件
 */

/* ============================================
   CSS变量定义
   ============================================ */
:root {
  /* 主色调 */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;

  /* 字体 */
  --font-family: 'Inter', 'Sarasa Term SC Nerd', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* 动画 */
  --transition: all 0.3s ease;
  --transition-fast: all 0.15s ease;
}

/* ============================================
   基础样式优化
   ============================================ */
body {
  font-family: var(--font-family);
  line-height: 1.6;
}

/* ============================================
   导航栏增强
   ============================================ */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e5e7eb;
  transition: var(--transition);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: #1f2937;
  text-decoration: none;
  transition: var(--transition-fast);
}

.navbar-brand:hover {
  color: var(--primary-600);
}

.navbar-nav {
  display: flex;
  gap: 2rem;
}

.navbar-nav a {
  color: #4b5563;
  font-weight: 500;
  text-decoration: none;
  position: relative;
  transition: var(--transition-fast);
  padding: 0.5rem 0;
}

.navbar-nav a:hover {
  color: var(--primary-600);
}

.navbar-nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-600);
  transition: width 0.3s ease;
}

.navbar-nav a:hover::after {
  width: 100%;
}

/* ============================================
   按钮样式系统
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
}

.btn:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-primary {
  background: var(--primary-600);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-700);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
}

.btn-secondary:hover {
  background: #e5e7eb;
  color: #1f2937;
}

.btn-outline {
  background: transparent;
  color: var(--primary-600);
  border-color: var(--primary-600);
}

.btn-outline:hover {
  background: var(--primary-600);
  color: white;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
}

/* ============================================
   卡片组件
   ============================================ */
.card {
  background: white;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.card:hover {
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1.5rem;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

/* ============================================
   特色卡片样式
   ============================================ */
.feature-card {
  background: white;
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  border: 1px solid #e5e7eb;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.feature-card:hover::before {
  transform: scaleX(1);
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-200);
}

.feature-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.feature-card:hover .feature-icon {
  transform: scale(1.1);
}

/* ============================================
   Hero区域样式
   ============================================ */
.hero-section {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  position: relative;
  overflow: hidden;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.hero-subtitle {
  font-size: 1.25rem;
  opacity: 0.9;
  margin-bottom: 2rem;
  max-width: 48rem;
  margin-left: auto;
  margin-right: auto;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-button {
  padding: 1rem 2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.hero-button-primary {
  background: white;
  color: #4f46e5;
  box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.2);
}

.hero-button-primary:hover {
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px 0 rgba(0, 0, 0, 0.3);
}

.hero-button-secondary {
  background: transparent;
  color: white;
  border: 2px solid white;
}

.hero-button-secondary:hover {
  background: white;
  color: #4f46e5;
  transform: translateY(-2px);
}

/* ============================================
   表单样式
   ============================================ */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.form-input, .form-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  background: white;
  font-size: 0.875rem;
  transition: var(--transition-fast);
}

.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 7.5rem;
}

/* ============================================
   通知样式
   ============================================ */
.alert {
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  border: 1px solid;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.alert-warning {
  background: #fffbeb;
  border-color: #fed7aa;
  color: #92400e;
}

.alert-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.alert-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

/* ============================================
   页脚样式
   ============================================ */
.footer {
  background: #1f2937;
  color: white;
  padding: 3rem 0;
  margin-top: 4rem;
}

.footer h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: white;
}

.footer a {
  color: #d1d5db;
  text-decoration: none;
  transition: var(--transition-fast);
}

.footer a:hover {
  color: white;
}

/* ============================================
   工具类
   ============================================ */
.text-gradient {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.loading-spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid #f3f4f6;
  border-top: 2px solid var(--primary-600);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ============================================
   动画效果
   ============================================ */
.fade-in {
  animation: fadeIn 0.8s ease-out forwards;
  opacity: 0;
}

.slide-up {
  animation: slideUp 0.6s ease-out;
}

.scale-in {
  animation: scaleIn 0.5s ease-out;
}

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

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 滚动触发的动画 */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.animated {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   工具类增强
   ============================================ */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 选中文本的颜色 */
::selection {
  background-color: rgba(99, 102, 241, 0.2);
  color: #1e40af;
}

::-moz-selection {
  background-color: rgba(99, 102, 241, 0.2);
  color: #1e40af;
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #c7d2fe;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a5b4fc;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1.125rem;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }

  .navbar-nav {
    gap: 1rem;
  }

  .feature-card {
    padding: 1.5rem;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  /* 返回顶部按钮在移动端调整 */
  #back-to-top {
    bottom: 1rem;
    right: 1rem;
    padding: 0.75rem;
  }
}

@media (max-width: 640px) {
  .hero-title {
    font-size: 2rem;
  }

  .card-header,
  .card-body,
  .card-footer {
    padding: 1rem;
  }
}

/* 移动端优化 - 减少动画 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   深色模式支持
   ============================================ */
@media (prefers-color-scheme: dark) {
  .card {
    background: #1f2937;
    border-color: #374151;
    color: #f9fafb;
  }
  
  .card-header,
  .card-footer {
    background: #111827;
    border-color: #374151;
  }
  
  .form-input,
  .form-textarea {
    background: #1f2937;
    border-color: #374151;
    color: #f9fafb;
  }
}

/* ============================================
   打印样式
   ============================================ */
@media print {
  .navbar,
  .footer,
  .btn {
    display: none !important;
  }
  
  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
