/* Component Styles - 科道合健康网站组件样式 */

/* Logo Animations */
.logo {
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

/* 按钮组件 - 使用设计系统，见 design-system.css */
/* 此文件中的按钮样式已被 design-system.css 中的统一样式替代 */

/* 卡片组件 */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.card-header {
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.card-subtitle {
    color: #718096;
    font-size: 0.9rem;
}

.card-content {
    color: #4a5568;
    line-height: 1.6;
}

/* 表单组件 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2d3748;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

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

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

/* 导航组件 */
.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle .bar {
    width: 25px;
    height: 3px;
    background: #2d3748;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

/* 响应式导航 */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        z-index: 1000;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu .nav-link {
        padding: 1rem;
        display: block;
        border-bottom: 1px solid #f7fafc;
    }
}

/* 统计数字组件 */
.stat-item {
    text-align: center;
    padding: 1.5rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 0.5rem;
}
.stat-label {
    color: #718096;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 特色框组件 */
.feature-box {
    text-align: center;
    padding: 2rem 1rem;
}

.feature-icon {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1rem;
}

.feature-description {
    color: #718096;
    line-height: 1.6;
}

/* 加载动画组件 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* 提示框组件 */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-success {
    background: #f0fff4;
    color: #22543d;
    border-color: #48bb78;
}

.alert-error {
    background: #fed7d7;
    color: #742a2a;
    border-color: #f56565;
}

.alert-warning {
    background: #fffbeb;
    color: #744210;
    border-color: #ed8936;
}

.alert-info {
    background: #ebf8ff;
    color: #2a4365;
    border-color: #4299e1;
}

/* 徽章组件 */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: #667eea;
    color: white;
}

.badge-success {
    background: #48bb78;
    color: white;
}

.badge-warning {
    background: #ed8936;
    color: white;
}

.badge-error {
    background: #f56565;
    color: white;
}

/* 分隔线组件 */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
    margin: 2rem 0;
}

/* 渐变文字组件 */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 响应式工具类 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }

/* 增强表单样式 */
.contact-form {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-group.focused .form-label {
    color: #667eea;
    transform: translateY(-0.5rem);
    font-size: 0.85rem;
}

.form-group.filled .form-label {
    transform: translateY(-0.5rem);
    font-size: 0.85rem;
}

.form-input, .form-textarea, select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

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

.form-input.error, .form-textarea.error, select.error {
    border-color: #f56565;
}

.form-input.success, .form-textarea.success, select.success {
    border-color: #48bb78;
}

/* 复选框样式 */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.4;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    display: inline-block;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-top: 2px;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #667eea;
    border-color: #667eea;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* 按钮增强 - 使用设计系统 */
/* .btn-large 已在 design-system.css 中定义 */
/* .btn:disabled 已在 design-system.css 中定义 */

/* 字段错误提示 */
.field-error {
    color: #f56565;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.field-error::before {
    content: '⚠';
    font-size: 0.9rem;
}

.field-success {
    color: #48bb78;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.field-success::before {
    content: '✓';
    font-size: 0.9rem;
}

/* 表单提交状态 */
.form-submitting {
    pointer-events: none;
    opacity: 0.7;
}

.form-success {
    border: 2px solid #48bb78;
    background: #f0fff4;
}

.form-error {
    border: 2px solid #f56565;
    background: #fed7d7;
}

/* 选择框样式增强 */
select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

/* 响应式表单 */
@media (max-width: 480px) {
    .contact-form {
        padding: 1.5rem;
    }

    .form-input, .form-textarea, select {
        font-size: 16px; /* 防止iOS缩放 */
    }
}
/* 无障碍访问支持 */
.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;
}

.sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 0.5rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    background: #667eea;
    color: white;
    border-radius: 4px;
    z-index: 9999;
}

/* 跳转链接 */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #667eea;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 9999;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}

/* 焦点指示器增强 */
*:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

button:focus,
.btn:focus,
input:focus,
textarea:focus,
select:focus,
a:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .btn-primary {
        background: #000;
        border: 2px solid #000;
        color: #fff;
    }

    .btn-secondary {
        background: #fff;
        border: 2px solid #000;
        color: #000;
    }

    .card {
        border: 2px solid #000;
    }
}

/* 减少动画模式支持 */
@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;
    }
}

/* 键盘导航增强 */
.nav-link:focus,
.btn:focus {
    position: relative;
    z-index: 1;
}

/* 表单标签关联 */
.form-label {
    cursor: pointer;
}

/* 错误状态的无障碍支持 */
.form-input[aria-invalid="true"] {
    border-color: #f56565;
}

.form-input[aria-invalid="false"] {
    border-color: #48bb78;
}

/* 加载状态的无障碍支持 */
.loading {
    position: relative;
}

.loading::after {
    content: "加载中";
    position: absolute;
    left: -9999px;
}

/* 颜色对比度优化 */
.text-muted {
    color: #4a5568 !important; /* 提高对比度 */
}

.bg-light {
    background-color: #f8f9fa !important;
    color: #2d3748 !important;
}

/* 触摸目标大小 */
@media (pointer: coarse) {
    .btn,
    .nav-link,
    input,
    textarea,
    select,
    button {
        min-height: 44px;
        min-width: 44px;
    }

    .checkbox-label {
        min-height: 44px;
        align-items: center;
    }
}