/* 小学数学题生成器 - 仅保留工具专属样式，通用样式复用 common.css */

/* 复选框分组（common.css 未提供，工具内自留） */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #8b5cf6;
}

.checkbox-text {
    user-select: none;
}

/* 设置卡片内下拉框占满整行 */
.settings-card .form-select {
    width: 100%;
}

/* 左侧操作按钮整行堆叠，避免窄栏换行错位 */
.settings-card .action-buttons {
    flex-direction: column;
}

.settings-card .action-buttons .btn {
    width: 100%;
}

/* 头部数量提示 */
.header-count {
    font-size: 13px;
    color: #9ca3af;
}

/* 题目卷头信息栏 */
.page-info-bar {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    padding: 10px 0;
    border-bottom: 1px dashed #e5e7eb;
}

.page-info-item {
    font-size: 13px;
    color: #6b21a8;
    font-weight: 500;
}

/* 题目网格 */
.preview-area {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.questions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px 22px;
}

.question-item {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #374151;
    padding: 8px 0;
}

.question-index {
    color: #9ca3af;
    margin-right: 4px;
    min-width: 28px;
    flex-shrink: 0;
}

/* 表达式左对齐，等号紧跟表达式末尾 */
.question-text {
    min-width: 0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 填空 □ 与比较 ○ 用边框绘制，与文字等高、不撑行高 */
.q-blank,
.q-circle {
    display: inline-block;
    width: 1.05em;
    height: 1.05em;
    border: 0.09em solid currentColor;
    vertical-align: -0.12em;
    margin: 0 0.1em;
}

.q-circle {
    border-radius: 50%;
}

.question-eq {
    flex-shrink: 0;
    margin-left: 4px;
}

.question-answer {
    flex-shrink: 0;
    min-width: 36px;
    margin-left: 4px;
    color: #8b5cf6;
    font-weight: 500;
}

/* 打印容器（屏幕隐藏，打印时显示） */
.print-container {
    display: none;
}

/* 响应式：窄屏下左侧设置与右侧预览上下排列 */
@media (max-width: 768px) {
    .section-row-1-3 {
        grid-template-columns: 1fr;
    }

    .questions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============ 打印样式 ============ */
@media print {
    @page {
        size: A4;
        margin: 6mm;
    }

    body {
        background: #fff !important;
        margin: 0;
        padding: 0;
    }

    body * {
        visibility: hidden;
    }

    .print-container,
    .print-container * {
        visibility: visible;
    }

    .section-row-1-3,
    .info-section {
        display: none !important;
    }

    .print-container {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 3mm;
        background: #fff;
    }

    .print-title {
        text-align: center;
        font-size: 18pt;
        font-weight: bold;
        margin-bottom: 8mm;
        color: #000;
    }

    .print-info-bar {
        display: flex;
        justify-content: space-around;
        margin-bottom: 4mm;
        font-size: 10pt;
        color: #000;
    }

    .info-item {
        display: inline;
    }

    .print-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 4.5mm 6mm;
    }

    .print-item {
        font-size: 12pt;
        display: flex;
        align-items: center;
        color: #000;
        line-height: 1.4;
        margin: 0;
        padding: 0;
    }

    .print-index {
        color: #666;
        margin-right: 2mm;
        min-width: 8mm;
        flex-shrink: 0;
    }

    .print-text {
        min-width: 0;
        text-align: left;
        white-space: nowrap;
    }

    .print-eq {
        flex-shrink: 0;
        margin-left: 1.5mm;
    }

    .print-answer {
        flex-shrink: 0;
        min-width: 10mm;
        margin-left: 1mm;
        color: #000;
        font-weight: bold;
    }
}

/* ============ 深色模式 ============ */
body.dark .checkbox-item,
body.dark .checkbox-text {
    color: #cbd5e1;
}

body.dark .header-count {
    color: #9aa0a6;
}

body.dark .page-info-bar {
    border-bottom-color: #495057;
}

body.dark .page-info-item {
    color: #c4b5fd;
}

body.dark .question-item {
    color: #e0e0e0;
}

body.dark .question-index {
    color: #9aa0a6;
}
