/* Core UI (theme-agnostic). Theme files define CSS variables. */
:root{
  --bg: #ffffff;
  --bg2:#f6f7fb;
  --text:#111827;
  --muted:#6b7280;
  --card:#ffffff;
  --border:#e5e7eb;
  --brand:#2563eb;
  --brand2:#1d4ed8;
  --danger:#dc2626;
  --shadow: 0 10px 30px rgba(0,0,0,.08);
  --radius: 16px;
  --container: 1100px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--text);
  /* Override default gradient background to enforce a pure white backdrop. */
  background: linear-gradient(180deg, var(--bg2), var(--bg));
}

/* Force global white background across the entire site.  The !important
   declarations override any gradients or colored backgrounds defined
   elsewhere (e.g. in theme variables or components). */
html, body{
  background:#fff !important;
  background-image:none !important;
}
a{color:inherit; text-decoration:none}
code{font-family:var(--mono); font-size:.95em}
img{max-width:100%; display:block}

.container{max-width:var(--container); margin:0 auto; padding:18px}

.topbar{
  position:sticky; top:0; z-index:20;
  backdrop-filter: blur(10px);
  background: rgba(255,255,255,.7);
  border-bottom: 1px solid var(--border);
}
.topbar__inner{display:flex; gap:14px; align-items:center; justify-content:space-between}
.brand{display:flex; align-items:center; gap:10px; font-weight:800}
.brand__logo{font-size:20px}
.brand__text{letter-spacing:-.2px}

.search{display:flex; gap:10px; flex:1; max-width:520px}
.search input{
  flex:1; border:1px solid var(--border); background:var(--card);
  padding:10px 12px; border-radius:999px; outline:none;
}
.search button{
  border:1px solid var(--border); background:var(--card);
  padding:10px 14px; border-radius:999px; cursor:pointer;
}
.nav{display:flex; gap:14px; align-items:center}
.nav a{padding:8px 10px; border-radius:999px}
.nav a:hover{background:rgba(0,0,0,.05)}

.hero{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap:18px;
  margin-top:14px;
}
.hero h1{font-size:38px; line-height:1.08; letter-spacing:-.8px; margin:0 0 8px}

/* Optional highlighted hero title. When the admin setting
   `hero_title_highlight_enabled` is active, the heading text on the
   homepage is wrapped in a <span class="hero-highlight"> to give it
   a subtle colored background. Without this wrapper the hero text
   renders normally. */
.hero-highlight{
  background: rgba(37,99,235,.15);
  border-radius: 4px;
  padding: 0 4px;
}
.hero__card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  padding:16px;
  box-shadow: var(--shadow);
}
.chips{display:flex; flex-wrap:wrap; gap:10px; margin-top:12px}
.chip{
  background: rgba(37,99,235,.10);
  color: var(--brand2);
  padding:8px 12px;
  border-radius: 999px;
  border:1px solid rgba(37,99,235,.18);
}

.page-head{margin:18px 0}
.page-head h1{margin:0 0 6px; font-size:30px; letter-spacing:-.4px}
.section-title{margin:22px 0 12px; font-size:18px}

.grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:14px;
}
.card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  overflow:hidden;
  box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
.card:hover{transform: translateY(-2px)}
.card__media{height:190px; background:rgba(0,0,0,.03); display:flex; align-items:center; justify-content:center}
.card__media img{width:100%; height:100%; object-fit:cover}
.placeholder{font-size:38px; opacity:.6}
.card__body{padding:14px}
.card__title{font-weight:800; letter-spacing:-.2px; margin-bottom:6px}
.card__meta{font-size:13px}

