/* ====================================
   儿童发育行为评估系统 - 公共样式
   整合自所有测评与登录页面的共同CSS
   ==================================== */

/* ---------- 1. 全局重置和基础样式 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #f8f9fa;
    font-family: "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    overflow-x: hidden;
}

/* ---------- 2. 渐变头部通用样式 ---------- */
.header,
.compact-hero,
.compact-header {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    color: white;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header,
.compact-hero {
    padding: 1.5rem 1rem;
    border-radius: 0 0 20px 20px;
    margin-bottom: 1.5rem;
}

.compact-header {
    padding: 0.75rem 1rem;
}

.header h1,
.compact-hero h1,
.compact-header h1 {
    font-size: 1.2rem;
    margin: 0;
}

.header .lead,
.compact-hero .lead,
.compact-header .lead {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.header .btn-light,
.compact-hero .btn-light {
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
}

/* ---------- 3. 卡片通用样式 ---------- */
.question-card,
.child-card,
.record-header,
.score-card,
.form-container {
    background-color: white;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.question-card {
    border-radius: 8px;
    margin: 0.5rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    width: 100%;
}

/* ---------- 4. 渐变按钮通用样式 ---------- */
.btn-primary,
.compact-start-btn,
.btn-next,
.back-btn,
.fab-btn,
.btn-history,
.btn-save {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: bold;
}

.compact-start-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 1rem;
    text-decoration: none;
}

.btn-next {
    padding: 0.75rem 1.5rem;
    flex: 1;
    margin-left: 0.5rem;
}

.fab-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.5rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- 5. 题目分类标签 ---------- */
.question-category {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background-color: #e9ecef;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #6c757d;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* ---------- 6. 选项按钮 ---------- */
.options-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.option-btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #f8f9fa;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
}

.option-btn:hover {
    background-color: #e9ecef;
}

.option-btn.selected {
    background-color: #4e73df;
    color: white;
    border-color: #4e73df;
}

.option-btn i {
    margin-right: 0.4rem;
    font-size: 1rem;
}

.option-btn-text {
    font-size: 0.9rem;
    font-weight: 500;
}

/* ---------- 7. 进度条容器 ---------- */
.progress-container {
    background-color: white;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    width: 100%;
}

/* ---------- 8. 底部导航 ---------- */
.footer-nav {
    background-color: white;
    padding: 0.75rem 1rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* ---------- 9. 答题内容区域 ---------- */
.main-container {
    max-width: 100%;
    padding: 0 0.5rem;
}

.question-content h5 {
    font-size: 1rem;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ---------- 10. 加载/保存指示器 ---------- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.auto-save-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 9999;
    display: none;
}

/* ---------- 11. 其他复用样式 ---------- */
.question-number {
    color: #dc3545;
    font-weight: bold;
}

.question-original-index {
    color: #6c757d;
    font-size: 0.9em;
}

.score-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #4e73df;
}

.age-badge {
    background-color: #e9ecef;
    color: #6c757d;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.85rem;
}

/* ---------- 12. 固定定位（用于答题/自检页面） ---------- */
.compact-header.fixed-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px;
    width: 100%;
}

.progress-container.fixed-top {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 999;
    width: 100%;
}

.footer-nav.fixed-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 998;
    width: 100%;
}

