/**
 * 全局样式文件
 * 
 * 说明：所有自定义样式统一在此文件管理
 * 优先使用Tailwind CSS工具类，此文件仅存放无法用Tailwind实现的样式
 */

/* ==================== 基础样式 ==================== */

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

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

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

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

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

/* ==================== 动画效果 ==================== */

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

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

/* 延迟动画 */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* ==================== 表单样式 ==================== */

/* 输入框焦点样式 */
.form-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 表单错误状态 */
.form-error {
    border-color: #dc2626 !important;
}

/* 表单成功状态 */
.form-success {
    border-color: #16a34a !important;
}

/* ==================== 按钮样式 ==================== */

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

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

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

/* ==================== 卡片样式 ==================== */

/* 产品卡片悬停效果 */
.product-card {
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

/* ==================== 图片样式 ==================== */

/* 图片懒加载占位 */
.img-placeholder {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* 图片容器 */
.img-container {
    position: relative;
    overflow: hidden;
}

.img-container img {
    transition: transform 0.3s ease;
}

.img-container:hover img {
    transform: scale(1.05);
}

/* ==================== 导航样式 ==================== */

/* 导航链接下划线动画 */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #2563eb;
    transition: width 0.3s ease;
}

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

/* ==================== Toast提示 ==================== */

.toast {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

.toast-success {
    background: #16a34a;
}

.toast-error {
    background: #dc2626;
}

.toast-info {
    background: #2563eb;
}

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

/* ==================== 验证码样式 ==================== */

.captcha-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.captcha-container svg {
    border-radius: 4px;
    background: #f8fafc;
}

/* ==================== 响应式调整 ==================== */

@media (max-width: 768px) {
    /* 移动端字体大小调整 */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    /* 移动端间距调整 */
    .section-padding {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
}

/* ==================== 打印样式 ==================== */

@media print {
    header, footer, .no-print {
        display: none !important;
    }
    
    main {
        padding-top: 0 !important;
    }
    
    body {
        font-size: 12pt;
        color: #000;
    }
}
