/* ============================================
   EPUB to PDF Converter
   Light mode default + dark mode. Red accent (PDF). Prefix: e2p-
   ============================================ */
:root {
    --e2p-primary: #e64e4e;
    --e2p-primary-dark: #c93c3c;
    --e2p-primary-light: #fdecec;
    --e2p-danger: #c93c3c;
    --e2p-danger-light: #fdecec;
    --e2p-warn: #b7791f;
    --e2p-warn-light: #fdf5e6;
    --e2p-bg: #ffffff;
    --e2p-bg-soft: #fbf6f6;
    --e2p-bg-mute: #f5eaea;
    --e2p-text: #2b1d1d;
    --e2p-text-2: #4f3d3d;
    --e2p-muted: #7a6b6b;
    --e2p-border: #ecd8d8;
    --e2p-shadow: 0 2px 10px rgba(60, 20, 20, 0.07);
    --e2p-radius: 12px;
}
[data-theme="dark"] {
    --e2p-primary: #f07070;
    --e2p-primary-dark: #e05a5a;
    --e2p-primary-light: rgba(240, 112, 112, 0.14);
    --e2p-danger: #f87171;
    --e2p-danger-light: rgba(248, 113, 113, 0.14);
    --e2p-warn: #f6c35b;
    --e2p-warn-light: rgba(246, 195, 91, 0.12);
    --e2p-bg: #201616;
    --e2p-bg-soft: #281b1b;
    --e2p-bg-mute: #322222;
    --e2p-text: #f0e4e4;
    --e2p-text-2: #d3c2c2;
    --e2p-muted: #a59393;
    --e2p-border: #3f2c2c;
    --e2p-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.e2p-wrap { color: var(--e2p-text); }
.e2p-wrap .tool-title { color: var(--e2p-primary); }
.e2p-wrap .tool-title svg { color: var(--e2p-primary); }
.e2p-wrap .tool-description { max-width: 800px; margin-left: auto; margin-right: auto; }
.e2p-wrap a { color: var(--e2p-primary); }
.e2p-wrap [hidden], .e2p-overlay[hidden] { display: none !important; }
.e2p-wrap svg.lucide { width: 18px; height: 18px; vertical-align: -3px; flex-shrink: 0; }

/* Dropzone */
.e2p-dropzone {
    border: 2px dashed var(--e2p-border); background: var(--e2p-bg-soft); border-radius: 16px;
    padding: 40px 20px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s;
    max-width: 900px; margin: 0 auto;
}
.e2p-dropzone:hover, .e2p-dropzone:focus-visible, .e2p-dropzone.is-over { border-color: var(--e2p-primary); background: var(--e2p-primary-light); outline: none; }
.e2p-wrap svg.e2p-dropzone-icon { width: 48px; height: 48px; color: var(--e2p-primary); }
.e2p-dropzone-title { margin: 10px 0 4px; font-size: 1.2rem; color: var(--e2p-text); }
.e2p-dropzone-sub { margin: 0; color: var(--e2p-muted); font-size: .92rem; }

.e2p-samples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin: 12px auto 0; font-size: .9rem; color: var(--e2p-muted); }
.e2p-samples button {
    display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--e2p-border); background: var(--e2p-bg);
    color: var(--e2p-text-2); border-radius: 999px; padding: 5px 12px; cursor: pointer; font: inherit;
}
.e2p-samples button:hover { border-color: var(--e2p-primary); color: var(--e2p-primary); }
.e2p-wrap .e2p-samples svg.lucide { width: 15px; height: 15px; }

