/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

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

/* 头部样式 */
header {
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 1rem 0;
}

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

header h1 {
    color: #2c3e50;
    font-size: 1.8rem;
}

header nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

header nav a {
    text-decoration: none;
    color: #3498db;
    font-weight: 500;
    transition: color 0.3s;
}

header nav a:hover {
    color: #2980b9;
}

/* 主要内容区域 */
main {
    padding: 2rem 0;
}

/* 英雄区域 */
.hero {
    text-align: center;
    padding: 3rem 0;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.hero h2 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    color: #7f8c8d;
    margin-bottom: 2rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-large {
    padding: 15px 40px;
    font-size: 1.1rem;
}

/* 特性区域 */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.feature {
    background-color: #fff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.feature h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* 体质类型区域 */
.constitution-types h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #2c3e50;
    font-size: 2rem;
}

.constitution-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.constitution-item {
    background-color: #3498db;
    color: white;
    padding: 1rem;
    text-align: center;
    border-radius: 5px;
    font-weight: 500;
    transition: transform 0.3s;
}

.constitution-item:hover {
    transform: translateY(-5px);
}

/* 表单样式 */
.auth-form {
    max-width: 500px;
    margin: 2rem auto;
    background-color: #fff;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #2c3e50;
    font-size: 1.8rem;
}

.form-group {
    margin-bottom: 1.8rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 500;
    color: #2c3e50;
    font-size: 1.1rem;
}

.form-group input {
    width: 100%;
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    transform: translateY(-2px);
}

/* 复选框组样式 */
.checkbox-group {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background-color: #f8f9fa;
}

.checkbox-group label:hover {
    background-color: #e1f0fa;
    transform: translateY(-2px);
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 5px;
    background-color: white;
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
}

.checkbox-group input[type="checkbox"]:checked {
    background-color: #3498db;
    border-color: #3498db;
}

.checkbox-group input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    color: white;
    font-size: 14px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* 警告信息 */
.alert {
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 1.5rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 链接样式 */
.auth-links {
    text-align: center;
    margin-top: 1.5rem;
}

.auth-links a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* 问答页面样式 */
.quiz-container {
    max-width: 800px;
    margin: 2rem auto;
    background-color: #fff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.question-progress {
    margin-bottom: 2rem;
}

.progress-bar {
    height: 10px;
    background-color: #ecf0f1;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #3498db;
    transition: width 0.3s;
}

.question-number {
    text-align: center;
    margin-bottom: 1rem;
    color: #7f8c8d;
}

.question-text {
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 2rem;
    color: #2c3e50;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.option-card {
    background-color: #f8f9fa;
    border: 2px solid #eee;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.option-card:hover {
    border-color: #3498db;
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.option-card.selected {
    border-color: #3498db;
    background-color: #e1f0fa;
}

.option-card input {
    display: none;
}

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* 结果页面样式 */
.result-container {
    max-width: 800px;
    margin: 2rem auto;
    background-color: #fff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.result-header {
    text-align: center;
    margin-bottom: 2rem;
}

.constitution-name {
    font-size: 2.5rem;
    color: #3498db;
    margin-bottom: 1rem;
}

.result-score {
    font-size: 1.2rem;
    color: #7f8c8d;
    margin-bottom: 2rem;
}

.result-description {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.result-description h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.result-characteristics {
    margin-bottom: 2rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.result-characteristics h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.characteristics-list {
    list-style-type: none;
}

.characteristics-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.characteristics-list li:last-child {
    border-bottom: none;
}

/* 页脚样式 */
footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* 管理后台样式 */
.admin-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.menu-item {
    background-color: #f8f9fa;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.menu-item h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.admin-form {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.admin-form h3, .admin-form h5 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.question-item {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.question-header h4 {
    margin: 0;
    color: #2c3e50;
}

.question-category {
    background-color: #3498db;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.options-list {
    margin: 1.5rem 0;
}

.options-list ul {
    list-style-type: none;
    padding-left: 1rem;
}

.options-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.options-list li:last-child {
    border-bottom: none;
}

.question-actions {
    text-align: right;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.constitution-item-admin {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.constitution-item-admin .form-group {
    margin-bottom: 1rem;
}

.constitution-item-admin textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.users-table th, .users-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.users-table th {
    background-color: #f2f2f2;
    font-weight: 600;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.9rem;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .hero h2 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .navigation-buttons {
        flex-direction: column;
        gap: 1rem;
    }
    
    .navigation-buttons .btn {
        width: 100%;
    }
    
    .admin-menu {
        grid-template-columns: 1fr;
    }
    
    .question-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .users-table {
        font-size: 0.9rem;
    }
    
    .users-table th, .users-table td {
        padding: 8px;
    }
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 2rem;
    border-radius: 10px;
    width: 80%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    position: relative;
}

.modal-content h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    text-align: center;
}

.modal-content p {
    line-height: 1.8;
    color: #333;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: #333;
}

/* 体质建议样式 - 增强版 */
.result-advice-section {
    margin: 2rem 0;
}

.result-advice {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid #3498db;
}

.result-advice h4 {
    color: #2c3e50;
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-advice div {
    line-height: 1.8;
    color: #333;
    padding: 0.5rem 0;
}

/* 强制清除缓存版本号 */
link[rel="stylesheet"] {
    content: "?v=20250804";
}

/* 不同建议类型的样式 */
#diet-advice {
    border-left-color: #e74c3c;
}
#diet-advice h4::before {
    content: "🍎";
}

#exercise-advice {
    border-left-color: #2ecc71;
}
#exercise-advice h4::before {
    content: "🏃";
}

#lifestyle-advice {
    border-left-color: #9b59b6;
}
#lifestyle-advice h4::before {
    content: "🌿";
}

/* 响应式调整 */
@media (max-width: 768px) {
    .result-advice {
        padding: 1rem;
    }
    
    .result-advice h4 {
        font-size: 1.1rem;
    }
    
    /* 手机端结果页面优化 */
    .result-container {
        max-width: 100%;
        margin: 1rem auto;
        padding: 1rem;
        border-radius: 8px;
    }
    
    .constitution-name {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    
    .result-score {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .result-description {
        padding: 1rem;
        margin-bottom: 1rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        text-align: left;
    }
    
    .result-characteristics {
        margin-bottom: 1rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }
    
    .characteristics-list li {
        padding: 0.5rem 0;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        text-align: left;
    }
    
    .result-advice {
        margin-bottom: 1rem;
        padding: 1rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        text-align: left;
    }
    
    .result-advice h4 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .result-advice div {
        line-height: 1.6;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        text-align: left;
    }
    
    /* 图表优化 */
    .score-chart {
        margin: 20px 0;
        padding: 15px;
    }
    
    .chart-container {
        flex-wrap: wrap;
        height: auto;
        gap: 10px;
    }
    
    .chart-bar {
        flex: 1;
        min-width: 60px;
        margin: 5px;
    }
    
    .bar-label {
        font-size: 0.8rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }
    
    .bar-score {
        font-size: 0.8rem;
    }
    
    /* 调试信息优化 */
    .debug-info {
        margin-top: 15px;
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .debug-info table {
        font-size: 0.8rem;
    }
    
    .debug-info th,
    .debug-info td {
        padding: 4px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }
    
    /* 确保所有文本都能完整显示 */
    .result-container * {
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }
    
    /* 移除任何可能导致文本截断的样式 */
    .result-container p,
    .result-container div,
    .result-container li,
    .result-container td,
    .result-container th {
        text-overflow: unset;
        overflow: visible;
        white-space: normal;
    }
}

