/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #eef3f8;
    min-height: 100vh;
    padding: 2rem 1.5rem 4rem;
    color: #1a2d3c;
}

/* ===== 返回首页固定按钮 ===== */
.back-home-fixed {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 999;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 60px;
    padding: 0.6rem 1.4rem 0.6rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1f5777;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    transition: transform 0.2s ease, box-shadow 0.25s ease;
    cursor: pointer;
}
.back-home-fixed:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 24px rgba(43,108,148,0.12);
    background: rgba(255,255,255,0.96);
}
@media (max-width: 640px) {
    .back-home-fixed { top: 1rem; left: 1rem; padding: 0.4rem 1rem 0.4rem 0.8rem; font-size: 0.8rem; }
    .back-home-fixed span { display: none; }
}

/* ===== 固定分享按钮 ===== */
.share-fixed {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 999;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 60px;
    padding: 0.6rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1f5777;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    transition: transform 0.2s ease, box-shadow 0.25s ease;
    cursor: pointer;
    border: none;
    background: rgba(255,255,255,0.88);
}
.share-fixed:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 24px rgba(43,108,148,0.12);
    background: rgba(255,255,255,0.96);
}
@media (max-width: 640px) {
    .share-fixed { top: 1rem; right: 1rem; padding: 0.4rem 0.8rem; font-size: 0.8rem; }
    .share-fixed span { display: none; }
}

/* ===== 主容器 ===== */
.platform-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(8px);
    border-radius: 2.2rem;
    padding: 2rem 2.4rem 2.8rem;
    box-shadow: 0 16px 48px rgba(0,20,40,0.08);
    border: 1px solid rgba(255,255,255,0.6);
}

/* ===== 头部 ===== */
.platform-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.2rem;
    border-bottom: 2px solid rgba(0,0,0,0.04);
}
.title-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.icon-box {
    font-size: 1.8rem;
    color: #2b6c94;
}
.title-group h1 {
    font-size: 1.6rem;
    font-weight: 600;
    color: #0a2540;
}
.version-badge {
    font-size: 0.7rem;
    background: rgba(43,108,148,0.08);
    padding: 0.1rem 0.8rem;
    border-radius: 40px;
    color: #2b6c94;
    font-weight: 500;
    margin-left: 0.3rem;
}
.subtitle {
    font-size: 0.85rem;
    color: #7a9bb3;
    margin-top: 0.1rem;
}
.header-actions .btn-outline {
    background: transparent;
    border: 1.5px solid #dce4ec;
    padding: 0.4rem 1.2rem;
    border-radius: 60px;
    font-size: 0.85rem;
    color: #5b7f95;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.header-actions .btn-outline.danger {
    border-color: #fca5a5;
    color: #b91c1c;
}
.header-actions .btn-outline.danger:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

/* ===== 统计卡片 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: #fff;
    border-radius: 1.2rem;
    padding: 1.2rem 1.4rem;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.stat-card .stat-icon {
    font-size: 1.4rem;
    color: #2b6c94;
    opacity: 0.6;
}
.stat-card .stat-label {
    font-size: 0.8rem;
    color: #7a9bb3;
    font-weight: 500;
    margin-top: 0.2rem;
}
.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0a2540;
}
.stat-card .stat-value .unit {
    font-size: 0.9rem;
    font-weight: 400;
    color: #7a9bb3;
}
.stat-card .stat-change {
    font-size: 0.8rem;
    color: #7a9bb3;
    margin-top: 0.2rem;
}
.stat-card .stat-change span {
    display: inline-block;
    padding: 0.05rem 0.6rem;
    border-radius: 40px;
    background: rgba(0,0,0,0.04);
}

/* ===== 加载中 ===== */
.loading-overlay {
    display: none;
    text-align: center;
    padding: 2rem 0;
    color: #7a9bb3;
}
.loading-overlay.active {
    display: block;
}
.loading-overlay i {
    font-size: 2rem;
    animation: spin 1s linear infinite;
    display: block;
    margin-bottom: 0.5rem;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== 筛选栏 ===== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.8rem 1.2rem;
    background: rgba(255,255,255,0.5);
    padding: 1rem 1.4rem;
    border-radius: 1.2rem;
    margin-bottom: 1.6rem;
    border: 1px solid rgba(0,0,0,0.04);
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.filter-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #7a9bb3;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.filter-group input,
.filter-group select {
    padding: 0.4rem 0.8rem;
    border: 1.5px solid #dce4ec;
    border-radius: 10px;
    font-size: 0.85rem;
    font-family: inherit;
    background: #fff;
    color: #1a2d3c;
    outline: none;
    transition: border-color 0.2s;
    min-width: 140px;
}
.filter-group input:focus,
.filter-group select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.06);
}
.date-sep {
    color: #7a9bb3;
    font-size: 0.8rem;
    padding: 0 0.2rem;
}
.btn-filter {
    padding: 0.4rem 1.4rem;
    border-radius: 60px;
    border: none;
    background: #2b6c94;
    color: #fff;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    height: 38px;
}
.btn-filter:hover {
    background: #1f5777;
}
.btn-filter.outline {
    background: transparent;
    border: 1.5px solid #dce4ec;
    color: #5b7f95;
}
.btn-filter.outline:hover {
    background: rgba(0,0,0,0.02);
}