/* Messages */
.e2p-error {
    display: flex; gap: 10px; max-width: 900px; margin: 16px auto 0; padding: 12px 16px; border-radius: var(--e2p-radius);
    background: var(--e2p-danger-light); color: var(--e2p-danger); border: 1px solid var(--e2p-danger); line-height: 1.5;
}
.e2p-error a { color: inherit; font-weight: 600; }
.e2p-pass {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center; max-width: 900px; margin: 16px auto 0; padding: 12px 16px;
    border: 1px solid var(--e2p-border); border-radius: var(--e2p-radius); background: var(--e2p-bg-soft);
}
.e2p-pass label { font-weight: 600; }
.e2p-pass input { flex: 1; min-width: 160px; }
.e2p-warn { display: flex; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--e2p-warn-light); color: var(--e2p-warn); line-height: 1.5; margin: 10px 0; }
.e2p-warn a { color: inherit; font-weight: 600; }
.e2p-muted { color: var(--e2p-muted); font-size: .9rem; margin: 8px 0; }

/* Inputs & buttons */
.e2p-input, .e2p-pass input {
    width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid var(--e2p-border); border-radius: 8px;
    background: var(--e2p-bg); color: var(--e2p-text); font: inherit;
}
.e2p-input:focus, .e2p-pass input:focus { outline: 2px solid var(--e2p-primary-light); border-color: var(--e2p-primary); }
.e2p-btn {
    display: inline-flex; gap: 8px; align-items: center; justify-content: center; padding: 10px 18px; border-radius: 10px;
    border: 1px solid var(--e2p-primary); background: var(--e2p-bg); color: var(--e2p-primary); font: inherit; font-weight: 600; cursor: pointer;
}
.e2p-btn-primary { width: 100%; background: var(--e2p-primary); color: #fff; padding: 13px 18px; font-size: 1.02rem; margin-top: 6px; }
.e2p-btn-primary:hover { background: var(--e2p-primary-dark); }
.e2p-btn:disabled { opacity: .6; cursor: default; }
.e2p-link-btn { display: inline-flex; gap: 5px; align-items: center; border: 0; background: none; color: var(--e2p-primary); font: inherit; font-weight: 600; cursor: pointer; }

/* Work area */
.e2p-work { max-width: 1100px; margin: 22px auto 0; }
.e2p-work h2, .e2p-card h2 { display: flex; gap: 8px; align-items: center; font-size: 1.1rem; margin: 0 0 12px; color: var(--e2p-primary); }
.e2p-files-head { display: flex; justify-content: space-between; align-items: center; }
.e2p-files-head h2 { margin: 0; }
.e2p-file-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 18px; }
.e2p-file {
    display: flex; gap: 10px; align-items: center; padding: 9px 12px; border: 1px solid var(--e2p-border); border-radius: 10px;
    background: var(--e2p-bg); cursor: pointer;
}
.e2p-file.is-active { border-color: var(--e2p-primary); background: var(--e2p-primary-light); }
.e2p-file > svg.lucide { color: var(--e2p-primary); }
.e2p-file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.e2p-file-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.e2p-file-info span { font-size: .84rem; color: var(--e2p-muted); }
.e2p-file-ok { color: var(--e2p-primary); }
.e2p-file-x { border: 0; background: none; color: var(--e2p-muted); cursor: pointer; padding: 4px; border-radius: 6px; display: inline-flex; }
.e2p-file-x:hover { color: var(--e2p-danger); background: var(--e2p-danger-light); }