/* ---------- 13. 响应式适配 ---------- */
@media (max-width: 576px) {
    .header,
    .compact-hero {
        padding: 1rem;
    }

    .compact-header {
        padding: 0.75rem 0.5rem;
    }

    .header h1,
    .compact-hero h1,
    .compact-header h1 {
        font-size: 1.1rem;
    }

    .question-card {
        padding: 0.75rem;
        margin: 0.25rem 0;
    }

    .question-content h5 {
        font-size: 0.95rem;
    }

    .option-btn {
        padding: 0.4rem 0.25rem;
        min-height: 34px;
    }

    .option-btn i {
        font-size: 0.9rem;
        margin-right: 0.3rem;
    }

    .option-btn-text {
        font-size: 0.85rem;
    }

    .footer-nav {
        padding: 0.75rem 0.5rem;
    }

    .progress-container {
        padding: 0.75rem 0.5rem;
    }

    .main-container {
        padding: 0;
    }

    .compact-feature-card {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .compact-feature-icon {
        font-size: 1.5rem;
    }

    .compact-feature-content h4 {
        font-size: 0.9rem;
    }

    .compact-feature-content p {
        font-size: 0.75rem;
    }
}

@media (max-width: 360px) {
    .header h1,
    .compact-hero h1,
    .compact-header h1 {
        font-size: 1rem;
    }

    .question-card {
        padding: 0.5rem;
    }

    .options-container {
        gap: 0.25rem;
    }

    .option-btn i {
        font-size: 0.85rem;
        margin-right: 0.2rem;
    }

    .option-btn-text {
        font-size: 0.8rem;
    }

    .compact-header .btn-history {
        font-size: 0.8rem;
        padding: 0.2rem 0.5rem;
    }
}

/* ---------- 14. 错误页面通用样式 ---------- */
.error-container {
    max-width: 600px;
    margin: 50px auto;
    padding: 20px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.error-icon {
    font-size: 4rem;
    color: #dc3545;
    margin-bottom: 20px;
}

/* ---------- 15. 录播素材页面样式 ---------- */
.file-table {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
}

.file-table th {
    background-color: #f1f3f5;
    border-bottom: 2px solid #dee2e6;
    padding: 12px 10px;
    text-align: center;
    font-weight: 600;
}

.file-table td {
    padding: 8px 10px;
    vertical-align: middle;
    text-align: center;
}

.file-table .file-name-cell {
    text-align: left;
}

.file-name-cell .file-name {
    font-weight: 500;
    cursor: pointer;
    color: #4e73df;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.file-name-cell .file-name:hover {
    text-decoration: underline;
}

.last-use-cell {
    cursor: pointer;
    color: #4e73df;
    font-weight: 500;
}

/* ---------- 16. Toast提示 ---------- */
.toast-msg {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    z-index: 3000;
    white-space: nowrap;
}

/* ---------- 17. 紧凑型首页特性卡片 ---------- */
.compact-features {
    padding: 0 0.5rem;
}

.compact-feature-card {
    background-color: white;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    text-align: center;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.compact-feature-icon {
    font-size: 1.8rem;
    color: #4e73df;
    flex-shrink: 0;
}

.compact-feature-content {
    flex: 1;
    text-align: left;
}

.compact-feature-content h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.compact-feature-content p {
    font-size: 0.8rem;
    color: #6c757d;
    margin: 0;
    line-height: 1.3;
}

/* ---------- 18. 录播素材编辑模态框 ---------- */
.modal-dialog-custom {
    max-width: 500px;
    width: 94%;
    margin: 1.75rem auto;
}

@media (min-width: 768px) {
    .modal-dialog-custom {
        width: 500px;
    }
}

.edit-table-container {
    max-height: 60vh;
    overflow-y: auto;
}

.edit-table th,
.edit-table td {
    padding: 8px 12px;
    vertical-align: middle;
}

.edit-desc-textarea {
    width: 100%;
    min-height: 80px;
    resize: vertical;
}

.badge-disabled {
    background: #dc3545;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    margin-left: 6px;
}

.check-square {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 2px solid #4e73df;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    color: #4e73df;
    flex-shrink: 0;
}

.check-square:hover {
    background-color: #e7f1ff;
}

.check-square.checked {
    background: #4e73df;
    color: white;
    border-color: #4e73df;
}

.check-square.disabled {
    border-color: #ccc;
    background: #f5f5f5;
    cursor: not-allowed;
    color: #ccc;
}

/* ---------- 19. 答题记录页面样式 ---------- */
.summary-info {
    background-color: #e9ecef;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.age-info {
    background-color: #d1ecf1;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border-left: 4px solid #17a2b8;
}

.score-row {
    display: flex;
    justify-content: space-between;
    text-align: center;
    padding: 1rem 0.5rem;
}

.score-item {
    flex: 1;
    padding: 0 0.5rem;
}

.score-label {
    color: #6c757d;
    font-size: 0.8rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eaecf4;
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    color: #6c757d;
}

.answer-yes {
    color: #28a745;
    font-weight: bold;
}

.answer-no {
    color: #dc3545;
    font-weight: bold;
}

/* ---------- 20. 居中布局（用于登录错误等页面） ---------- */
.center-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #f5f5f5;
}

/* ---------- 21. 表单容器 ---------- */
.form-container {
    max-width: 500px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* ---------- 22. 固定底部按钮（用于答题记录等页面） ---------- */
.fixed-back-btn {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 999;
}

.fixed-back-btn:hover {
    opacity: 0.9;
    color: white;
}

/* ---------- 23. 单行全屏布局（用于首页） ---------- */
.single-line-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.main-content {
    flex: 1;
}

/* ---------- 24. 空状态提示 ---------- */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #6c757d;
}

.empty-state-icon {
    font-size: 4rem;
    color: #6c757d;
    margin-bottom: 1rem;
}