.reader{
  background: var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.reader__head{padding:18px; border-bottom:1px solid var(--border)}
.reader__head h1{margin:0 0 8px; font-size:28px; letter-spacing:-.4px}
.reader__actions{display:flex; flex-wrap:wrap; gap:10px; margin-top:12px}
.summary{
  padding: 0 18px 18px;
  border-bottom:1px solid var(--border);
}
.content{padding:18px; line-height:1.75}
.content h1,.content h2,.content h3{line-height:1.25}
.content .book-content{max-width: 800px; margin:0 auto}
.content a{color: var(--brand2); text-decoration: underline}

.ad-slot{padding:18px; border-top:1px dashed var(--border); border-bottom:1px dashed var(--border)}

.footer{margin-top:28px; border-top:1px solid var(--border); background:rgba(255,255,255,.6)}
.footer__inner{display:flex; gap:14px; align-items:flex-start; justify-content:space-between}

.notice{
  background: rgba(37,99,235,.08);
  border: 1px solid rgba(37,99,235,.16);
  padding: 12px 14px;
  border-radius: 12px;
  margin: 14px 0;
}
.muted{color:var(--muted)}
.small{font-size:13px}

.btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding:10px 14px;
  border-radius: 12px;
  border:1px solid var(--border);
  background: var(--card);
  cursor:pointer;
  font-weight:700;
}
.btn.primary{background: var(--brand); border-color: rgba(0,0,0,.05); color:white}
.btn.primary:hover{background: var(--brand2)}
.btn.danger{background: rgba(220,38,38,.10); border-color: rgba(220,38,38,.25); color: var(--danger)}

.breadcrumbs{margin:14px 0; font-size:13px}

.form{display:grid; gap:12px}
.form label{display:grid; gap:6px; font-weight:700}
.form input, .form select, .form textarea{
  border:1px solid var(--border);
  padding:10px 12px;
  border-radius: 12px;
  background: var(--card);
  outline:none;
  font-weight:600;
}
.form textarea{font-family:var(--mono); font-weight:500}

.auth{max-width:520px; margin: 24px auto}
.stats{display:grid; grid-template-columns: repeat(2, 1fr); gap:14px; margin: 14px 0}
.stat{background: var(--card); border:1px solid var(--border); border-radius: var(--radius); padding:16px; box-shadow: var(--shadow)}
.stat__num{font-size:30px; font-weight:900; letter-spacing:-.6px}

.table{border:1px solid var(--border); border-radius: var(--radius); overflow:hidden; background: var(--card); box-shadow: var(--shadow)}
.tr{display:grid; grid-template-columns: 1.2fr 1.2fr .7fr .7fr 1.6fr; gap:10px; padding:12px 14px; border-top:1px solid var(--border); align-items:center}
.tr.th{background: rgba(0,0,0,.03); font-weight:900; border-top:none}
.actions{display:flex; gap:8px; justify-content:flex-end}
.split{display:grid; grid-template-columns: 1fr 1.2fr; gap:14px}
.details{border:1px solid var(--border); border-radius: 12px; padding:12px}

@media (max-width: 980px){
  .hero{grid-template-columns:1fr}
  .grid{grid-template-columns: repeat(2, 1fr)}
  .split{grid-template-columns:1fr}
  .tr{grid-template-columns: 1.2fr 1.2fr .6fr .6fr 1.2fr}
  .search{display:none}
}
@media (max-width: 580px){
  .grid{grid-template-columns:1fr}
  .topbar__inner{flex-wrap:wrap}
}


/* --- Book page + tabs + reviews --- */
.breadcrumbs{display:flex; flex-wrap:wrap; gap:8px; align-items:center}
.breadcrumbs .dot{opacity:.55}
.book-hero{
  display:grid;
  grid-template-columns: 220px 1fr;
  gap:18px;
  align-items:start;
  margin-top:14px;
}
.book-cover{
  border:1px solid var(--border);
  background:var(--card);
  border-radius: var(--radius);
  overflow:hidden;
  box-shadow: var(--shadow);
}
.book-head{min-width:0}
.book-title{font-size:34px; line-height:1.1; letter-spacing:-.6px; margin:0 0 6px}
.book-author{font-size:16px; margin-bottom:10px}
.book-meta{display:flex; flex-wrap:wrap; gap:10px; margin:8px 0 14px}
.book-meta span{padding:6px 10px; border:1px solid var(--border); background:var(--card); border-radius:999px}
.rating-summary{display:flex; gap:10px; align-items:center; margin:6px 0 14px}
.stars{display:flex; gap:2px; line-height:1}
.star{font-size:18px; opacity:.25}
.star.on{opacity:1}
.stars.small .star{font-size:15px}
.book-actions{display:flex; flex-wrap:wrap; gap:10px}
.book-summary h2, .book-tags h2{margin-top:0}

