/* Gurbanov Boys — shared styles. Warm library feel, no external assets. */

:root {
  --gold: #d4a94e;
  --gold-dim: #a8813a;
  --cream: #f7f1e3;
  --ink: #2e2418;
  --paper: #faf5e9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--cream);
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 214, 150, 0.10), transparent 55%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.14) 0 2px, transparent 2px 110px),
    linear-gradient(#3b2b1c, #251a0f 65%, #170f07);
  background-attachment: fixed;
}

.hidden { display: none !important; }

a { color: var(--gold); }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(212, 169, 78, 0.35);
  backdrop-filter: blur(4px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  letter-spacing: 1px;
  color: var(--gold);
  text-decoration: none;
}
.topbar .spacer { flex: 1; }
.topbar .who { opacity: 0.85; font-size: 0.95rem; }

/* ---------- buttons / inputs ---------- */
.btn {
  display: inline-block;
  background: linear-gradient(#e2b95c, #b98c34);
  color: #241a08;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); }
.btn.ghost {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  box-shadow: none;
}
.btn.danger { background: linear-gradient(#c0564d, #93352e); color: #fff; }
.btn.small { padding: 5px 11px; font-size: 0.82rem; }

input[type="text"], input[type="password"], input[type="color"],
textarea, select {
  background: #fbf7ec;
  color: var(--ink);
  border: 1px solid #cbb98f;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.95rem;
  width: 100%;
}
input[type="color"] { width: 64px; height: 40px; padding: 4px; cursor: pointer; }
textarea { min-height: 90px; resize: vertical; font-family: inherit; }
label { display: block; margin: 10px 0 4px; font-size: 0.9rem; opacity: 0.9; }

.error {
  background: rgba(160, 40, 30, 0.25);
  border: 1px solid #a02818;
  color: #ffd9d2;
  padding: 10px 14px;
  border-radius: 8px;
  margin: 12px 0;
}
.ok-msg {
  background: rgba(40, 130, 60, 0.25);
  border: 1px solid #2c7a3f;
  color: #d6f5dc;
  padding: 10px 14px;
  border-radius: 8px;
  margin: 12px 0;
}

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: rgba(20, 13, 7, 0.82);
  border: 1px solid rgba(212, 169, 78, 0.5);
  border-radius: 16px;
  padding: 40px 44px;
  width: 380px;
  max-width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
}
.login-card h1 {
  font-family: Georgia, serif;
  color: var(--gold);
  margin: 0 0 4px;
  font-size: 2rem;
  letter-spacing: 1px;
}
.login-card .tagline { opacity: 0.75; margin-bottom: 22px; font-style: italic; }
.login-card form { text-align: left; }
.login-card .btn { width: 100%; margin-top: 16px; padding: 12px; }

/* ---------- bookshelf ---------- */
.shelves { max-width: 1080px; margin: 0 auto; padding: 30px 20px 80px; }
.shelf { margin-bottom: 56px; }
.shelf-plaque {
  display: inline-block;
  font-family: Georgia, serif;
  font-size: 1.6rem;
  letter-spacing: 3px;
  color: #2b1d0c;
  background: linear-gradient(#e8c56e, #c49a45 60%, #a37c2e);
  padding: 8px 34px;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  margin: 0 0 22px 8px;
  border: 1px solid #7d5f22;
}
.books-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  padding: 6px 34px 0;
  min-height: 210px;
}
.shelf-empty { opacity: 0.6; font-style: italic; padding: 20px 34px; }

.book {
  --cover: #2b6cb0;
  width: 132px;
  height: 192px;
  border-radius: 3px 8px 8px 3px;
  position: relative;
  cursor: pointer;
  flex: 0 0 auto;
  /* spine on the left, cover face, sheen */
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.45) 0, rgba(0, 0, 0, 0.45) 13px,
      rgba(255, 255, 255, 0.10) 15px, rgba(255, 255, 255, 0) 22px),
    var(--cover);
  box-shadow:
    inset 3px 0 6px rgba(0, 0, 0, 0.35),
    7px 9px 18px rgba(0, 0, 0, 0.55);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 16px 12px 16px 24px;
  overflow: hidden;
}
.book:hover {
  transform: translateY(-14px) rotate(-1.2deg);
  box-shadow:
    inset 3px 0 6px rgba(0, 0, 0, 0.35),
    10px 18px 28px rgba(0, 0, 0, 0.65);
}
/* page edges peeking out on the right */
.book::after {
  content: "";
  position: absolute;
  top: 5px; bottom: 5px; right: 0;
  width: 6px;
  background: repeating-linear-gradient(to bottom, #f3ecdb 0 2px, #cfc4a8 2px 3px);
  border-radius: 0 5px 5px 0;
}
.book .book-title {
  font-family: Georgia, serif;
  font-size: 1.02rem;
  line-height: 1.3;
  color: #f8ecd2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.book .book-sub {
  margin-top: 8px;
  font-size: 0.72rem;
  color: rgba(248, 236, 210, 0.75);
  font-style: italic;
}
.book .book-band {
  position: absolute;
  left: 0; right: 6px;
  height: 26px;
  top: 22px;
  background: rgba(212, 169, 78, 0.85);
}
.shelf-board {
  height: 26px;
  margin-top: -2px;
  background: linear-gradient(#8f5f34, #5f3c1d 55%, #38220f);
  border-radius: 4px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.65), inset 0 2px 0 rgba(255, 225, 170, 0.25);
  position: relative;
}
.shelf-board::before, .shelf-board::after {
  /* wooden brackets */
  content: "";
  position: absolute;
  top: 26px;
  width: 34px; height: 44px;
  background: linear-gradient(135deg, #4c3016, #2c1c0b);
  clip-path: polygon(0 0, 100% 0, 100% 35%, 0 100%);
}
.shelf-board::before { left: 40px; }
.shelf-board::after { right: 40px; transform: scaleX(-1); }

/* ---------- reader ---------- */
.reader-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
}
/* full-viewport reader: the book always fits the screen, no page scrolling */
.reader-body {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.reader-body .reader-top { flex: 0 0 auto; }
.reader-body .reader-stage {
  flex: 1 1 auto;
  min-height: 0;
  padding: 8px 16px;
}
.reader-body #flipbook {
  width: min(1100px, 100%);
  height: 100%;
}
.reader-body .reader-controls { flex: 0 0 auto; padding: 8px 20px 14px; }
#flipbook .simple-page { max-height: 100%; overflow-y: auto; }
.reader-stage {
  display: flex;
  justify-content: center;
  padding: 10px 16px 30px;
}
#flipbook { width: min(1100px, 96vw); }
.flip-page {
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
}
.page-inner {
  padding: 54px 56px;
  height: 100%;
  font-family: Georgia, "Times New Roman", serif;
  position: relative;
}
.page-inner h2 {
  text-align: center;
  font-size: 1.7rem;
  margin: 0 0 22px;
  color: #3a2c17;
}
.page-inner p {
  font-size: 1.06rem;
  line-height: 1.75;
  text-align: justify;
  margin: 0 0 18px;
  color: #3d3222;
}
.page-inner figure { margin: 6px 0 20px; text-align: center; }
.page-inner figure img {
  max-width: 100%;
  max-height: 46vh;
  border-radius: 4px;
  border: 8px solid #fff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}
.page-inner figcaption {
  margin-top: 10px;
  font-style: italic;
  color: #7a6a4e;
  font-size: 0.95rem;
}
.page-num {
  position: absolute;
  bottom: 22px;
  left: 0; right: 0;
  text-align: center;
  font-size: 0.85rem;
  color: #9a8a68;
}
.cover-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
  color: #f8ecd2;
  font-family: Georgia, serif;
}
.cover-page .cover-frame {
  border: 2px solid rgba(212, 169, 78, 0.8);
  outline: 1px solid rgba(212, 169, 78, 0.4);
  outline-offset: 8px;
  padding: 44px 30px;
  max-width: 80%;
}
.cover-page h1 { font-size: 2.1rem; margin: 0 0 12px; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.cover-page .sub { font-style: italic; opacity: 0.85; }
.cover-page .series { margin-top: 26px; letter-spacing: 4px; font-size: 0.85rem; color: var(--gold); }
.reader-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 0 20px 40px;
}
#page-indicator { min-width: 120px; text-align: center; opacity: 0.85; }
/* simple pager fallback (when the flip library can't load) */
.simple-page { max-width: 760px; margin: 0 auto; }
.simple-nav { display: flex; justify-content: space-between; max-width: 760px; margin: 18px auto 0; }

/* ---------- admin ---------- */
.admin-wrap { max-width: 1080px; margin: 0 auto; padding: 26px 20px 90px; }
.admin-wrap h2 {
  font-family: Georgia, serif; color: var(--gold);
  border-bottom: 1px solid rgba(212, 169, 78, 0.35);
  padding-bottom: 8px; margin-top: 38px;
}
.panel {
  background: rgba(15, 10, 5, 0.72);
  border: 1px solid rgba(212, 169, 78, 0.35);
  border-radius: 12px;
  padding: 20px 22px;
  margin: 16px 0;
}
.panel h3 { margin: 0 0 10px; font-family: Georgia, serif; color: var(--cream); }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px; border-bottom: 1px solid rgba(212, 169, 78, 0.18);
}
.list-item .grow { flex: 1; }
.list-item .meta { opacity: 0.65; font-size: 0.85rem; }
.list-item .actions { display: flex; gap: 8px; }
.block-row {
  border: 1px dashed rgba(212, 169, 78, 0.45);
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0;
  background: rgba(255, 255, 255, 0.03);
}
.block-row .block-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.block-row .block-head select { width: 170px; }
.block-row img.preview { max-width: 220px; border-radius: 6px; margin-top: 8px; display: block; }
.notice {
  background: rgba(212, 169, 78, 0.14);
  border: 1px solid var(--gold-dim);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 16px 0;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
