/* CSS变量定义 */
:root {
    /* 主色调 */
    --primary-50: #f5f3ff;
    --primary-100: #ede9fe;
    --primary-200: #ddd6fe;
    --primary-300: #c4b5fd;
    --primary-400: #a78bfa;
    --primary-500: #8b5cf6;
    --primary-600: #7c3aed;
    --primary-700: #6d28d9;
    --primary-800: #5b21b6;
    --primary-900: #4c1d95;
    
    /* 辅助色 */
    --secondary-500: #667eea;
    --secondary-600: #5a67d8;
    
    /* 成功色 */
    --success-500: #10b981;
    --success-600: #059669;
    
    /* 警告色 */
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    
    /* 错误色 */
    --error-500: #ef4444;
    --error-600: #dc2626;
    
    /* 文本色 */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    
    /* 背景色 */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    /* 边框色 */
    --border-primary: #e2e8f0;
    --border-secondary: #cbd5e1;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* 圆角 */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    
    /* 过渡时间 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* 全局样式 */
body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

/* 字体层级优化 */
h1 {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 0.5rem;
}

h4 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 页面切换动画 */
.fade-enter-active,
.fade-leave-active {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-enter-from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
}

.fade-leave-to {
    opacity: 0;
    transform: translateY(-20px) scale(1.02);
}

/* 卡片悬停效果 */
.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, box-shadow;
    position: relative;
    overflow: hidden;
}

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

.card-hover:hover {
    transform: translateY(-6px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15), 0 15px 15px -5px rgba(0, 0, 0, 0.05);
}

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

.card-hover:active {
    transform: translateY(-3px);
}

/* 卡片加载动画 */
@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-hover {
    animation: cardFadeIn 0.5s ease forwards;
}

/* 交错动画效果 - 性能优化 */
.grid-cols-1.lg\:grid-cols-3 > div {
    opacity: 0;
    transform: translateY(20px);
    animation: cardFadeIn 0.5s ease forwards;
    will-change: transform, opacity;
}

.grid-cols-1.lg\:grid-cols-3 > div:nth-child(1) {
    animation-delay: 0.1s;
}

.grid-cols-1.lg\:grid-cols-3 > div:nth-child(2) {
    animation-delay: 0.2s;
}

.grid-cols-1.lg\:grid-cols-3 > div:nth-child(3) {
    animation-delay: 0.3s;
}

.grid-cols-1.lg\:grid-cols-3 > div:nth-child(4) {
    animation-delay: 0.4s;
}

.grid-cols-1.lg\:grid-cols-3 > div:nth-child(5) {
    animation-delay: 0.5s;
}

.grid-cols-1.lg\:grid-cols-3 > div:nth-child(6) {
    animation-delay: 0.6s;
}

.grid-cols-1.lg\:grid-cols-3 > div:nth-child(7) {
    animation-delay: 0.7s;
}

.grid-cols-1.lg\:grid-cols-3 > div:nth-child(8) {
    animation-delay: 0.8s;
}

.grid-cols-1.lg\:grid-cols-3 > div:nth-child(9) {
    animation-delay: 0.9s;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .grid-cols-1.lg\:grid-cols-3 > div {
        animation-delay: 0s;
        animation: cardFadeIn 0.3s ease forwards;
    }
}

/* 平板端优化 */
@media (max-width: 1024px) and (min-width: 769px) {
    .grid-cols-1.md\:grid-cols-2 > div:nth-child(1) {
        animation-delay: 0.1s;
    }
    .grid-cols-1.md\:grid-cols-2 > div:nth-child(2) {
        animation-delay: 0.2s;
    }
    .grid-cols-1.md\:grid-cols-2 > div:nth-child(3) {
        animation-delay: 0.3s;
    }
    .grid-cols-1.md\:grid-cols-2 > div:nth-child(4) {
        animation-delay: 0.4s;
    }
    .grid-cols-1.md\:grid-cols-2 > div:nth-child(5) {
        animation-delay: 0.5s;
    }
    .grid-cols-1.md\:grid-cols-2 > div:nth-child(6) {
        animation-delay: 0.6s;
    }
}

/* 按钮动画 */
.btn-primary {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--secondary-500) 100%);
    will-change: transform, box-shadow;
    position: relative;
    overflow: hidden;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: white;
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 10px 20px -3px rgba(102, 126, 234, 0.2);
}

