/* CSS自定义属性 - 设计系统 */
:root {
    /* 主色调 */
    --primary-color: #667eea;
    --primary-dark: #5a6fd8;
    --primary-light: #8b9cec;
    --secondary-color: #ac7edb;
    --accent-color: #6c74f0;
    
    /* 中性色 */
    --white: #ffffff;
    --black: #000000;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* 功能色 */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    
    /* 间距系统 - 重新优化 */
    --space-xs: 0.25rem;    /* 4px */
    --space-sm: 0.5rem;     /* 8px */
    --space-md: 1rem;       /* 16px */
    --space-lg: 1.5rem;     /* 24px */
    --space-xl: 2rem;       /* 32px */
    --space-2xl: 3rem;      /* 48px */
    --space-3xl: 4rem;      /* 64px */
    --space-4xl: 5rem;      /* 80px */
    --space-5xl: 6rem;      /* 96px */
    
    /* Section间距 */
    --section-padding-y: var(--space-5xl);
    --section-padding-y-sm: var(--space-4xl);
    --section-gap: var(--space-3xl);
    
    /* 字体系统 */
    --font-family-base: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-5xl: 3rem;
    --font-size-6xl: 3.75rem;
    
    /* 行高 */
    --line-height-tight: 1.25;
    --line-height-snug: 1.375;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.625;
    --line-height-loose: 2;
    
    /* 边框半径 */
    --radius-sm: 0.125rem;
    --radius-base: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-3xl: 1.5rem;
    --radius-full: 9999px;
    
    /* 阴影 - 增强层次感 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --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);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    
    /* 动画时长 */
    --duration-75: 75ms;
    --duration-100: 100ms;
    --duration-150: 150ms;
    --duration-200: 200ms;
    --duration-300: 300ms;
    --duration-500: 500ms;
    --duration-700: 700ms;
    --duration-1000: 1000ms;
    
    /* 动画缓动 */
    --ease-linear: linear;
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    
    /* 断点 */
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;
    
    /* z-index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-toast: 1080;
}

/* 基础样式和重置 */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    line-height: var(--line-height-normal);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* 为固定导航预留空间 */
}

body {
    margin: 0;
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    color: var(--gray-800);
    background-color: var(--white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 无障碍优化 */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--gray-900);
    color: var(--white);
    padding: 8px;
    text-decoration: none;
    border-radius: var(--radius-base);
    z-index: var(--z-tooltip);
    transition: top var(--duration-200) var(--ease-out);
}

.skip-link:focus {
    top: 6px;
}

/* 统一容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-md);
    }
}

/* Section统一样式 */
section {
    padding: var(--section-padding-y) 0;
    position: relative;
}

section:nth-child(even) {
    background-color: var(--gray-50);
}

/* Section标题统一样式 */
.section-header {
    text-align: center;
    margin-bottom: var(--space-4xl);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.section-header h2 {
    margin-bottom: var(--space-lg);
}

.section-header p {
    font-size: var(--font-size-lg);
    color: var(--gray-600);
    line-height: var(--line-height-relaxed);
}

/* 按钮系统优化 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-full);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--font-size-base);
    transition: all var(--duration-200) var(--ease-out);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    min-height: 44px; /* 确保触摸友好 */
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left var(--duration-500) var(--ease-out);
}

.btn:hover::before {
    left: 100%;
}

.btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
}

.btn-large {
    padding: var(--space-lg) var(--space-2xl);
    font-size: var(--font-size-lg);
}

.btn-small {
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--font-size-sm);
}

/* 标题系统 */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: var(--line-height-tight);
    color: var(--gray-900);
    margin: 0;
}

h1 { font-size: var(--font-size-5xl); }
h2 { font-size: var(--font-size-4xl); }
h3 { font-size: var(--font-size-3xl); }
h4 { font-size: var(--font-size-2xl); }
h5 { font-size: var(--font-size-xl); }
h6 { font-size: var(--font-size-lg); }

/* Section标题增强 */
h2 {
    position: relative;
    padding-bottom: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-full);
}

/* 段落和文本 */
p {
    margin: 0 0 var(--space-lg) 0;
    line-height: var(--line-height-relaxed);
    color: var(--gray-700);
}

p:last-child {
    margin-bottom: 0;
}

/* 链接样式 */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--duration-200) var(--ease-out);
}

a:hover {
    color: var(--primary-dark);
}

a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* 列表样式 */
ul, ol {
    margin: 0 0 var(--space-lg) 0;
    padding-left: var(--space-xl);
    color: var(--gray-700);
}

/* 图片优化 */
img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
}

