/* Merge Odd & Even PDF Pages — page-specific styles.
   Upload zone (.uz*) and thumbnail grid (.thumbnail-grid, .page-thumbnail,
   .page-number, .page-thumb-skeleton) come from base.css untouched. */

/* ── Dual upload layout ──────────────────────────────────────────────── */
.moe-dual-upload {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 720px) {
    .moe-dual-upload { grid-template-columns: 1fr; }
}

.moe-slot-label {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #94a3b8;
    margin: 0 0 .625rem;
    text-align: center;
}

/* Compact "file selected" card shown in place of the .uz zone once a slot is filled */
.moe-file-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.375rem;
    background: #fff;
    border: 1.5px solid var(--border, #e8ecf0);
    border-radius: 1.75rem;
    min-height: 8.5rem;
}

.moe-file-ic {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: .75rem;
    background: linear-gradient(135deg, #14b8a6, #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.moe-file-meta { min-width: 0; flex: 1; text-align: left; }
.moe-file-name { font-size: .9375rem; font-weight: 700; color: #0f172a; margin: 0 0 .2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.moe-file-sub { font-size: .8125rem; color: #64748b; margin: 0; }

.moe-file-remove {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    border: 1.5px solid var(--border, #e8ecf0);
    background: #fff;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s;
}

.moe-file-remove:hover { border-color: #fca5a5; color: #dc2626; background: #fef2f2; }

/* ── Info panel ───────────────────────────────────────────────────────── */
.moe-info-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

@media (max-width: 640px) { .moe-info-panel { grid-template-columns: 1fr; } }

.moe-info-group {
    background: #fafafe;
    border: 1px solid var(--border, #e8ecf0);
    border-radius: 1rem;
    padding: 1.125rem 1.25rem;
}

.moe-info-heading { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #6366f1; margin: 0 0 .625rem; }

.moe-info-row { display: flex; justify-content: space-between; gap: .75rem; padding: .3rem 0; border-bottom: 1px solid #eef1f5; font-size: .8125rem; }
.moe-info-row:last-child { border-bottom: none; }
.moe-info-label { color: #94a3b8; font-weight: 600; }
.moe-info-value { color: #0f172a; font-weight: 600; text-align: right; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Reverse/forward pill toggle ─────────────────────────────────────── */
.moe-toggle-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: #fafafe;
    border: 1px solid var(--border, #e8ecf0);
    border-radius: 1rem;
    padding: 1.125rem 1.25rem;
    margin-bottom: 1.25rem;
}

.moe-toggle {
    position: relative;
    flex-shrink: 0;
    width: 3rem;
    height: 1.75rem;
    border-radius: 9999px;
    background: #e2e8f0;
    border: none;
    cursor: pointer;
    transition: background .25s;
    padding: 0;
}

.moe-toggle::after {
    content: '';
    position: absolute;
    top: .1875rem;
    left: .1875rem;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .25s;
}

.moe-toggle.on { background: linear-gradient(135deg, #6366f1, #7c3aed); }
.moe-toggle.on::after { transform: translateX(1.25rem); }
.moe-toggle:focus-visible { outline: 2px solid var(--indigo, #6366f1); outline-offset: 2px; }

.moe-toggle-text { flex: 1; }
.moe-toggle-title { font-size: .875rem; font-weight: 700; color: #0f172a; margin: 0 0 .25rem; }
.moe-toggle-desc { font-size: .78rem; color: #64748b; margin: 0; line-height: 1.6; }

/* ── Mismatch warning ─────────────────────────────────────────────────── */
.moe-warning {
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    background: #fffbeb;
    border: 1.5px solid #fde68a;
    color: #92400e;
    border-radius: .875rem;
    padding: .875rem 1.125rem;
    font-size: .8125rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

/* ── Preview headings ─────────────────────────────────────────────────── */
.moe-preview-block { margin-bottom: 1.5rem; }
.moe-preview-heading { font-size: .875rem; font-weight: 700; color: #0f172a; margin: 0 0 .75rem; display: flex; align-items: center; gap: .5rem; }
.moe-preview-heading .moe-dot { width: .5rem; height: .5rem; border-radius: 50%; background: #94a3b8; flex-shrink: 0; }
.moe-preview-heading.result .moe-dot { background: var(--indigo, #6366f1); }
.moe-result-count { font-size: .75rem; font-weight: 600; color: #6366f1; margin: -.5rem 0 .75rem; }

/* ── Processing dashboard ────────────────────────────────────────────── */
.moe-dashboard {
    max-width: 26rem;
    margin: 1.25rem auto 0;
    background: #fafafe;
    border: 1px solid var(--border, #e8ecf0);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .875rem 1.25rem;
}

.moe-dash-stat { text-align: left; }
.moe-dash-stat-label { display: block; font-size: .625rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; margin-bottom: .2rem; }
.moe-dash-stat-value { display: block; font-size: .9375rem; font-weight: 700; color: #0f172a; }

/* ── Toasts ───────────────────────────────────────────────────────────── */
#toastHost { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; }

.moe-toast {
    background: #0f172a;
    color: #fff;
    font-size: .8125rem;
    font-weight: 600;
    padding: .75rem 1.25rem;
    border-radius: .75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
    opacity: 0;
    transform: translateY(.5rem);
    transition: opacity .25s, transform .25s;
}

.moe-toast.show { opacity: 1; transform: translateY(0); }
.moe-toast-error { background: #dc2626; }

@media (max-width: 640px) {
    .moe-dashboard { grid-template-columns: 1fr 1fr; }
}

/* ── Workflow/algorithm diagram chips (educational content, Part 2B) ───── */
.moe-diag {
    background: #fafafe;
    border: 1px solid var(--border, #e8ecf0);
    border-radius: 1.25rem;
    padding: 1.5rem 1.25rem;
    margin: 1.5rem 0;
}

.moe-diag-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: .625rem;
}

.moe-diag-label {
    flex-shrink: 0;
    width: 5.5rem;
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #94a3b8;
    text-align: right;
}

.moe-diag-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 .5rem;
    border-radius: .625rem;
    background: #eef2ff;
    color: #4338ca;
    font-weight: 700;
    font-size: .8125rem;
}

.moe-diag-chip.odd { background: #eff6ff; color: #2563eb; }
.moe-diag-chip.even { background: #f0fdfa; color: #0d9488; }
.moe-diag-chip.merged { background: linear-gradient(135deg, #6366f1, #7c3aed); color: #fff; }
.moe-diag-chip.ghost { background: #f1f5f9; color: #cbd5e1; }

.moe-diag-plus {
    font-weight: 800;
    font-size: 1.125rem;
    color: #cbd5e1;
    margin: 0 .25rem;
}

.moe-diag-arrow-row {
    text-align: center;
    margin: .5rem 0;
    color: #94a3b8;
}

.moe-diag-caption {
    text-align: center;
    font-size: .78rem;
    color: #64748b;
    margin-top: .875rem;
}

/* ── Key Facts boxes (AI-citation blocks, Part 2B-2) ────────────────────── */
.moe-keyfacts {
    background: #fff;
    border: 1px solid var(--border, #e8ecf0);
    border-left: 3px solid var(--indigo, #6366f1);
    border-radius: .875rem;
    padding: 1.125rem 1.375rem;
    margin-top: 1.5rem;
}

.moe-keyfacts-label {
    font-size: .6875rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #6366f1;
    margin: 0 0 .625rem;
}

.moe-keyfacts ul {
    margin: 0;
    padding-left: 1.1rem;
}

.moe-keyfacts li {
    font-size: .82rem;
    color: #475569;
    line-height: 1.75;
}

/* ── Decision tree ────────────────────────────────────────────────────── */
.moe-tree { display: flex; flex-direction: column; align-items: center; gap: 0; }
.moe-tree-node {
    background: #fff;
    border: 1.5px solid var(--border, #e8ecf0);
    border-radius: .875rem;
    padding: .75rem 1.25rem;
    font-size: .84rem;
    font-weight: 700;
    color: #0f172a;
    text-align: center;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
}
.moe-tree-node.q { border-color: #c7d2fe; background: #eef2ff; color: #4338ca; }
.moe-tree-node.action { background: linear-gradient(135deg, #6366f1, #7c3aed); border-color: transparent; color: #fff; }
.moe-tree-line { width: 2px; height: 1.25rem; background: #cbd5e1; }
.moe-tree-branches { display: flex; gap: 2.5rem; margin-top: 0; }
.moe-tree-branch { display: flex; flex-direction: column; align-items: center; }
.moe-tree-branch-label { font-size: .6875rem; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .04em; margin: .375rem 0; }

/* ── Troubleshooting cards ───────────────────────────────────────────── */
.moe-trouble-card {
    background: #fff;
    border: 1px solid var(--border, #e8ecf0);
    border-radius: 1rem;
    padding: 1.125rem 1.25rem;
}
.moe-trouble-row { display: flex; gap: .625rem; margin-bottom: .5rem; }
.moe-trouble-row:last-child { margin-bottom: 0; }
.moe-trouble-tag {
    flex-shrink: 0;
    width: 4.75rem;
    font-size: .625rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding-top: .1rem;
}
.moe-trouble-tag.problem { color: #dc2626; }
.moe-trouble-tag.cause { color: #d97706; }
.moe-trouble-tag.solution { color: #16a34a; }
.moe-trouble-text { font-size: .82rem; color: #475569; line-height: 1.6; }

/* ── Glossary ─────────────────────────────────────────────────────────── */
.moe-glossary { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 2rem; }
@media (max-width: 720px) { .moe-glossary { grid-template-columns: 1fr; } }
.moe-glossary dt { font-size: .875rem; font-weight: 700; color: #0f172a; margin-top: .25rem; }
.moe-glossary dd { font-size: .8125rem; color: #64748b; line-height: 1.6; margin: .25rem 0 0; }

/* ── Quick reference cards ───────────────────────────────────────────── */
.moe-qref-card {
    background: #fafafe;
    border: 1px solid var(--border, #e8ecf0);
    border-radius: 1rem;
    padding: 1.125rem 1.25rem;
}
.moe-qref-title { font-size: .8125rem; font-weight: 700; color: #0f172a; margin: 0 0 .5rem; display: flex; align-items: center; gap: .4rem; }
.moe-qref-card ul { margin: 0; padding-left: 1.1rem; }
.moe-qref-card li { font-size: .78rem; color: #64748b; line-height: 1.65; }