.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.btn-secondary {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background-color: var(--bg-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* 所有按钮的通用过渡效果 */
button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 输入框交互效果 */
input, select, textarea {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: border-color, box-shadow;
}

input:focus, select:focus, textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 渐变背景 */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 毛玻璃效果 */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 加载动画 */
.loading {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 模态框动画 */
.modal-enter-active, .modal-leave-active {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-enter-from, .modal-leave-to {
    opacity: 0;
    transform: scale(0.9);
}

/* 为模态框添加性能优化 */
.modal > div {
    will-change: transform, opacity;
}

/* 产品图标样式 */
.product-icon {
    width: 80px;
    height: 80px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin: 0 auto 1.5rem;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

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

/* 激活码展示区域 */
.license-code-display {
    background: #1f2937;
    color: #f9fafb;
    border-radius: 8px;
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    word-break: break-all;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
    font-size: 14px;
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: slideInRight 0.3s ease;
}

.notification.success {
    background: #10b981;
    color: white;
}

.notification.error {
    background: #ef4444;
    color: white;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 搜索框样式 */
.search-container {
    position: relative;
}

.search-input {
    padding-left: 44px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    z-index: 1;
    pointer-events: none;
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .license-code-display {
        font-size: 12px;
        padding: 12px;
        max-height: 200px;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* 平板设备优化 */
@media (max-width: 1024px) {
    .max-w-7xl {
        max-width: 95%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .grid-cols-1.lg\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .home-section {
        padding: 1.5rem;
    }
}

/* 小屏平板设备优化 */
@media (max-width: 768px) {
    .max-w-7xl {
        max-width: 95%;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .grid-cols-1.lg\:grid-cols-3 {
        grid-template-columns: 1fr;
    }
    
    .home-section {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }
    
    /* 首页标题优化 */
    .home-title {
        font-size: 1.75rem;
        line-height: 1.3;
    }
    
    .home-subtitle {
        font-size: 1rem;
        line-height: 1.5;
        padding: 0 0.5rem;
    }
    
    /* 配置步骤优化 */
    .config-step {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .config-step-content {
        margin-left: 0;
    }
    
    /* 按钮样式优化 */
    button {
        font-size: 0.95rem;
        padding: 0.75rem 1.5rem;
    }
    
    /* 卡片优化 */
    .grid.grid-cols-1.lg\:grid-cols-2.gap-6.md\:gap-8 {
        gap: 1rem;
    }
    
    /* 导航栏优化 */
    .md\:hidden.fixed.bottom-0.left-0.right-0.bg-white.border-t.border-gray-200.z-40 {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    will-change: transform, opacity;
}

.back-to-top.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
    .back-to-top {
        bottom: 90px;  /* 避开底部导航栏 */
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

/* JRebel页面特殊样式 */
.jrebel-container {
    overflow-x: auto;
}

.jrebel-step {
    min-width: 0;
    word-wrap: break-word;
}

/* 配置说明区域 */
.config-section {
    background: #f8fafc;
    border-left: 4px solid #3b82f6;
    padding: 16px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
}

.config-code {
    background: #1f2937;
    color: #f9fafb;
    padding: 12px;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
    overflow-x: auto;
    word-break: break-all;
}

/* 配置步骤优化 */
.config-step {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.config-step-content {
    min-width: 0;
    flex: 1;
}

/* 暗黑模式样式 */
html.dark {
    filter: invert(1) hue-rotate(180deg);
}

/* 只有在没有View Transition时才使用CSS过渡 */
html:not(.view-transition-active) {
    transition: filter 300ms ease;
}

html.dark img,
html.dark video,
html.dark .avatar,
html.dark .image,
html.dark .thumb,
html.dark [class*="icon-"],
html.dark .product-icon {
    filter: invert(1) hue-rotate(180deg);
}

/* 主题切换按钮样式 */
.theme-toggle {
    position: relative;
    width: 50px;
    height: 26px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

html.dark .theme-toggle::before {
    transform: translateX(24px);
}

.theme-toggle .theme-icon {
    font-size: 12px;
    color: white;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.theme-toggle .sun-icon {
    opacity: 1;
}

.theme-toggle .moon-icon {
    opacity: 0;
}

html.dark .theme-toggle .sun-icon {
    opacity: 0;
}

html.dark .theme-toggle .moon-icon {
    opacity: 1;
}

/* View Transition API 动画样式 */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-old(root) {
    z-index: 1;
}

::view-transition-new(root) {
    z-index: 2147483646;
}

html.dark::view-transition-old(root) {
    z-index: 2147483646;
}

html.dark::view-transition-new(root) {
    z-index: 1;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .license-code-display {
        font-size: 12px;
        padding: 12px;
        max-height: 200px;
    }

    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .config-code {
        font-size: 11px;
        padding: 8px;
        white-space: pre-wrap;
        word-break: break-all;
        overflow-wrap: break-word;
    }

    .config-section {
        padding: 12px;
        margin: 12px 0;
    }

    /* 配置步骤移动端优化 */
    .config-step-mobile {
        flex-direction: column;
        space-y: 12px;
    }

    .config-step-mobile .config-step-content {
        margin-left: 0;
        margin-top: 8px;
    }

    /* 首页内容移动端优化 */
    .home-section {
        padding: 16px;
        margin-bottom: 16px;
    }

    .home-title {
        font-size: 28px;
        line-height: 1.2;
    }

    .home-subtitle {
        font-size: 16px;
        line-height: 1.4;
    }

    /* 主题切换按钮移动端优化 */
    .theme-toggle {
        width: 45px;
        height: 24px;
        border-radius: 12px;
    }

    .theme-toggle::before {
        width: 20px;
        height: 20px;
    }

    html.dark .theme-toggle::before {
        transform: translateX(21px);
    }

    .theme-toggle .theme-icon {
        font-size: 10px;
    }
}