/* ============================================================
   EBOOKERR — Demo Section Styles
   ============================================================ */

/* ── Section ── */
.demo-section { overflow: hidden; }
.demo-bottom-cta {
  text-align: center; margin-top: 40px;
}
.demo-bottom-cta p { font-size: 16px; color: rgba(255,255,255,.55); margin-bottom: 20px; }

/* ── Browser chrome ── */
.demo-browser {
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 40px 120px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.07);
  background: #0F0A1E;
}
.demo-chrome {
  background: #1A1040; padding: 12px 18px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.demo-chrome .dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.demo-chrome .dot.red    { background: #FF5F57; }
.demo-chrome .dot.yellow { background: #FEBC2E; }
.demo-chrome .dot.green  { background: #28C840; }
.demo-url-bar {
  flex: 1; background: rgba(255,255,255,.06); border-radius: 6px;
  padding: 5px 14px; font-size: 12px; color: rgba(255,255,255,.35);
  font-family: monospace; margin-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.demo-url-bar strong { color: rgba(255,255,255,.55); }

/* ── App ── */
.demo-app { display: flex; flex-direction: column; height: 580px; min-height: 500px; }

/* Top bar */
.demo-topbar {
  background: #0F0A1E; height: 52px; display: flex; align-items: center;
  padding: 0 16px; gap: 12px; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.demo-logo-sm {
  display: flex; align-items: center; gap: 8px;
  color: #fff; font-weight: 800; font-size: 15px; white-space: nowrap; flex-shrink: 0;
}
.demo-logo-sm svg { flex-shrink: 0; }
.demo-logo-sm .logo-dot { color: #EC4899; }
.demo-title-field {
  flex: 1; background: rgba(255,255,255,.07); border: 1.5px solid rgba(255,255,255,.1);
  border-radius: 7px; color: #fff; font-size: 14px; font-weight: 600;
  padding: 7px 14px; outline: none; font-family: inherit; min-width: 0;
  transition: border-color .2s;
}
.demo-title-field:focus { border-color: #EC4899; background: rgba(255,255,255,.1); }
.demo-top-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.demo-save-status { font-size: 11px; color: rgba(255,255,255,.35); white-space: nowrap; }
.demo-save-status.saved { color: #6EE7B7; }

.demo-tbtn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 7px; font-size: 12px; font-weight: 700;
  cursor: pointer; border: none; font-family: inherit; transition: all .2s; white-space: nowrap;
}
.demo-tbtn-ghost {
  background: rgba(255,255,255,.08); color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.15);
}
.demo-tbtn-ghost:hover { background: rgba(255,255,255,.14); color: #fff; }
.demo-tbtn-save {
  background: linear-gradient(135deg,#10B981,#059669); color: #fff;
  box-shadow: 0 2px 10px rgba(16,185,129,.35);
}
.demo-tbtn-save:hover { box-shadow: 0 4px 16px rgba(16,185,129,.5); }

/* Body */
.demo-body {
  display: grid; grid-template-columns: 200px 1fr 200px;
  flex: 1; overflow: hidden;
}

/* Chapter sidebar */
.demo-ch-col {
  background: #0D0928; display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.06); overflow: hidden;
}
.demo-ch-hdr {
  padding: 12px 14px 8px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.06); flex-shrink: 0;
}
.demo-ch-hdr > span:first-child { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; color: rgba(255,255,255,.35); text-transform: uppercase; }
.demo-ch-badge { font-size: 11px; color: rgba(255,255,255,.3); background: rgba(255,255,255,.07); padding: 2px 7px; border-radius: 10px; }

.demo-ch-list { flex: 1; overflow-y: auto; padding: 6px 0; }
.demo-ch-list::-webkit-scrollbar { width: 3px; }
.demo-ch-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }

.demo-ch-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; cursor: pointer; border-left: 3px solid transparent;
  transition: background .15s, border-color .15s;
}
.demo-ch-item:hover { background: rgba(255,255,255,.04); }
.demo-ch-item.active {
  background: rgba(124,58,237,.25); border-left-color: #EC4899;
}
.demo-ch-num {
  width: 20px; height: 20px; border-radius: 5px;
  background: rgba(255,255,255,.07); display: flex; align-items: center;
  justify-content: center; font-size: 10px; font-weight: 700; color: rgba(255,255,255,.4); flex-shrink: 0;
}
.demo-ch-item.active .demo-ch-num { background: #EC4899; color: #fff; }
.demo-ch-label {
  font-size: 12px; color: rgba(255,255,255,.6); flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500;
}
.demo-ch-item.active .demo-ch-label { color: #fff; font-weight: 600; }
.demo-ch-del {
  opacity: 0; background: none; border: none; color: rgba(255,255,255,.3);
  cursor: pointer; font-size: 12px; padding: 2px 4px; line-height: 1;
  transition: opacity .15s, color .15s;
}
.demo-ch-item:hover .demo-ch-del { opacity: 1; }
.demo-ch-del:hover { color: #EF4444; }

.demo-add-wrap { padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.06); flex-shrink: 0; }
.demo-add-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 7px;
  background: rgba(124,58,237,.18); border: 1.5px dashed rgba(124,58,237,.45);
  color: rgba(255,255,255,.6); border-radius: 7px; padding: 9px;
  font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; transition: all .2s;
}
.demo-add-btn:hover { background: rgba(124,58,237,.3); border-color: #EC4899; color: #fff; }

/* Editor column */
.demo-editor-col {
  background: #F5F3FF; display: flex; flex-direction: column;
  overflow-y: auto; gap: 14px; padding: 20px;
}
.demo-editor-col::-webkit-scrollbar { width: 4px; }
.demo-editor-col::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 2px; }

.demo-ch-title-inp {
  width: 100%; border: none; border-bottom: 2.5px solid #E5E7EB;
  padding: 8px 0; font-size: 20px; font-weight: 800; color: #1F2937;
  background: transparent; outline: none; font-family: inherit; transition: border-color .2s;
}
.demo-ch-title-inp:focus { border-bottom-color: #7C3AED; }
.demo-ch-title-inp::placeholder { color: #D1D5DB; }

.demo-img-drop {
  border: 2px dashed #D1D5DB; border-radius: 10px; padding: 20px;
  text-align: center; cursor: pointer; transition: all .2s; background: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.demo-img-drop:hover { border-color: #7C3AED; background: #F5F3FF; }
.demo-img-drop svg { color: #7C3AED; opacity: .5; }
.demo-img-drop strong { font-size: 13px; color: #374151; }
.demo-img-drop span  { font-size: 12px; color: #9CA3AF; }

.demo-rich-wrap {
  flex: 1; background: #fff; border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06); overflow: hidden; display: flex; flex-direction: column;
  min-height: 180px;
}
.demo-rich-toolbar {
  background: #FAFAFA; padding: 8px 14px; border-bottom: 1px solid #E5E7EB;
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
}
.dtb {
  background: none; border: none; padding: 5px 8px; border-radius: 5px; font-size: 12px;
  font-weight: 700; color: #6B7280; cursor: pointer; font-family: inherit; transition: all .15s;
}
.dtb:hover { background: #F3F4F6; color: #1F2937; }
.dtb-sep { width: 1px; height: 16px; background: #E5E7EB; margin: 0 4px; }
.demo-rich-editor {
  flex: 1; padding: 16px 20px; font-size: 14px; color: #374151; line-height: 1.75;
  outline: none; overflow-y: auto;
}
.demo-rich-editor:empty::before { content: attr(data-placeholder); color: #C0C6D0; }
.demo-rich-editor p { margin-bottom: 12px; }
.demo-rich-editor h2 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.demo-rich-editor blockquote { border-left: 3px solid #7C3AED; padding: 8px 16px; margin: 12px 0; background: #F5F3FF; border-radius: 0 6px 6px 0; font-style: italic; color: #6B7280; }

/* Settings panel */
.demo-settings-col {
  background: #fff; border-left: 1px solid #E5E7EB;
  overflow-y: auto; display: flex; flex-direction: column;
}
.demo-settings-col::-webkit-scrollbar { width: 3px; }
.demo-panel-sec { padding: 16px 14px; border-bottom: 1px solid #E5E7EB; }
.demo-panel-lbl { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: #9CA3AF; margin-bottom: 12px; }
.demo-cover-drop {
  aspect-ratio: 3/4; border: 2px dashed #E5E7EB; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: #F9FAFB; cursor: pointer; transition: all .2s; margin-bottom: 10px; overflow: hidden;
}
.demo-cover-drop:hover { border-color: #7C3AED; background: #F5F3FF; }
.demo-cover-inner { font-size: 32px; }
.demo-cover-drop.has-cover { padding: 0; }
.demo-cover-drop.has-cover .demo-cover-inner { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#7C3AED,#EC4899); color: #fff; font-size: 40px; }
.demo-upload-btn {
  width: 100%; background: #F3F4F6; border: 1px solid #E5E7EB; border-radius: 7px;
  padding: 8px; font-size: 12px; font-weight: 600; color: #374151; cursor: pointer;
  font-family: inherit; transition: all .2s;
}
.demo-upload-btn:hover { background: #E5E7EB; }
.demo-input-row { margin-bottom: 10px; }
.demo-input-row label { display: block; font-size: 11px; font-weight: 600; color: #9CA3AF; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.demo-input {
  width: 100%; border: 1.5px solid #E5E7EB; border-radius: 6px;
  padding: 7px 10px; font-size: 12px; color: #374151; font-family: inherit;
  outline: none; background: #F9FAFB; transition: border-color .2s; box-sizing: border-box;
}
.demo-input:focus { border-color: #7C3AED; background: #fff; }
.demo-export-btn {
  width: 100%; background: linear-gradient(135deg,#7C3AED,#EC4899); color: #fff;
  border: none; border-radius: 8px; padding: 10px; font-size: 13px; font-weight: 700;
  cursor: pointer; font-family: inherit; display: flex; align-items: center; justify-content: center;
  gap: 7px; transition: opacity .2s; box-shadow: 0 3px 12px rgba(124,58,237,.3);
}
.demo-export-btn:hover { opacity: .88; }
.demo-export-btn.loading { opacity: .6; pointer-events: none; }
.demo-export-btn.done { background: linear-gradient(135deg,#10B981,#059669); box-shadow: 0 3px 12px rgba(16,185,129,.3); }

/* ── Preview Modal ── */
.demo-modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(10,6,28,.92); backdrop-filter: blur(8px);
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.demo-modal-overlay.open { opacity: 1; pointer-events: all; }
.demo-modal-inner { display: flex; flex-direction: column; height: 100%; }
.demo-modal-bar {
  background: #0F0A1E; padding: 12px 24px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.demo-modal-bar span:first-child { color: rgba(255,255,255,.7); font-size: 14px; font-weight: 600; }
.demo-modal-close {
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.7); padding: 7px 14px; border-radius: 7px;
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all .2s;
}
.demo-modal-close:hover { background: rgba(255,255,255,.18); color: #fff; }
.demo-modal-book {
  flex: 1; overflow-y: auto; background: #F8F7F4;
  display: flex; justify-content: center; padding: 40px 20px;
}
.demo-modal-book::-webkit-scrollbar { width: 6px; }
.demo-modal-book::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 3px; }
.demo-book-inner {
  width: 100%; max-width: 680px; background: #fff;
  box-shadow: 0 0 60px rgba(0,0,0,.15); border-radius: 4px; overflow: hidden;
}
.demo-book-cover {
  background: linear-gradient(135deg, #7C3AED, #EC4899);
  aspect-ratio: 3/4; max-height: 500px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 60px 50px;
  text-align: center; gap: 14px;
}
.demo-book-cover h1 { font-size: clamp(24px,4vw,40px); font-weight: 900; color: #fff; line-height: 1.15; }
.demo-book-cover .sub { font-size: 16px; font-style: italic; color: rgba(255,255,255,.8); }
.demo-book-cover .auth { font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: rgba(255,255,255,.6); font-weight: 600; }
.demo-book-toc { padding: 50px 60px; border-bottom: 2px solid #EDEDED; }
.demo-book-toc h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 3px; color: #9CA3AF; margin-bottom: 28px; font-family: sans-serif; }
.demo-toc-row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dotted #E5E7EB; }
.demo-toc-n { font-size: 11px; color: #7C3AED; font-weight: 700; width: 30px; flex-shrink: 0; font-family: sans-serif; }
.demo-toc-t { font-size: 15px; color: #1F2937; font-weight: 600; }
.demo-book-chapter { padding: 60px 60px 50px; border-bottom: 2px solid #EDEDED; }
.demo-ch-n { font-size: 10px; text-transform: uppercase; letter-spacing: 3px; color: #7C3AED; font-weight: 700; margin-bottom: 8px; font-family: sans-serif; }
.demo-ch-h { font-size: clamp(20px,3vw,30px); font-weight: 900; color: #1E1B4B; margin-bottom: 16px; }
.demo-ch-divider { width: 48px; height: 3px; background: linear-gradient(90deg,#7C3AED,#EC4899); border-radius: 2px; margin-bottom: 24px; }
.demo-ch-txt { font-size: 15px; line-height: 1.8; color: #374151; }
.demo-ch-txt p { margin-bottom: 14px; }

/* ── Cover color swatches ── */
.demo-cover-colors {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px;
}
.color-swatch {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; transition: transform .15s, border-color .15s;
  flex-shrink: 0;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: #fff; transform: scale(1.1); box-shadow: 0 0 0 2px #7C3AED; }

/* ── Stats ── */
.demo-stats { display: flex; gap: 12px; }
.demo-stat {
  flex: 1; text-align: center; background: #F9FAFB; border-radius: 8px; padding: 10px;
  border: 1px solid #E5E7EB;
}
.demo-stat span { display: block; font-size: 20px; font-weight: 800; color: #7C3AED; line-height: 1; }
.demo-stat small { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #9CA3AF; font-weight: 600; }

/* ── Empty state ── */
.demo-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: #9CA3AF; text-align: center; padding: 40px; height: 100%;
}
.demo-empty-state svg { opacity: .25; }
.demo-empty-state h3 { font-size: 16px; font-weight: 700; color: #374151; }
.demo-empty-state p  { font-size: 13px; }

/* ── Editor placeholder ── */
.demo-rich-editor:empty::before {
  content: attr(data-placeholder);
  color: #C0C6D0; pointer-events: none;
}

/* ── Demo bottom CTA ── */
.demo-cta-badges {
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
  margin-bottom: 14px;
}
.demo-cta-badges span { font-size: 13px; color: rgba(255,255,255,.5); }

/* ── Reset button in chrome ── */
.demo-clear-btn {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.4); padding: 4px 10px; border-radius: 5px;
  font-size: 11px; cursor: pointer; font-family: inherit; transition: all .2s; flex-shrink: 0;
}
.demo-clear-btn:hover { color: #EF4444; border-color: rgba(239,68,68,.4); }

/* ── Modal iframe wrapper ── */
.demo-modal-book iframe { display: block; width: 100%; height: 100%; border: none; }

/* ── Preview modal: make book scrollable ── */
.demo-modal-book {
  flex: 1; overflow: hidden; background: #F8F7F4; display: flex;
  flex-direction: column;
}

/* Settings panel: toggle button only shown when the panel becomes an overlay */
.cr-settings-toggle-btn { display: none; }

/* Responsive */
@media (max-width: 900px) {
  .cr-settings-toggle-btn { display: inline-flex; }
  .demo-body { grid-template-columns: 180px 1fr; }
  .demo-settings-col {
    position: fixed; top: 0; right: -320px; width: 300px; max-width: 88vw; height: 100vh;
    z-index: 10001; box-shadow: -8px 0 30px rgba(0,0,0,.25);
    transition: right .25s ease;
  }
  .demo-settings-col.open { right: 0; }
  .cr-settings-overlay {
    position: fixed; inset: 0; background: rgba(15,10,30,.5);
    z-index: 10000; opacity: 0; visibility: hidden; transition: opacity .2s;
  }
  .cr-settings-overlay.open { opacity: 1; visibility: visible; }
  body.admin-bar .demo-settings-col,
  body.admin-bar .cr-settings-overlay { top: 32px; }
  body.admin-bar .demo-settings-col { height: calc(100vh - 32px); }
}
@media (max-width: 640px) {
  .demo-ch-col { display: none; }
  .demo-body { grid-template-columns: 1fr; }
  .demo-app { height: 420px; }
  .demo-cta-badges { flex-direction: column; align-items: center; }
}