/* ===== 表格 ===== */
.table-wrapper {
    overflow-x: auto;
    border-radius: 1.2rem;
    border: 1px solid rgba(0,0,0,0.04);
    background: #fff;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table thead {
    background: #f8fafc;
    border-bottom: 2px solid #e6edf4;
}
.data-table th {
    padding: 0.8rem 0.8rem;
    text-align: left;
    font-weight: 600;
    color: #5b7f95;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.data-table td {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid #f0f4f9;
    color: #1a2d3c;
    vertical-align: middle;
}
.data-table tbody tr:hover {
    background: #f8fafc;
}
.data-table .col-seq {
    width: 48px;
    text-align: center;
    color: #7a9bb3;
    font-size: 0.8rem;
}
.data-table .col-name {
    font-weight: 500;
}
.data-table .col-score {
    text-align: center;
}
.score-badge {
    display: inline-block;
    padding: 0.1rem 0.6rem;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 32px;
    text-align: center;
}
.score-badge.good {
    background: rgba(16,185,129,0.12);
    color: #059669;
}
.score-badge.warn {
    background: rgba(245,158,11,0.12);
    color: #d97706;
}
.score-badge.danger {
    background: rgba(220,38,38,0.08);
    color: #b91c1c;
}
.col-actions {
    display: flex;
    gap: 0.3rem;
    justify-content: center;
}
.btn-action {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #7a9bb3;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-action.view:hover {
    background: rgba(43,108,148,0.08);
    color: #2b6c94;
}
.btn-action.delete:hover {
    background: rgba(220,38,38,0.08);
    color: #b91c1c;
}
.col-time {
    font-size: 0.8rem;
    color: #7a9bb3;
    white-space: nowrap;
}

/* ===== 表格底部 ===== */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 1rem;
    margin-top: 0.2rem;
}
.total-info {
    font-size: 0.85rem;
    color: #5b7f95;
}
.total-info strong {
    color: #0a2540;
}
.total-info .sep {
    margin: 0 0.5rem;
    color: #dce4ec;
}
.total-info .filter-info {
    color: #d97706;
}
.total-info .data-source-tag {
    background: rgba(43,108,148,0.06);
    padding: 0.1rem 0.8rem;
    border-radius: 40px;
    font-size: 0.75rem;
}
.export-actions {
    display: flex;
    gap: 0.6rem;
}
.btn-export {
    padding: 0.3rem 1.2rem;
    border-radius: 60px;
    border: 1.5px solid #dce4ec;
    background: transparent;
    color: #5b7f95;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-export:hover {
    background: rgba(0,0,0,0.02);
}
.btn-export.primary {
    background: #2b6c94;
    border-color: #2b6c94;
    color: #fff;
}
.btn-export.primary:hover {
    background: #1f5777;
    border-color: #1f5777;
}

/* ===== 详情弹窗 ===== */
.detail-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,37,64,0.4);
    backdrop-filter: blur(6px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeIn 0.25s ease;
}
.detail-modal.active {
    display: flex;
}
@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}
.modal-box {
    background: #fff;
    border-radius: 2rem;
    max-width: 780px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem 2.2rem 2rem;
    box-shadow: 0 24px 64px rgba(0,0,0,0.15);
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    0% { opacity: 0; transform: translateY(20px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: #0a2540;
    margin-bottom: 0.2rem;
}
.modal-title .close-modal {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: #7a9bb3;
    cursor: pointer;
    padding: 0 0.2rem;
    transition: color 0.2s;
}
.modal-title .close-modal:hover {
    color: #1f5777;
}
.modal-sub {
    font-size: 0.85rem;
    color: #7a9bb3;
    margin-bottom: 1.2rem;
}
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 1.2rem;
    background: #f8fafc;
    padding: 0.8rem 1rem;
    border-radius: 1rem;
    margin-bottom: 1.2rem;
}
.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}
.detail-item .d-label {
    color: #7a9bb3;
    font-size: 0.8rem;
}
.detail-item .d-value {
    font-weight: 500;
    font-size: 0.9rem;
    color: #0a2540;
    text-align: right;
}
.detail-section {
    margin-bottom: 1.2rem;
}
.detail-section .sec-title {
    font-weight: 600;
    color: #0a2540;
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.score-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1.6rem;
    background: #f8fafc;
    padding: 0.6rem 1rem;
    border-radius: 1rem;
}
.score-item {
    font-size: 0.9rem;
    color: #1a2d3c;
}
.score-item .num {
    font-weight: 700;
    font-size: 1.1rem;
    color: #0a2540;
}
.tag-sm {
    padding: 0.05rem 0.6rem;
    border-radius: 40px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-left: 0.3rem;
}
.answers-grid {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    background: #f8fafc;
    padding: 0.6rem 1rem;
    border-radius: 1rem;
    max-height: 280px;
    overflow-y: auto;
}
.ans-item {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.03);
    font-size: 0.85rem;
}
.ans-item .q {
    color: #1a2d3c;
    flex: 1;
    padding-right: 1rem;
}
.ans-item .a {
    font-weight: 500;
    color: #2b6c94;
    white-space: nowrap;
}