.tabs{
  /* Book tabs layout: horizontal alignment with consistent spacing */
  display:flex;
  gap:16px;
  flex-wrap:wrap;
  margin:18px 0 10px;
  border-bottom:1px solid var(--border);
}
.tab{
  display:inline-flex; align-items:center; gap:8px;
  padding:10px 14px;
  border-radius: 12px 12px 0 0;
  border:1px solid transparent;
  margin-bottom:-1px;
  color: var(--muted);
}
.tab:hover{background:rgba(0,0,0,.04); color:var(--text)}
.tab.active{
  background: var(--card);
  border-color: var(--border);
  color: var(--text);
}
.tab-panel{margin-top:10px}

.reader-content{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.reader-content h1,.reader-content h2,.reader-content h3{scroll-margin-top:120px}

.grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:16px;
}
@media (max-width: 900px){
  .book-hero{grid-template-columns: 1fr; }
  .grid-2{grid-template-columns: 1fr;}
}

.review-form .label{display:block; font-weight:700; margin:12px 0 6px}
.review-form input[type="text"],
.review-form input[type="email"],
.review-form textarea{
  width:100%;
  border:1px solid var(--border);
  background:var(--card);
  border-radius: 14px;
  padding:10px 12px;
  outline:none;
}
.review-form textarea{resize:vertical; min-height:120px}
.review-form .row{display:grid; grid-template-columns:1fr 1fr; gap:12px}
@media (max-width: 700px){ .review-form .row{grid-template-columns:1fr;} }

.hp{position:absolute; left:-9999px; width:1px; height:1px; overflow:hidden}

.star-picker{
  display:inline-flex;
  flex-direction: row-reverse;
  gap:4px;
}
.star-picker input{display:none}
.star-picker label{
  font-size:26px;
  cursor:pointer;
  opacity:.25;
  line-height:1;
  padding:2px 2px;
}
.star-picker input:checked ~ label,
.star-picker label:hover,
.star-picker label:hover ~ label{
  opacity:1;
}

.reviews{display:flex; flex-direction:column; gap:12px; margin-top:10px}
.review{
  padding:12px;
  border:1px solid var(--border);
  background:var(--bg2);
  border-radius: 14px;
}
.review__head{display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap}
.review__text{margin-top:8px; white-space:normal}

.review-admin{padding:12px; border:1px solid var(--border); border-radius:14px; background:var(--bg2); margin:12px 0}
.review-admin__head{display:flex; align-items:center; justify-content:space-between; gap:10px}
.review-admin__title{font-weight:800; letter-spacing:-.2px}
.review-actions{display:flex; gap:10px; margin-top:10px; flex-wrap:wrap}

.review-badge{
  font-size:12px;
  padding:5px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--card);
}
.review-badge.pending{opacity:.9}
.review-badge.approved{opacity:1}
.review-badge.rejected{opacity:.75}

/* Comments list styling (analogous to reviews but without rating stars) */
.comments{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin-top:10px;
}
.comment{
  padding:12px;
  border:1px solid var(--border);
  background:var(--bg2);
  border-radius:14px;
}
.comment__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}
.comment__text{
  margin-top:8px;
  white-space:normal;
}

/* Admin comments moderation styling */
.comment-admin{
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--bg2);
  margin:12px 0;
}
.comment-admin__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.comment-admin__text{
  margin-top:8px;
  white-space:normal;
}

/* Pagination component for category pages */
.pagination{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:24px 0;
}
.page-link{
  display:inline-block;
  padding:8px 12px;
  border:1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  text-decoration:none;
  font-weight:600;
}
.page-link:hover{
  background: rgba(0,0,0,.04);
}
.page-link.active{
  background: var(--brand);
  border-color: var(--brand2);
  color:#fff;
}
.page-link.prev, .page-link.next{
  font-weight:700;
}

.sep{border:none; border-top:1px solid var(--border); margin:14px 0}
