/* App-wide reading widget: injected Save/Read/Word buttons, the parchment reader, and the font/paper modal. */

/* Themed confirmation dialog (replaces the browser's native confirm()) */
.zconfirm-overlay { position: fixed; inset: 0; z-index: 1200; display: none; align-items: center; justify-content: center;
    background: rgba(6,8,20,.72); backdrop-filter: blur(3px); padding: 14px; }
.zconfirm-overlay.is-open { display: flex; }
.zconfirm { width: 100%; max-width: 420px; background: linear-gradient(180deg, #171a2e, #10121f);
    border: 1px solid rgba(245,215,110,.35); border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,.6); padding: 1.4rem 1.5rem; }
.zconfirm__title { color: #f5d76e; font-weight: 700; font-size: 1.1rem; margin-bottom: .5rem; font-family: Georgia, serif; }
.zconfirm__msg { color: #cdd2e6; line-height: 1.5; margin-bottom: 1.3rem; }
.zconfirm__actions { display: flex; justify-content: flex-end; gap: .6rem; }
.zconfirm__cancel, .zconfirm__ok { padding: .5rem 1.15rem; border-radius: 8px; font-weight: 600; cursor: pointer; border: 1px solid transparent; font-size: .95rem; }
.zconfirm__cancel { background: rgba(255,255,255,.06); color: #e7e9f3; border-color: rgba(255,255,255,.18); }
.zconfirm__cancel:hover { background: rgba(255,255,255,.12); }
.zconfirm__ok { background: linear-gradient(135deg, #6d4aa6, #8a5cff); color: #fff; }
.zconfirm__ok--danger { background: linear-gradient(135deg, #b23b3b, #e05b5b); }
.zconfirm__ok:hover { opacity: .92; }

@font-face {
    font-family: 'UnifrakturMaguntia';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/UnifrakturMaguntia.woff2') format('woff2');
}

/* Buttons injected next to every 🔊 Listen button */
.zohar-read-actions { display: inline-flex; gap: .35rem; flex-wrap: wrap; vertical-align: middle; }
.zohar-read-actions .zr-act {
    font-size: .8rem; line-height: 1.2; padding: .2rem .5rem; border-radius: 6px; cursor: pointer;
    background: rgba(245,215,110,.12); color: #f5d76e; border: 1px solid rgba(245,215,110,.5);
}

/* ===== One tidy, centred, wrapping toolbar for every AI-answer popup — aligned on any device. ===== */
.zohar-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* Let the Save/Read/Word/Saved group join the same flex row instead of forming a squeezed column. */
.zohar-toolbar .zohar-read-actions { display: contents; }
/* Every control the same height, single line, never wrapping its label. */
.zohar-toolbar .zr-act,
.zohar-toolbar .font-btn,
.zohar-toolbar .font-select,
.zohar-toolbar .zfont-dd__btn,
.zohar-toolbar .speak-btn {
    height: 34px; min-height: 34px; display: inline-flex; align-items: center; justify-content: center;
    white-space: nowrap; margin: 0; box-sizing: border-box; line-height: 1;
}
.zohar-toolbar .zr-act { padding: 0 .6rem; font-size: .82rem; }
.zohar-toolbar .speak-btn { padding: 0 .8rem; gap: .35rem; }

/* Custom font picker — each option shown in its own typeface (works on every browser incl. Safari). */
.zfont-dd { position: relative; display: inline-flex; }
.zfont-dd__btn { min-width: 118px; justify-content: space-between !important; gap: .4rem; padding: 0 .55rem; }
.zfont-dd__cur { overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.zfont-dd__caret { opacity: .7; font-size: .7rem; flex: 0 0 auto; }
.zfont-dd__menu {
    display: none; position: fixed; z-index: 100000; background: #1b1930;
    border: 1px solid rgba(150,130,255,.45); border-radius: 12px; padding: 6px;
    max-height: 62vh; overflow-y: auto; box-shadow: 0 16px 48px rgba(0,0,0,.55);
}
.zfont-dd__menu.is-open { display: block; }
.zfont-dd__opt {
    display: block; width: 100%; text-align: left; background: transparent; border: 0;
    color: #ece9ff; -webkit-text-fill-color: #ece9ff; padding: .5rem .75rem; border-radius: 8px;
    cursor: pointer; font-size: 1.08rem; line-height: 1.25; white-space: nowrap;
}
.zfont-dd__opt:hover { background: rgba(120,90,255,.25); }
.zohar-read-actions .zr-act:hover { background: rgba(245,215,110,.22); }
.zohar-read-actions .zr-act:disabled { opacity: .6; cursor: default; }

/* Saved-readings list (shown in the shared modal) */
.zr-saved-list { list-style: none; margin: 0; padding: 0; }
.zr-saved-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
    padding: .5rem .25rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.zr-saved-open { color: #f5d76e; text-decoration: none; font-weight: 600; }
.zr-saved-open:hover { text-decoration: underline; }
.zr-saved-when { color: #9aa0b5; font-size: .8rem; white-space: nowrap; }
.zr-saved-empty { color: #9aa0b5; }
.zr-saved-foot { margin-top: .9rem; text-align: center; }
.zr-saved-all { color: #b98bff; text-decoration: none; font-weight: 600; }
.zr-saved-all:hover { text-decoration: underline; }

/* Reading-style modal */
.zr-fontmodal-overlay { position: fixed; inset: 0; z-index: 1100; display: none;
    background: rgba(0,0,0,.65); align-items: center; justify-content: center; padding: 12px; }
.zr-fontmodal-overlay.is-open { display: flex; }
.zr-fontmodal { background: linear-gradient(145deg, #3d2817, #2c1810); border: 2px solid #c9a227;
    border-radius: 14px; padding: 1.6rem 1.8rem; max-width: 430px; width: 92%;
    box-shadow: 0 8px 40px rgba(0,0,0,.6); position: relative; }
.zr-fontmodal h3 { color: #e7c65a; text-align: center; margin: 0 0 1.1rem; font-size: 1.15rem; font-family: Georgia, serif; }
.zr-fontmodal-close { position: absolute; top: 8px; right: 14px; background: none; border: 0;
    color: #e7c65a; font-size: 1.5rem; line-height: 1; cursor: pointer; opacity: .75; }
.zr-fontmodal-close:hover { opacity: 1; }
.zr-fm-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 8px; }
.zr-fm-label { font-size: .8rem; color: #e7c65a; white-space: nowrap; min-width: 74px; text-align: right; font-family: Georgia, serif; }
.zr-fm-dropdown { font-size: .82rem; padding: 5px 9px; background: #f5e6d3; color: #3d2817;
    border: 1px solid #c9a227; border-radius: 5px; cursor: pointer; font-family: Georgia, serif; }
.zr-fm-family { min-width: 150px; }
.zr-fm-bold { width: 34px; height: 30px; border: 1px solid #c9a227; border-radius: 5px; background: #f5e6d3;
    color: #3d2817; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.zr-fm-bold.active { background: #c9a227; color: #fff; box-shadow: inset 0 1px 3px rgba(0,0,0,.3); }
.zr-fm-color { width: 48px; height: 30px; padding: 2px; border: 1px solid #c9a227; border-radius: 5px; background: #f5e6d3; cursor: pointer; }
.zr-fm-preview { margin-top: 12px; padding: 12px 14px; border-radius: 6px; min-height: 54px;
    background-color: #f3e5c8; color: #1a1a1a; font-family: Georgia, serif; font-size: 18px; line-height: 1.5;
    border: 1px solid #c9a227; background-size: cover; background-position: center; }
.zr-fm-save { display: block; margin: 16px auto 0; padding: 8px 30px; background: linear-gradient(135deg, #2d5a1d, #4b8b3b);
    color: #fff; border: 2px solid #c9a227; border-radius: 8px; font-size: .95rem; cursor: pointer; font-family: Georgia, serif; }
.zr-fm-save:hover { opacity: .9; }

/* In-browser reader (book view on paper) */
.zr-reader { position: fixed; inset: 0; z-index: 1080; display: none; flex-direction: column; background: rgba(6,8,20,.92); }
.zr-reader.is-open { display: flex; }
.zr-reader__bar { display: flex; align-items: center; justify-content: space-between;
    padding: .6rem 1rem; background: #10121f; border-bottom: 1px solid rgba(245,215,110,.3); }
.zr-reader__ttl { color: #f5d76e; font-weight: 700; }
.zr-reader__tools { display: flex; gap: .5rem; align-items: center; }
.zr-reader__scroll { flex: 1 1 auto; overflow-y: auto; padding: 24px 12px 64px; -webkit-overflow-scrolling: touch; }
.zr-reader__page { max-width: 760px; margin: 0 auto; padding: 46px 52px; border-radius: 6px;
    color: #221a12; line-height: 1.62; box-shadow: 0 18px 60px rgba(0,0,0,.55); font-family: Georgia, serif; }
.zr-reader__page.paper-parchment { background-color: #f3e5c8;
    background-image: url('/images/perkament.png'); background-size: cover; background-position: center; background-attachment: fixed; }
.zr-reader__page.paper-cream { background-color: #faf6ec; background-image: none; }
.zr-reader__page .rd-booktitle { font-size: 1.9em; font-weight: 800; text-align: center; margin: 0 0 .6em;
    color: inherit; -webkit-text-fill-color: currentColor; background: none; font-family: Georgia, serif; }
.zr-reader__page .rd-p { margin: 0 0 .9em; text-align: justify; color: inherit; }

/* Word-export progress popup */
.zr-docx { position: fixed; inset: 0; z-index: 1090; display: none;
    background: rgba(6,8,20,.78); align-items: center; justify-content: center; padding: 12px; }
.zr-docx.is-open { display: flex; }
.zr-docx__card { width: 100%; max-width: 440px; text-align: center;
    background: linear-gradient(180deg, #171a2e, #10121f); border: 1px solid rgba(245,215,110,.35);
    border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.6); padding: 1.6rem 1.5rem; }
.zr-docx__title { font-weight: 700; color: #f5d76e; margin-bottom: 1rem; }
.zr-docx__bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; }
.zr-docx__fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #f5d76e, #b98bff); transition: width .4s ease; }
.zr-docx__label { margin-top: .8rem; color: #cdd2e6; font-size: .9rem; font-style: italic; }