/* ===== 分享弹窗 ===== */
.share-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,37,64,0.35);
    backdrop-filter: blur(6px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.share-modal.active {
    display: flex;
}
.share-modal .modal-box {
    max-width: 440px;
}
.share-link-input {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #f0f4f9;
    border-radius: 60px;
    padding: 0.2rem 0.2rem 0.2rem 1.2rem;
    border: 1px solid #e2eaf0;
    margin-bottom: 1.2rem;
}
.share-link-input input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.6rem 0;
    font-size: 0.85rem;
    color: #1a2d3c;
    outline: none;
    font-family: inherit;
}
.share-link-input .copy-btn {
    background: #2b6c94;
    border: none;
    border-radius: 60px;
    padding: 0.45rem 1.2rem;
    color: #fff;
    font-weight: 500;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    white-space: nowrap;
}
.share-link-input .copy-btn:hover {
    background: #1f5777;
}
.share-platforms {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}
.platform-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    border-radius: 16px;
    transition: background 0.2s;
    color: #1f5777;
    font-size: 0.75rem;
    font-weight: 450;
    font-family: inherit;
}
.platform-btn i {
    font-size: 1.6rem;
    color: #4a6a80;
    transition: color 0.2s, transform 0.2s;
}
.platform-btn:hover {
    background: rgba(0,0,0,0.02);
}
.platform-btn:hover i {
    color: #2b6c94;
    transform: scale(1.08);
}

/* ===== Toast ===== */
.toast-tip {
    position: fixed;
    bottom: 2.4rem;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: rgba(10,37,64,0.92);
    backdrop-filter: blur(10px);
    color: #f0f7ff;
    padding: 0.8rem 1.8rem;
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 450;
    box-shadow: 0 12px 32px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.06);
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    max-width: 92%;
    min-width: 200px;
    text-align: left;
    line-height: 1.7;
}
.toast-tip.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .platform-wrapper { padding: 1.2rem; }
    .title-group h1 { font-size: 1.2rem; }
    .detail-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-group input, .filter-group select { min-width: auto; width: 100%; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .modal-box { padding: 1.2rem; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .data-table { font-size: 0.75rem; }
    .data-table th, .data-table td { padding: 0.4rem 0.3rem; }
}
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #eef3f8;
}
::-webkit-scrollbar-thumb {
    background: #b8ccdb;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #9bb3c7;
}

/* ============================================================ */
/* ★★★ 打印样式（修复单页截断，改为自动分页 2-3页） ★★★ */
/* ============================================================ */
@media print {
    /* 1. 隐藏页面上除弹窗之外的所有内容 */
    body * {
        display: none !important;
    }

    /* 2. 显示弹窗及其所有子元素 */
    .detail-modal,
    .detail-modal * {
        display: block !important;
    }

    /* 3. 弹窗容器：解除固定定位，改为自然流，让内容自动分页 */
    .detail-modal {
        display: block !important;
        position: static !important;
        background: #ffffff !important;
        backdrop-filter: none !important;
        padding: 1.5rem 2rem !important;
        width: 100% !important;
        height: auto !important;
        min-height: 100vh !important;
        overflow: visible !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        z-index: auto !important;
    }

    /* 4. 弹窗内容盒：解除所有高度限制 */
    .detail-modal .modal-box {
        display: block !important;
        max-width: 100% !important;
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        background: #ffffff !important;
    }

    /* 5. 隐藏标题栏里的关闭按钮和PDF按钮 */
    .detail-modal .modal-title .close-modal,
    .detail-modal .modal-title #downloadPdfBtn {
        display: none !important;
    }

    /* 6. 答案列表解除高度限制，全部展开 */
    .detail-modal .answers-grid {
        max-height: none !important;
        overflow: visible !important;
        background: #fafcfe !important;
        padding: 0.5rem 0 !important;
    }

    /* 7. 每个答题项保持在一页内，避免断裂 */
    .detail-modal .ans-item {
        display: flex !important;
        justify-content: space-between !important;
        padding: 0.3rem 0 !important;
        border-bottom: 1px solid #eef2f6 !important;
        font-size: 0.8rem !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* 8. 基本信息项也保持不跨页 */
    .detail-modal .detail-item,
    .detail-modal .score-item {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* 9. 确保所有内部区域正常显示 */
    .detail-modal .detail-grid,
    .detail-modal .detail-section,
    .detail-modal .score-row,
    .detail-modal .modal-sub {
        display: block !important;
        background: #ffffff !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* 10. 额外强制隐藏可能会冒出来的浮动按钮 */
    .back-home-fixed,
    .share-fixed,
    #shareFixedBtn,
    #clearAllBtn,
    #refreshBtn,
    #exportCsvBtn,
    .filter-bar,
    .stats-grid,
    .table-wrapper,
    .table-footer,
    .platform-wrapper,
    .platform-header {
        display: none !important;
    }
}