img[loading="lazy"] {
    opacity: 0;
    transition: opacity var(--duration-300) var(--ease-out);
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* 表单样式增强 */
input, textarea, select {
    width: 100%;
    padding: var(--space-md);
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-family: inherit;
    transition: all var(--duration-200) var(--ease-out);
    background: var(--white);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input:invalid:not(:placeholder-shown), textarea:invalid:not(:placeholder-shown) {
    border-color: var(--error-color);
}

.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 600;
    color: var(--gray-800);
}

.form-group .required {
    color: var(--error-color);
}

.form-group.error input,
.form-group.error textarea,
.form-group.error select {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-group.success input,
.form-group.success textarea,
.form-group.success select {
    border-color: var(--success-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.error-message {
    margin-top: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--error-color);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* 卡片系统 */
.card {
    background: var(--white);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-base);
    padding: var(--space-2xl);
    transition: all var(--duration-300) var(--ease-out);
    border: 1px solid var(--gray-100);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--gray-200);
}

/* 网格布局系统 */
.grid {
    display: grid;
    gap: var(--space-2xl);
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

@media (max-width: 768px) {
    .grid {
        gap: var(--space-xl);
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* 通用工具类 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }

.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }

.hidden { display: none; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 间距工具类 */
.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.p-0 { padding: 0; }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

/* 动画和过渡 */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeIn var(--duration-700) var(--ease-out) forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-left {
    opacity: 0;
    transform: translateX(-50px);
    animation: slideInLeft var(--duration-700) var(--ease-out) forwards;
}

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    animation: slideInRight var(--duration-700) var(--ease-out) forwards;
}

@keyframes slideInRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 快速联系按钮 - 替代浮动工具 */
.quick-contact {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    z-index: var(--z-fixed);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.quick-contact-btn {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--white);
    transition: all var(--duration-300) var(--ease-out);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.quick-contact-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.2);
    opacity: 0;
    transition: opacity var(--duration-200) var(--ease-out);
}

.quick-contact-btn:hover::before {
    opacity: 1;
}

.quick-contact-btn:hover {
    transform: scale(1.1);
}

.contact-phone {
    background: linear-gradient(135deg, #10b981, #059669);
}

.contact-form {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: var(--space-xl);
    left: var(--space-xl);
    width: 3rem;
    height: 3rem;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all var(--duration-300) var(--ease-out);
    z-index: var(--z-fixed);
    opacity: 0;
    visibility: hidden;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.back-to-top:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 通知组件 */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--space-lg) var(--space-xl);
    box-shadow: var(--shadow-2xl);
    z-index: var(--z-toast);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    max-width: 400px;
    min-width: 320px;
    animation: slideInFromRight var(--duration-300) var(--ease-out);
    border-left: 4px solid var(--info-color);
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-success {
    border-left-color: var(--success-color);
}

.notification-error {
    border-left-color: var(--error-color);
}

.notification-warning {
    border-left-color: var(--warning-color);
}

.notification-info {
    border-left-color: var(--info-color);
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--gray-500);
    padding: var(--space-xs);
    border-radius: var(--radius-base);
    transition: all var(--duration-200) var(--ease-out);
}

.notification-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.notification.fade-out {
    animation: fadeOutToRight var(--duration-300) var(--ease-in) forwards;
}

@keyframes fadeOutToRight {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* 加载动画 */
.loading {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

.loading::after {
    content: '';
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--gray-300);
    border-top-color: var(--primary-color);
    border-radius: var(--radius-full);
    animation: spin var(--duration-1000) linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 页面加载器 */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: var(--white);
}

.loader-content h3 {
    margin-bottom: var(--space-md);
    font-size: var(--font-size-2xl);
}

.loader-content p {
    opacity: 0.9;
    font-size: var(--font-size-lg);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--white);
    border-radius: var(--radius-full);
    animation: spin var(--duration-1000) linear infinite;
    margin-bottom: var(--space-lg);
}

/* 移动端优化 */
@media (max-width: 768px) {
    :root {
        --section-padding-y: var(--space-4xl);
        --section-gap: var(--space-2xl);
    }
    
    .quick-contact {
        bottom: var(--space-lg);
        right: var(--space-lg);
    }
    
    .quick-contact-btn {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }
    
    .back-to-top {
        bottom: var(--space-lg);
        left: var(--space-lg);
        width: 2.5rem;
        height: 2.5rem;
    }
    
    .notification {
        left: 1rem;
        right: 1rem;
        max-width: none;
        min-width: auto;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    :root {
        --gray-50: #f0f0f0;
        --gray-100: #e0e0e0;
        --shadow-base: 0 2px 4px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3);
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 打印样式 */
@media print {
    .page-loader,
    .quick-contact,
    .back-to-top,
    .notification {
        display: none !important;
    }
    
    body {
        color: black;
        background: white;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .btn {
        background: none !important;
        color: black !important;
        border: 1px solid black !important;
    }
} 