.e2p-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.e2p-settings, .e2p-preview-card, .e2p-card {
    background: var(--e2p-bg); border: 1px solid var(--e2p-border); border-radius: var(--e2p-radius); padding: 18px; box-shadow: var(--e2p-shadow);
}
.e2p-group { margin-bottom: 14px; }
.e2p-group-label { display: block; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--e2p-muted); margin-bottom: 6px; }
.e2p-hint { font-size: .82rem; color: var(--e2p-muted); margin: 6px 0 0; line-height: 1.4; }
.e2p-seg { display: flex; border: 1px solid var(--e2p-border); border-radius: 9px; overflow: hidden; }
.e2p-seg label { flex: 1; margin: 0; cursor: pointer; }
.e2p-seg input { position: absolute; opacity: 0; pointer-events: none; }
.e2p-seg span { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 8px 6px; font-size: .9rem; color: var(--e2p-text-2); background: var(--e2p-bg); text-align: center; }
.e2p-seg label + label span { border-left: 1px solid var(--e2p-border); }
.e2p-seg input:checked + span { background: var(--e2p-primary); color: #fff; font-weight: 600; }
.e2p-seg input:focus-visible + span { outline: 2px solid var(--e2p-primary); outline-offset: -3px; }
.e2p-wrap .e2p-seg svg.lucide { width: 15px; height: 15px; }
.e2p-check { display: flex; gap: 9px; align-items: flex-start; margin: 0 0 10px; cursor: pointer; }
.e2p-check input { margin-top: 3px; accent-color: var(--e2p-primary); }
.e2p-check span { display: flex; flex-direction: column; font-weight: 600; font-size: .93rem; }
.e2p-check small { font-weight: 400; color: var(--e2p-muted); font-size: .82rem; }

/* Result */
.e2p-result { margin-top: 18px; }
.e2p-done { border: 1px solid var(--e2p-primary); background: var(--e2p-primary-light); border-radius: var(--e2p-radius); padding: 16px 18px; }
.e2p-done h3 { display: flex; gap: 8px; align-items: center; margin: 0 0 6px; color: var(--e2p-primary); font-size: 1.05rem; }
.e2p-done p { margin: 6px 0; }
.e2p-dls { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.e2p-dl { display: inline-flex; gap: 8px; align-items: center; padding: 9px 14px; border-radius: 10px; background: var(--e2p-primary); color: #fff !important; text-decoration: none; font-weight: 600; }
.e2p-dl:hover { background: var(--e2p-primary-dark); }
.e2p-dl span { font-weight: 400; opacity: .85; font-size: .85rem; }

/* Info */
.e2p-info { max-width: 1000px; margin: 30px auto 0; display: flex; flex-direction: column; gap: 18px; }
.e2p-card p { line-height: 1.65; color: var(--e2p-text-2); }
.e2p-steps { margin: 0; padding-left: 22px; line-height: 1.7; color: var(--e2p-text-2); }
.e2p-steps b { color: var(--e2p-text); }
.e2p-features { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.e2p-features > div { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 10px; background: var(--e2p-bg-soft); }
.e2p-features > div > svg.lucide { color: var(--e2p-primary); width: 22px; height: 22px; margin-top: 2px; }
.e2p-features h3 { margin: 0 0 2px; font-size: .95rem; color: var(--e2p-text); }
.e2p-features p { margin: 0; font-size: .85rem; line-height: 1.45; }

/* Overlay */
.e2p-overlay { position: fixed; inset: 0; background: rgba(20, 10, 10, .55); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.e2p-overlay-card { background: var(--e2p-bg); color: var(--e2p-text); border-radius: 16px; padding: 26px 30px; width: min(360px, 90vw); text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.e2p-spinner { width: 42px; height: 42px; margin: 0 auto 12px; border: 4px solid var(--e2p-bg-mute); border-top-color: var(--e2p-primary); border-radius: 50%; animation: e2pspin .8s linear infinite; }
@keyframes e2pspin { to { transform: rotate(360deg); } }
.e2p-progress { height: 8px; background: var(--e2p-bg-mute); border-radius: 99px; overflow: hidden; margin: 12px 0 6px; }
.e2p-progress span { display: block; height: 100%; width: 0; background: var(--e2p-primary); transition: width .2s; }
.e2p-pct { font-size: .85rem; color: var(--e2p-muted); }

@media (max-width: 820px) {
    .e2p-grid { grid-template-columns: 1fr; }
    .e2p-page-card { position: static; }
    .e2p-dropzone { padding: 28px 14px; }
}

/* Book cards */
.e2p-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 18px; }
.e2p-book { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--e2p-border); border-radius: 10px; background: var(--e2p-bg); }
.e2p-cover { width: 44px; height: 62px; object-fit: cover; border-radius: 4px; flex-shrink: 0; box-shadow: 0 1px 4px rgba(0,0,0,.18); background: var(--e2p-bg-mute); }
.e2p-cover-none { display: flex; align-items: center; justify-content: center; color: var(--e2p-muted); box-shadow: none; }
.e2p-book-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.e2p-book-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e2p-book-info > span { font-size: .84rem; color: var(--e2p-muted); }
.e2p-tag { display: inline-flex; gap: 5px; align-items: center; align-self: flex-start; font-size: .8rem; padding: 2px 8px; border-radius: 99px; margin-top: 3px; }
.e2p-wrap .e2p-tag svg.lucide { width: 13px; height: 13px; }
.e2p-tag-bad { background: var(--e2p-danger-light); color: var(--e2p-danger); }
.e2p-tag-ok { background: rgba(51,153,102,.13); color: #2b8159; }
[data-theme="dark"] .e2p-tag-ok { color: #4cc38a; }
.e2p-x { border: 0; background: none; color: var(--e2p-muted); cursor: pointer; padding: 4px; border-radius: 6px; display: inline-flex; }
.e2p-x:hover { color: var(--e2p-danger); background: var(--e2p-danger-light); }

/* Settings layout */
.e2p-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }
.e2p-meta { border-top: 1px solid var(--e2p-border); margin-top: 6px; padding-top: 14px; }
.e2p-meta h3 { display: flex; gap: 8px; align-items: center; font-size: .98rem; margin: 0 0 10px; color: var(--e2p-text); }
.e2p-file-btn { display: flex; gap: 10px; align-items: center; }
.e2p-file-btn label { display: inline-flex; gap: 6px; align-items: center; padding: 8px 12px; border: 1px solid var(--e2p-border); border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--e2p-text-2); background: var(--e2p-bg); }
.e2p-file-btn label:hover { border-color: var(--e2p-primary); color: var(--e2p-primary); }
.e2p-file-btn span { font-size: .84rem; color: var(--e2p-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Page preview */
.e2p-page-card { position: sticky; top: 16px; text-align: center; }
.e2p-page-stage { display: flex; align-items: center; justify-content: center; min-height: 240px; padding: 10px; background: var(--e2p-bg-mute); border-radius: 10px; }
.e2p-page { position: relative; box-sizing: border-box; background: #fff; color: #222; box-shadow: 0 4px 16px rgba(0,0,0,.18); overflow: hidden; transition: width .2s, height .2s, padding .2s; }
.e2p-page-text { line-height: 1.45; overflow: hidden; height: 100%; text-align: left; }
.e2p-page-text b { display: block; font-size: 1.5em; margin-bottom: .4em; }
.e2p-page-text p { margin: 0 0 .5em; }
.e2p-page-num { position: absolute; bottom: 3px; left: 0; right: 0; font-size: 7px; color: #888; }
.e2p-page-label { font-size: .84rem; color: var(--e2p-muted); margin: 8px 0 0; }

/* Result notes */
.e2p-btn span { font-weight: 400; opacity: .85; font-size: .85rem; }
.e2p-dls .e2p-btn-primary { width: auto; margin: 0; }
.e2p-note { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; color: var(--e2p-text-2); }
.e2p-note-bad { color: var(--e2p-danger); }

@media (max-width: 820px) {
    .e2p-page-card { position: static; }
    .e2p-book { align-items: flex-start; }
}

/* running header / footer in the page preview (2026-10-12) */
.e2p-page-head { position: absolute; top: 3px; left: 8px; right: 8px; font-size: 6px; color: #888; text-align: center; font-family: Arial, sans-serif; }
.e2p-page-num { left: 8px; right: 8px; font-family: Arial, sans-serif; font-size: 6px; }
.e2p-page-head.is-two, .e2p-page-num.is-two { display: flex; justify-content: space-between; }
.e2p-page-head[hidden], .e2p-page-num[hidden] { display: none; }
