/* === 批次比對頁樣式 === */

.compare-form {
    margin-bottom: 1.5rem;
}

.form-row {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.form-col {
    flex: 1;
}

.batch-input {
    font-size: 1.3rem;
    padding: 0.8rem 1rem;
    letter-spacing: 3px;
    font-family: 'Noto Serif TC', 'Microsoft YaHei', serif;
}

.char-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.form-actions {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

/* --- 進度條 --- */
.batch-progress {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

#progressText {
    font-size: 0.85rem;
    color: var(--text-light);
    white-space: nowrap;
}

/* --- 批次結果容器 --- */
.batch-results {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.batch-result-item {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
}

.batch-result-item .result-char-label {
    background: var(--primary-dark);
    color: #fff;
    padding: 0.4rem 0.8rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.batch-result-item img {
    width: 100%;
    display: block;
}

.batch-result-item .result-error {
    padding: 1rem;
    color: var(--accent);
    font-size: 0.85rem;
}

/* --- 排序選項 --- */
.sort-options {
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    transition: border-color 0.15s, background 0.15s;
}

.radio-item:has(input:checked) {
    border-color: var(--primary);
    background: var(--bg-warm);
}

.radio-item input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.radio-item span {
    font-weight: 500;
}

.radio-item small {
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* --- 分組標題 --- */
.batch-group {
    margin-bottom: 1.2rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.batch-group-header {
    background: var(--primary);
    color: #fff;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.batch-group-header .group-title-char {
    font-size: 1.5rem;
    font-family: 'Noto Serif TC', 'Microsoft YaHei', serif;
}

.batch-group-header .group-title-cal {
    font-size: 1rem;
}

.batch-group-header .count-badge {
    background: rgba(255,255,255,0.25);
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.75rem;
}

/* --- 分組內容（橫排顯示） --- */
.batch-group-content {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.8rem;
    background: var(--bg-light);
}

.batch-group-content.batch-row {
    flex-direction: row;
    align-items: flex-start;
}

/* --- 簡化的圖片卡片（小尺寸） --- */
.char-image-card-simple {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90px;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.char-image-card-simple .card-jizi-link {
    display: none;
    position: absolute;
    left: 0; right: 0; bottom: 0;
    background: rgba(139, 90, 43, 0.92);
    color: #fff;
    font-size: 0.62rem;
    text-align: center;
    padding: 0.2rem 0.15rem;
    text-decoration: none;
    white-space: normal;
    line-height: 1.3;
}
.char-image-card-simple .card-jizi-link:hover { background: var(--accent); }
.char-image-card-simple:hover .card-jizi-link { display: block; }

.char-image-card-simple:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1;
}

.char-image-card-simple img {
    width: 90px;
    height: 90px;
    object-fit: contain;
    display: block;
    cursor: pointer;
    background: #fff;
}

.char-image-card-simple .card-label {
    width: 100%;
    padding: 0.25rem 0.3rem;
    font-size: 0.75rem;
    color: var(--text);
    text-align: center;
    background: var(--bg);
    border-top: 1px solid var(--border-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.char-image-card-simple .card-error-char {
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-muted);
    background: var(--bg-dark);
    font-family: 'Noto Serif TC', 'Microsoft YaHei', serif;
}

/* --- 錯誤分組 --- */
.batch-group-error {
    border-color: var(--accent);
}

/* --- 最近查詢 --- */
.history-section {
    margin-bottom: 1.5rem;
}

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

.char-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.char-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    font-size: 1.1rem;
    font-family: 'Noto Serif TC', 'Microsoft YaHei', serif;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--primary-dark);
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.char-pill:hover {
    background: var(--primary-light, #FFF3E0);
    border-color: var(--primary);
    transform: scale(1.08);
}

.btn-text-sm {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: color 0.15s;
}

.btn-text-sm:hover { color: var(--accent); }

/* --- 錯誤訊息卡片（僅顯示 .result-error，無圖片） --- */
.char-image-card {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
}

.char-image-card .result-error {
    padding: 0.8rem;
    color: var(--accent);
    font-size: 0.8rem;
    text-align: center;
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }

    .char-image-card-simple {
        width: 70px;
    }

    .char-image-card-simple img {
        width: 70px;
        height: 70px;
    }

    .char-image-card-simple .card-error-char {
        width: 70px;
        height: 70px;
        font-size: 1.5rem;
    }

    .radio-item {
        flex-wrap: wrap;
    }

    .radio-item small {
        width: 100%;
        padding-left: 28px;
    }
}

@media (max-width: 480px) {
    .batch-group-header .group-title-char {
        font-size: 1.2rem;
    }

    .char-image-card-simple {
        width: 58px;
    }

    .char-image-card-simple img {
        width: 58px;
        height: 58px;
    }

    .char-image-card-simple .card-error-char {
        width: 58px;
        height: 58px;
        font-size: 1.2rem;
    }

    .batch-group-content {
        padding: 0.5rem;
        gap: 0.4rem;
    }
}
