/* 使用@layer指令组织CSS代码，便于与Tailwind CSS集成 */

/* 基础样式层 */
@layer base {
  :root {
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --primary-light: #60A5FA;
    --secondary: #64748B;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --light: #F8FAFC;
    --dark: #1E293B;
    --gray: #94A3B8;
    --gray-light: #E2E8F0;
    --gray-dark: #475569;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 12px;
    --radius-sm: 6px;
    --transition: all 0.3s ease;
  }

  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  html {
    scroll-behavior: smooth;
  }

  body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--dark);
    background-color: #F9FAFB;
  }

  h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
  }

  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
  h3 { font-size: 1.5rem; }

  p {
    margin-bottom: 1rem;
  }

  a {
    text-decoration: none;
    color: var(--primary);
    transition: var(--transition);
  }

  a:hover {
    color: var(--primary-dark);
  }

  .container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
  }
}

/* 组件样式层 */
@layer components {
  /* 按钮组件 */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    gap: 8px;
  }

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

  .btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  }

  .btn-secondary {
    background-color: var(--gray-light);
    color: var(--dark);
  }

  .btn-secondary:hover {
    background-color: var(--gray);
    color: white;
  }

  .btn-convert {
    background-color: var(--success);
    color: white;
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    margin-top: 20px;
  }

  .btn-convert:hover {
    background-color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  }

  .download-btn {
    width: 100%;
    padding: 8px;
    font-size: 0.9rem;
  }

  /* 头部组件 */
  .header {
    background-color: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
  }

  .logo {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .logo i {
    font-size: 1.8rem;
    color: var(--primary);
  }

  .logo h1 {
    font-size: 1.5rem;
    margin: 0;
  }

  .logo .to {
    color: var(--primary);
  }

  .nav {
    display: flex;
    gap: 30px;
  }

  .nav-link {
    color: var(--dark);
    font-weight: 500;
    position: relative;
  }

  .nav-link.active {
    color: var(--primary);
  }

  .nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    transition: var(--transition);
  }

  .nav-link:hover::after,
  .nav-link.active::after {
    width: 100%;
  }

  /* 主内容组件 */
  .main {
    padding: 40px 0;
  }

  .section-title {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 15px;
  }

  .section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-color: var(--primary);
    border-radius: 2px;
  }

  /* 转换器组件 */
  .converter-section {
    padding: 60px 0;
  }

  .converter-card {
    background-color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto;
  }

  .card-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 30px;
    text-align: center;
  }

  .card-header h2 {
    margin-bottom: 10px;
  }

  .card-header p {
    opacity: 0.9;
    margin-bottom: 0;
  }

  .drop-area {
    padding: 60px 30px;
    text-align: center;
    border: 2px dashed var(--gray-light);
    border-radius: var(--radius);
    margin: 30px;
    transition: var(--transition);
    cursor: pointer;
  }

  .drop-area:hover,
  .drop-area.active {
    border-color: var(--primary-light);
    background-color: rgba(59, 130, 246, 0.03);
  }

  .drop-area-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }

  .drop-area i {
    font-size: 3rem;
    color: var(--primary);
  }

  .drop-area h3 {
    margin-bottom: 0;
  }

  .supported-formats {
    color: var(--gray-dark);
    font-size: 0.9rem;
  }

  /* 文件预览组件 */
  .files-preview {
    padding: 30px;
  }

  .preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
  }

  .preview-item {
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    transition: var(--transition);
  }

  .preview-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
  }

  .preview-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
  }

  .preview-name {
    padding: 8px;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: var(--light);
  }

  .remove-file {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: var(--transition);
  }

  .preview-item:hover .remove-file {
    opacity: 1;
  }

  /* 转换进度组件 */
  .conversion-progress {
    padding: 30px;
  }

  .progress-bar {
    height: 10px;
    background-color: var(--gray-light);
    border-radius: 5px;
    margin: 20px 0;
    overflow: hidden;
  }

  .progress-fill {
    height: 100%;
    background-color: var(--success);
    transition: width 0.3s ease;
  }

  /* 转换完成组件 */
  .conversion-complete {
    padding: 40px 30px;
    text-align: center;
  }

  .success-icon {
    font-size: 3rem;
    color: var(--success);
    margin-bottom: 20px;
  }

  .download-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
  }

  .download-item {
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-sm);
    padding: 15px;
    transition: var(--transition);
  }

  .download-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
  }

  .download-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
  }

  .download-name {
    font-size: 0.9rem;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
  }

  /* 信息部分组件 */
  .info-section {
    padding: 60px 0;
    background-color: var(--light);
  }

  .steps {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
  }

  .step {
    flex: 1;
    min-width: 250px;
    display: flex;
    gap: 15px;
  }

  .step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
  }

  .step-content h3 {
    margin-bottom: 10px;
  }

  /* 功能特点组件 */
  .features-section {
    padding: 60px 0;
  }

  .features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
  }

  .feature-card {
    background-color: white;
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-align: center;
  }

  .feature-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
  }

  .feature-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.5rem;
  }

  /* FAQ组件 */
  .faq-section {
    padding: 60px 0;
    background-color: var(--light);
  }

  .faq-items {
    max-width: 800px;
    margin: 0 auto;
  }

  .faq-item {
    margin-bottom: 15px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background-color: white;
    box-shadow: var(--shadow);
  }

  .faq-question {
    width: 100%;
    padding: 20px;
    text-align: left;
    background-color: white;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
  }

  .faq-question:hover {
    background-color: var(--light);
  }

  .faq-question i {
    transition: var(--transition);
  }

  .faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: var(--transition);
  }

  .faq-answer p {
    padding: 0 0 20px;
    color: var(--gray-dark);
  }

  .faq-item.active .faq-answer {
    max-height: 500px;
    padding: 0 20px 20px;
  }

  .faq-item.active .faq-question i {
    transform: rotate(180deg);
  }

  /* 页脚组件 */
  .footer {
    background-color: var(--dark);
    color: white;
    padding: 60px 0 20px;
  }

  .footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 40px;
    margin-bottom: 40px;
  }

  .footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
  }

  .footer-logo i {
    font-size: 1.8rem;
    color: var(--primary-light);
  }

  .footer-logo h3 {
    font-size: 1.3rem;
    margin: 0;
  }

  .footer-links {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

  .footer-links a {
    color: var(--gray);
  }

  .footer-links a:hover {
    color: var(--primary-light);
  }

  .footer-social {
    display: flex;
    gap: 15px;
  }

  .social-link {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
  }

  .social-link:hover {
    background-color: var(--primary);
    transform: translateY(-3px);
  }

  .footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--gray);
    font-size: 0.9rem;
  }
}

/* 工具类样式层 */
@layer utilities {
  .hidden {
    display: none !important;
  }

  /* 动画类 */
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }

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

  @keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
  }

  .pulse {
    animation: pulse 2s infinite;
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .header .container {
    flex-direction: column;
    gap: 15px;
  }
  
  .nav {
    gap: 20px;
  }
  
  .converter-card {
    margin: 0 15px;
  }
  
  .drop-area {
    padding: 40px 20px;
    margin: 20px;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .footer-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .preview-list {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
  
  .download-list {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  
  .btn {
    padding: 10px 16px;
  }
  
  .card-header {
    padding: 20px;
  }
  
  .card-header h2 {
    font-size: 1.5rem;
  }
}