@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';

/* Custom CSS Variables */
:root {
  --color-primary: 59 130 246;
  --color-primary-foreground: 255 255 255;
  --color-secondary: 107 114 128;
  --color-secondary-foreground: 255 255 255;
  --color-accent: 236 72 153;
  --color-accent-foreground: 255 255 255;
  --color-neutral: 248 250 252;
  --color-neutral-foreground: 15 23 42;
  --color-neutral-100: 241 245 249;
  --color-neutral-200: 226 232 240;
  --color-neutral-300: 203 213 225;
  --color-neutral-400: 148 163 184;
  --color-neutral-500: 100 116 139;
  --color-neutral-600: 71 85 105;
  --color-neutral-700: 51 65 85;
  --color-neutral-800: 30 41 59;
  --color-neutral-900: 15 23 42;
  --color-neutral-950: 2 6 23;
}

.dark {
  --color-primary: 59 130 246;
  --color-primary-foreground: 255 255 255;
  --color-secondary: 107 114 128;
  --color-secondary-foreground: 255 255 255;
  --color-accent: 236 72 153;
  --color-accent-foreground: 255 255 255;
  --color-neutral: 15 23 42;
  --color-neutral-foreground: 248 250 252;
  --color-neutral-100: 30 41 59;
  --color-neutral-200: 51 65 85;
  --color-neutral-300: 71 85 105;
  --color-neutral-400: 100 116 139;
  --color-neutral-500: 148 163 184;
  --color-neutral-600: 203 213 225;
  --color-neutral-700: 226 232 240;
  --color-neutral-800: 241 245 249;
  --color-neutral-900: 248 250 252;
  --color-neutral-950: 255 255 255;
}

/* Base Styles */
* {
  box-sizing: border-box;
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* 为固定导航栏预留空间 */
}

/* 自定义滚动条样式 */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: rgb(var(--color-neutral-100));
}

::-webkit-scrollbar-thumb {
  background: rgb(var(--color-neutral-400));
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--color-neutral-500));
}

/* Button click feedback */
.btn-feedback {
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.btn-feedback:active {
  transform: scale(0.95);
}

.btn-feedback::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%);
  transform-origin: 50% 50%;
}

.btn-feedback:focus:not(:active)::before {
  animation: ripple 1s ease-out;
}

@keyframes ripple {
  0% {
    transform: scale(0, 0);
    opacity: 0.5;
  }
  20% {
    transform: scale(25, 25);
    opacity: 0.3;
  }
  100% {
    opacity: 0;
    transform: scale(40, 40);
  }
}

/* Button pulse effect */
.btn-pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

/* Button bounce effect */
.btn-bounce:active {
  animation: bounce 0.5s;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* Button glow effect */
.btn-glow:hover {
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.6);
}

/* Button shake effect */
.btn-shake {
  animation: shake 0.5s;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

/* Scroll animations */
.fade-in-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.slide-in-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.slide-in-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* 滚动时显示的动画元素 */
.animate-on-scroll {
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.is-visible {
  opacity: 1;
}

/* 涟漪效果 */
.ripple {
  position: absolute;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: ripple-animation 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* 按钮加载状态 */
.btn-loading {
  position: relative;
  pointer-events: none;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  margin: auto;
  border: 2px solid transparent;
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
}

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

/* 页面加载动画 */
#page-loader {
  transition: opacity 0.3s ease-out;
}

/* 淡入动画类 */
.fade-in {
  opacity: 0;
}

.fade-in-up {
  opacity: 0;
}

.fade-in-down {
  opacity: 0;
}

.fade-in-left {
  opacity: 0;
}

.fade-in-right {
  opacity: 0;
}

/* 打字机效果 */
@keyframes blink {
  0%, 50% {
    border-color: transparent;
  }
  51%, 100% {
    border-color: currentColor;
  }
}

/* 页面切换动画 */
.page-transition-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.page-transition-exit {
  opacity: 1;
  transform: translateY(0);
}

.page-transition-exit-active {
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 页面加载进度条 */
.page-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  z-index: 9999;
  transition: width 0.3s ease;
}

/* 页面骨架屏 */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* 页面加载错误状态 */
.page-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 50vh;
  text-align: center;
}

.page-error-icon {
  font-size: 4rem;
  color: #ef4444;
  margin-bottom: 1rem;
}

.page-error-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.page-error-message {
  color: #6b7280;
  margin-bottom: 1.5rem;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: rgb(var(--color-neutral-foreground));
  background-color: rgb(var(--color-neutral));
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.5em;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.75rem;
}

h4 {
  font-size: 1.5rem;
}

h5 {
  font-size: 1.25rem;
}

h6 {
  font-size: 1.125rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: rgb(var(--color-primary));
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: rgb(var(--color-primary));
  text-decoration: underline;
}

/* Component Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background-color: rgb(var(--color-primary));
  color: rgb(var(--color-primary-foreground));
}

.btn-primary:hover {
  background-color: rgb(var(--color-primary) / 0.9);
}

.btn-secondary {
  background-color: rgb(var(--color-secondary));
  color: rgb(var(--color-secondary-foreground));
}

.btn-secondary:hover {
  background-color: rgb(var(--color-secondary) / 0.9);
}

.btn-outline {
  background-color: transparent;
  color: rgb(var(--color-primary));
  border: 1px solid rgb(var(--color-primary));
}

.btn-outline:hover {
  background-color: rgb(var(--color-primary) / 0.1);
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1.125rem;
}

/* Card Styles */
.card {
  background-color: rgb(var(--color-neutral-100));
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgb(var(--color-neutral-200));
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgb(var(--color-neutral-200));
  background-color: rgb(var(--color-neutral-50));
}

/* Form Styles */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgb(var(--color-neutral-300));
  border-radius: 0.375rem;
  background-color: rgb(var(--color-neutral));
  color: rgb(var(--color-neutral-foreground));
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: rgb(var(--color-primary));
  box-shadow: 0 0 0 3px rgba(var(--color-primary) / 0.1);
}

/* Utility Classes */
.text-gradient {
  background: linear-gradient(to right, rgb(var(--color-primary)), rgb(var(--color-accent)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

.animate-fade-up {
  animation: fadeUp 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgb(var(--color-neutral-200));
}

::-webkit-scrollbar-thumb {
  background: rgb(var(--color-neutral-400));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--color-neutral-500));
}

/* Dark mode scrollbar */
.dark ::-webkit-scrollbar-track {
  background: rgb(var(--color-neutral-800));
}

.dark ::-webkit-scrollbar-thumb {
  background: rgb(var(--color-neutral-600));
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--color-neutral-500));
}

/* Focus styles for accessibility */
.focus-ring:focus {
  outline: 2px solid rgb(var(--color-primary));
  outline-offset: 2px;
}

/* Skip to main content link */
.skip-to-main {
  position: absolute;
  top: -40px;
  left: 6px;
  background: rgb(var(--color-primary));
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
  border-radius: 0 0 4px 4px;
}

.skip-to-main:focus {
  top: 6px;
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
  
  a {
    text-decoration: underline;
  }
  
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }
  
  img {
    max-width: 100% !important;
    height: auto !important;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}