/* =========================================================
   PLOTDOKIDOKI - style.css
   สารบัญ:
   1) RESET พื้นฐาน
   2) ตัวแปรสี (CSS Variables) ของธีม "ปีกเทวดา" และ "แอปเปิ้ล"
   3) NAVBAR (ใช้ร่วมกับทุกหน้า) + More Dropdown + เส้นใต้ Active
   4) SEARCH BAR แบบขยาย / NOTIFICATION BADGE / PROFILE AVATAR
   5) ของตกแต่งลอยหน้าสุด (Floating Decor, z-index สูงสุด)
   6) HERO BAND
   7) BOOK OF THE MONTH
   8) RESPONSIVE
   ========================================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Nunito', sans-serif;
  min-height: 100vh;
  /* กันหน้าเว็บเลื่อนแนวนอนโดยไม่ตั้งใจ (ต้นตอบั๊กเมนูแฮมเบอร์เกอร์ "หาย" บนจอเล็ก) */
  overflow-x: hidden;
  /* ตามที่ขอ: ไม่ใส่ effect เฟดสีตอนสลับธีม เปลี่ยนแบบทันทีตรงๆ */
  background-color: var(--page-bg-color);
  background-image: var(--page-bg-image);
  background-size: var(--page-bg-size);
  background-repeat: repeat;
  color: var(--text-main);
}

/* =========================================================
   2) ตัวแปรสีของแต่ละธีม (ไม่มีธีมมืด มีแค่ 2 ธีมพาสเทลนี้)
   ========================================================= */

/* ---------- ธีมที่ 1 (ค่าเริ่มต้น) : ปีกเทวดา 🪽
   โทนหวาน ลายจุดสีชมพู-ม่วงพาสเทล ตกแต่งด้วยโบว์/โน้ตดนตรี ---------- */
body[data-theme="angel"] {
  --bg-navbar: #fff8f9;
  --bg-panel: #faf6fb;
  --bg-card-shadow: rgba(150, 110, 170, 0.18);

  --text-main: #898989;
  --text-soft: #9c86a6;
  --accent: #b98fc9;
  --accent-strong: #c4909a;   /* สีหัวข้อ / โลโก้ ของธีมนี้ (Fix ตายตัว) */
  --star: #f2b632;
  --underline-color: #898989; /* เส้นใต้สีน้ำตาลตามที่ขอ ใช้เหมือนกันทั้ง 2 ธีม */

  --border-soft: rgba(154, 79, 174, 0.25);

  --page-bg-color: #fbf3fa;
  --page-bg-image: url('images/angle-bg-dots.png'); 
  --page-bg-size: 960px auto;
}

/* ---------- ธีมที่ 2 : แอปเปิ้ล 🍎
   โทนอบอุ่น ลายทางเขียวพาสเทล-ครีม ตกแต่งด้วยแอปเปิ้ล/บ้าน ---------- */
body[data-theme="apple"] {
  --bg-navbar: #f7dede;
  --bg-panel: #f9f7ec;
  --bg-card-shadow: rgba(150, 110, 170, 0.18);

  --text-main: #4a4632;
  --text-soft: #8a8a68;
  --accent: #7fa93d;
  --accent-strong: #a5372c;   /* สีหัวข้อ / โลโก้ ของธีมนี้ (Fix ตายตัว) */
  --star: #e0a83a;
  --underline-color: #898989;

  --border-soft: rgba(127, 158, 61, 0.3);

  /* พื้นหลังธีมแอปเปิ้ล: ใช้รูป Wallpaper จริงที่ได้มาแล้ว (images/apple-bg-stripes.png) */
  --page-bg-color: #eef1e1;
  --page-bg-image: url('images/apple-bg-stripes.png');
  --page-bg-size: 960px auto;
}

/* =========================================================
   3) NAVBAR
   ========================================================= */
.navbar {
  position: sticky;
  top: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 48px;
  background: var(--bg-navbar);
}

.navbar__logo {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.7rem;
  letter-spacing: 1px;
  color: var(--accent-strong); /* เปลี่ยนทันทีตามธีม ไม่มี transition */
  white-space: nowrap;
}

.navbar__menu {
  position: relative; /* จุดอ้างอิงสำหรับเส้นใต้ที่เลื่อนได้ */
  display: flex;
  align-items: center;
  gap: 36px;
  flex: 1;
  justify-content: center;
}

.navbar__link {
  position: relative;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding-bottom: 4px;
  font-family: inherit;
}

.navbar__link:hover {
  color: var(--accent-strong);
}

.navbar__link.active {
  color: var(--accent-strong);
}

/* เส้นใต้ที่เลื่อนตามลิงก์ Active - ตำแหน่งคำนวณด้วย JS แล้วใส่เป็น inline style (left/width) */
.nav-underline {
  position: absolute;
  bottom: -4px;
  height: 2px;
  background: var(--underline-color);
  border-radius: 2px;
  transition: left 0.28s ease, width 0.28s ease; /* อันนี้คือการเลื่อน ไม่ใช่การเฟดสี จึงใส่ได้ */
}

/* ---------- More menu + dropdown ---------- */
.navbar__more {
  position: relative;
}
.navbar__more-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
}
.navbar__more-trigger::after {
  content: "▾";
  font-size: 0.7rem;
  margin-left: 2px;
}

.more-dropdown {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  width: 260px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--bg-panel);
  border-radius: 12px;
  box-shadow: 0 12px 28px var(--bg-card-shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;

  /* ซ่อนไว้ก่อน โผล่ตอน .is-open */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.more-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.more-dropdown__section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 4px;
}

.more-dropdown__divider {
  height: 1px;
  margin: 4px 2px;
  background: var(--border-soft);
}

.more-dropdown__label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-strong);
  padding: 0 6px;
}

.more-dropdown__sublabel {
  font-size: 0.72rem;
  color: var(--text-soft);
  padding: 0 6px;
}

.more-dropdown__text {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-main);
  padding: 0 6px;
}

.more-dropdown__link {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}
.more-dropdown__link:hover {
  text-decoration: underline;
}

/* ปุ่มทั่วไปในดรอปดาวน์ (Add Book / Change password / Delete acc) */
.dropdown-btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: filter 0.15s ease;
}
a.dropdown-btn {
  display: block;
  text-decoration: none;
}
.dropdown-btn:hover {
  filter: brightness(1.06);
}

.dropdown-btn--muted {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-soft);
}
.dropdown-btn--muted:hover {
  background: var(--border-soft);
}

.dropdown-btn--danger {
  background: transparent;
  color: #c0392b;
  border: 1px solid rgba(192, 57, 43, 0.35);
}
.dropdown-btn--danger:hover {
  background: rgba(192, 57, 43, 0.1);
}

.theme-change-wrap {
  display: flex;
  flex-direction: column;
}

.dropdown-btn--submenu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-soft);
}
.dropdown-btn--submenu:hover {
  background: var(--border-soft);
}

.submenu-arrow {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}
.dropdown-btn--submenu[aria-expanded="true"] .submenu-arrow {
  transform: rotate(180deg);
}

/* หัวข้อย่อยธีม: ซ่อนไว้ก่อน กดปุ่ม "Change Theme" แล้วค่อยกางลงมา (Accordion) */
.theme-submenu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 0;
  overflow: hidden;
  padding-left: 10px;
  border-left: 2px solid var(--border-soft);
  margin-left: 4px;
  transition: max-height 0.22s ease;
}
.theme-submenu.is-open {
  max-height: 160px;
  padding-top: 4px;
  padding-bottom: 2px;
}

/* กล่อง Donation เตรียมไว้ก่อน */
.donation-box {
  border: 1px dashed var(--border-soft);
  border-radius: 8px;
  padding: 12px;
}
.donation-box__placeholder {
  font-size: 0.8rem;
  color: var(--text-soft);
  text-align: center;
}

.theme-option {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.theme-option:hover {
  background: var(--border-soft);
}
.theme-option.is-selected {
  background: var(--accent);
  color: #fff;
}

/* =========================================================
   4) ไอคอนต่างๆ / SEARCH / NOTIFICATION / PROFILE
   ========================================================= */
.navbar__actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--border-soft);
  transform: translateY(-1px);
}

/* ---------- Search: ไอคอนแว่นขยาย -> กางกล่องพิมพ์ค้นหา ---------- */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  position: absolute;
  right: 44px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  opacity: 0;
  padding: 0;
  border: none;
  border-radius: 20px;
  background: var(--bg-panel);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  box-shadow: 0 6px 16px var(--bg-card-shadow);
  pointer-events: none;
  transition: width 0.25s ease, opacity 0.2s ease, padding 0.25s ease;
}

.search-wrap.is-open .search-input {
  width: 220px;
  opacity: 1;
  padding: 9px 16px;
  pointer-events: auto;
}

/* ---------- Notification bell + badge ---------- */
.notif-wrap {
  position: relative;
}

.notif-btn {
  overflow: visible;
}
.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  background: #e0413a;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg-navbar);
}

/* เอฟเฟกต์ "เด้ง" ตอนมีแจ้งเตือนใหม่เข้ามา (Mockup รองรับระบบ Real-time ในอนาคต)
   JS จะใส่คลาสนี้ชั่วคราวทุกครั้งที่ยอดแจ้งเตือนเพิ่มขึ้น */
.notif-badge.is-bumped {
  animation: notif-pop 0.4s ease;
}
@keyframes notif-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.45); }
  60%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* กระดิ่งเองก็ขยับเล็กน้อยตอนมีแจ้งเตือนใหม่ ให้รู้สึกมีชีวิตชีวาขึ้น */
.notif-btn.is-bumped {
  animation: notif-shake 0.4s ease;
}
@keyframes notif-shake {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-12deg); }
  50%      { transform: rotate(10deg); }
  75%      { transform: rotate(-6deg); }
}

/* ---------- กล่อง Dropdown แจ้งเตือน (คลิกกระดิ่งเพื่อเปิด) ---------- */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  width: 300px;
  max-height: 360px;
  background: var(--bg-panel);
  border-radius: 12px;
  box-shadow: 0 12px 28px var(--bg-card-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;

  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.notif-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.notif-dropdown__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.notif-dropdown__title {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--accent-strong);
}
.notif-dropdown__clear-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-soft);
  cursor: pointer;
  padding: 2px 4px;
}
.notif-dropdown__clear-btn:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.notif-dropdown__list {
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  background: var(--border-soft);
}
.notif-item.is-clickable {
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.notif-item.is-clickable:hover {
  filter: brightness(0.96);
}
.notif-item.is-clickable:active {
  transform: scale(0.98);
}
.notif-item__icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  line-height: 1.4;
}
.notif-item__body {
  min-width: 0;
}
.notif-item__text {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-main);
}
.notif-item__time {
  font-size: 0.7rem;
  color: var(--text-soft);
  margin-top: 2px;
}

.notif-empty {
  font-size: 0.82rem;
  color: var(--text-soft);
  text-align: center;
  padding: 28px 12px;
}

/* ---------- Profile avatar: รูปนิ่งๆ ไม่มีลิงก์ ไม่มีดรอปดาวน์ ---------- */
.profile-avatar {
  width: 38px;
  height: 38px;
  max-width: 38px;
  max-height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  flex-shrink: 0;
  display: block;
}

.profile-avatar-link {
  display: flex;
  flex-shrink: 0;
  line-height: 0;
}

/* ปุ่มแฮมเบอร์เกอร์ ซ่อนไว้ก่อน โชว์ตอนจอเล็ก */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  cursor: pointer;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-main);
  margin: 0 auto;
}

/* =========================================================
   4.5) MODALS (Add Book / Change Password / Delete Account)
   ทั้งหมดเป็น UI + เอฟเฟกต์ Mockup ก่อน ยังไม่เชื่อมฐานข้อมูลจริง
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(40, 25, 45, 0.35);

  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  width: 100%;
  max-width: 440px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-panel);
  border-radius: 16px;
  padding: 32px;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);

  /* เอฟเฟกต์เด้งเข้า-ออก (pop) */
  transform: scale(0.85);
  opacity: 0;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.18s ease;
}

.modal-overlay.is-open .modal-box {
  transform: scale(1);
  opacity: 1;
}

.modal-box--small {
  max-width: 380px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--border-soft);
  color: var(--text-main);
  font-size: 0.9rem;
  cursor: pointer;
}
.modal-close:hover {
  filter: brightness(0.95);
}

.modal-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--accent-strong);
  margin-bottom: 20px;
}
.modal-title--danger {
  color: #c0392b;
}

.modal-warning {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}
.modal-btn--ghost {
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--text-main);
}
.modal-btn--ghost:hover {
  background: var(--border-soft);
}
.modal-btn--danger {
  background: #c0392b;
  color: #fff;
}
.modal-btn--danger:hover {
  filter: brightness(1.08);
}

/* ---------- Form fields ที่ใช้ร่วมกันในฟอร์ม Add Book / Change Password ---------- */
.add-book-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field__label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.form-text-input,
.form-file-input {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: #fff;
  color: var(--text-main);
}
.form-text-input:focus {
  outline: 2px solid var(--accent);
}
.form-text-input:disabled,
.form-text-input:read-only {
  background: var(--border-soft);
  color: var(--text-soft);
  cursor: not-allowed;
}

textarea.form-text-input {
  resize: vertical;
  min-height: 80px;
}

.cover-preview {
  margin-top: 4px;
  padding: 14px;
  border: 1px dashed var(--border-soft);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-soft);
  text-align: center;
}
.cover-preview img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 6px;
  display: block;
  margin: 0 auto;
}

/* พรีวิว Banner: กว้าง เตี้ย เหมือนสัดส่วนหน้าปกจริง */
.cover-preview--banner img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
}

/* พรีวิว Avatar: วงกลมเล็กๆ เหมือนรูปโปรไฟล์จริง */
.cover-preview--avatar img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  max-height: none;
}

/* ---------- Image Crop Modal: ลาก+ซูมรูป Avatar/Banner ก่อนตั้งเป็นรูปโปรไฟล์จริง ---------- */
.crop-viewport {
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  background: #000;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.crop-viewport:active {
  cursor: grabbing;
}
.crop-viewport.is-avatar-mode {
  width: 260px;
  height: 260px;
  border-radius: 50%;
}
.crop-viewport.is-banner-mode {
  width: 100%;
  max-width: 380px;
  height: 90px;
  border-radius: 10px;
}
#cropImage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  max-width: none;
  pointer-events: none;
}

.crop-zoom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}
.crop-zoom-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}
.crop-zoom-slider {
  flex: 1;
  accent-color: var(--accent-strong);
}

.crop-hint {
  font-size: 0.75rem;
  color: var(--text-soft);
  text-align: center;
  margin-top: 10px;
}

.crop-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.crop-actions .modal-submit-btn,
.crop-actions .modal-btn {
  flex: 1;
}

.modal-submit-btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--accent-strong);
  color: #fff;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.modal-submit-btn:hover {
  filter: brightness(1.06);
}

/* ---------- Category picker: ปุ่มเลือกหมวดหมู่แบบ pill (เลือกได้ 1 อย่าง) ---------- */
.category-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.category-option {
  position: relative;
}
.category-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.category-option span {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.category-option input[type="radio"]:checked + span {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}
.category-option:hover span {
  border-color: var(--accent-strong);
}

/* ---------- Tag input: พิมพ์แล้ว Enter เพื่อเพิ่มเป็น chip ลบออกได้ทีละอัน ---------- */
.tag-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tag-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-chip-list:empty {
  display: none;
}

.form-field__hint {
  font-size: 0.72rem;
  color: var(--text-soft);
  margin-top: 2px;
}

/* Chip ของ TW ใช้โทนอำพัน/เตือนอ่อนๆ แยกจาก Tag ปกติ (โทนพาสเทลเดิม ไม่ฉูดฉาด) */
.tag-chip--tw {
  background: #fbe4c6;
  color: #9a5b1f;
}
.tag-chip--tw .tag-chip__remove {
  background: rgba(154, 91, 31, 0.15);
}
.tag-chip--tw .tag-chip__remove:hover {
  background: rgba(154, 91, 31, 0.3);
}

/* กล่องครอบ input + dropdown แนะนำแท็ก ให้ dropdown อ้างอิงตำแหน่งจากตรงนี้ */
.tag-autocomplete {
  position: relative;
}

.tag-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 190px;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  box-shadow: 0 12px 24px var(--bg-card-shadow);
  padding: 6px;
  z-index: 30;
  display: none;
}
.tag-suggestions.is-open {
  display: block;
}

/* ปรับตำแหน่งเฉพาะกล่องค้นหาบน Navbar ให้ชิดขวา ตรงกับความกว้างของ search-input ตอนกางออก */
.nav-search-suggestions {
  left: auto;
  right: 0;
  width: 240px;
  max-width: 80vw;
  z-index: 250;
}

.tag-suggestion-item {
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
}
.tag-suggestion-item:hover,
.tag-suggestion-item.is-active {
  background: var(--border-soft);
  color: var(--accent-strong);
}

.tag-suggestions__empty {
  font-size: 0.78rem;
  color: var(--text-soft);
  padding: 8px 10px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 12px;
  border-radius: 999px;
  background: var(--border-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
}
.tag-chip__remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.1);
  color: inherit;
  font-size: 0.65rem;
  cursor: pointer;
  line-height: 1;
}
.tag-chip__remove:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* =========================================================
   7.5) EXPLORE FEED (Twitter-like Review Timeline)
   ทุกสีอิงตัวแปรธีมเดิม (--bg-panel, --accent-strong, --star ฯลฯ)
   เพื่อให้เปลี่ยนธีมแล้วการ์ดฟีดเปลี่ยนโทนตามทันที
   ========================================================= */
.explore-main {
  padding-top: 32px;
}

.feed {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 0 auto 80px;
  padding: 0 20px;
}

.feed__title {
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 2.2rem;
  color: var(--accent-strong); /* Fix ตายตัวกับธีม เปลี่ยนทันทีไม่มีเฟด เหมือนหัวข้ออื่นๆ */
  margin-bottom: 28px;
}

/* Pull-to-Refresh: แถบเล็กๆ ที่ซ่อนอยู่เหนือฟีด โผล่ให้เห็นเฉพาะตอน "ดึงลง" เท่านั้น
   (ลากด้วยนิ้วบนมือถือ หรือลากด้วยเมาส์บนเดสก์ท็อปก็ได้ ต้องอยู่บนสุดของหน้าก่อนถึงจะดึงได้) */
.pull-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 0;
  overflow: hidden;
  color: var(--accent-strong);
  font-size: 0.85rem;
  font-weight: 700;
  opacity: 0;
  transition: height 0.2s ease, opacity 0.2s ease;
}
.pull-refresh__icon {
  display: inline-block;
  font-size: 1.1rem;
  transition: transform 0.15s ease;
}
.pull-refresh.is-ready .pull-refresh__icon {
  transform: rotate(180deg);
}
.pull-refresh.is-loading .pull-refresh__icon {
  animation: pull-refresh-spin 0.7s linear infinite;
}
@keyframes pull-refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.feed__list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------- Review Card ---------- */
.review-card {
  background: var(--bg-panel);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 14px 30px var(--bg-card-shadow);
}

/* เอฟเฟกต์ไฮไลต์ชั่วคราวตอนเด้งมาจากการคลิกแจ้งเตือน (Like/Star) ให้เห็นชัดว่าเป็นการ์ดไหน */
.review-card.is-highlighted {
  animation: review-card-flash 1.6s ease;
}
@keyframes review-card-flash {
  0%, 100% { box-shadow: 0 14px 30px var(--bg-card-shadow); }
  15%, 45% { box-shadow: 0 0 0 3px var(--accent-strong), 0 14px 30px var(--bg-card-shadow); }
}

.review-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

/* ลิงก์ไปหน้าโปรไฟล์ผู้โพสต์ (avatar+username) - กินพื้นที่ที่เหลือ ดันปุ่มจุดสามจุดไปขวาสุด */
.review-card__profile-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.review-card__profile-link:hover .review-card__username {
  color: var(--accent-strong);
  text-decoration: underline;
}

.review-card__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  flex-shrink: 0;
}

.review-card__username {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
}

/* ป้าย "โพสต์ของคุณ" - โชว์เฉพาะการ์ดที่ isMine: true เพื่อให้ทดสอบลอจิกแจ้งเตือนได้ง่ายๆ ด้วยตา */
.review-card__you-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
}

/* ปุ่ม + ติดตาม / ✓ กำลังติดตาม บนโพสต์ของคนอื่น (โพสต์ของตัวเองจะไม่มีปุ่มนี้) */
.review-card__follow-btn {
  flex-shrink: 0;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--accent-strong);
  background: var(--accent-strong);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.review-card__follow-btn.is-following {
  background: transparent;
  color: var(--accent-strong);
}
.review-card__follow-btn.is-following:hover {
  background: rgba(192, 57, 43, 0.1);
  border-color: #c0392b;
  color: #c0392b;
}

/* ---------- เมนูจุดสามจุด (⋮): Block / Hide / Report / ลบโพสต์ ---------- */
.review-card__menu-wrap {
  position: relative;
  flex-shrink: 0;
}
.review-card__menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.review-card__menu-btn:hover {
  background: var(--border-soft);
  color: var(--text-main);
}

.review-card__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 170px;
  background: var(--bg-panel);
  border-radius: 10px;
  box-shadow: 0 12px 28px var(--bg-card-shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 20;

  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.review-card__menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.review-card__menu-item {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  padding: 9px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
}
.review-card__menu-item:hover {
  background: var(--border-soft);
}
.review-card__menu-item--danger {
  color: #c0392b;
}
.review-card__menu-item--danger:hover {
  background: rgba(192, 57, 43, 0.1);
}

.review-card__body {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
}

.review-card__cover-link {
  flex-shrink: 0;
  width: 88px;
  display: block;
}

.review-card__cover {
  width: 100%;
  aspect-ratio: 3 / 4.4;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 14px var(--bg-card-shadow);
}
.review-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.review-card__info {
  flex: 1;
  min-width: 0;
}

.review-card__novel-link {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent-strong);
  text-decoration: none;
}
.review-card__novel-link:hover {
  text-decoration: underline;
}

.review-card__author {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin: 2px 0 6px;
}

.review-card__stars {
  color: var(--star);
  font-size: 0.9rem;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.review-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.review-card__tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--border-soft);
  color: var(--accent-strong);
}

.review-card__text {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-main);
  margin-bottom: 10px;
}

/* ข้อความรีวิวยาวๆ จะถูกตัดไว้แค่ 3 บรรทัดจนกว่าจะกด "... more" */
.review-card__text.is-clamped {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.review-card__more-btn {
  background: none;
  border: none;
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0 0 14px;
  display: block;
}
.review-card__more-btn:hover {
  text-decoration: underline;
}

/* ---------- Interaction Bar: Heart / Star / Comment ---------- */
.review-card__actions {
  display: flex;
  gap: 26px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  color: var(--text-soft);
  padding: 4px;
  text-decoration: none;
  transition: transform 0.15s ease;
}
.action-btn:hover {
  transform: translateY(-2px);
}

.folder-btn {
  color: var(--text-soft);
}
.folder-btn:hover {
  color: var(--accent-strong);
}

.folder-remove-btn {
  font-size: 0.72rem;
  font-weight: 700;
  color: #c0392b;
}
.folder-remove-btn:hover {
  color: #a5281a;
}
.folder-remove-btn .action-btn__icon {
  font-size: 0.95rem;
}
.folder-remove-btn .action-btn__label {
  white-space: nowrap;
}

.action-btn__count {
  font-size: 0.78rem;
  font-weight: 700;
}

/* สถานะ Active ของแต่ละปุ่ม เปลี่ยนสีทันที ไม่มีเฟด */
.action-btn.is-liked .action-btn__icon,
.action-btn.is-liked .action-btn__count {
  color: #e0413a;
}
.action-btn.is-saved .action-btn__icon,
.action-btn.is-saved .action-btn__count {
  color: var(--star);
}

/* ---------- Comment Modal: รายการคอมเมนต์ ---------- */
.comment-list {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.comment-item {
  font-size: 0.85rem;
  line-height: 1.5;
  background: var(--border-soft);
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text-main);
}
.comment-item__author {
  font-weight: 700;
  margin-right: 6px;
  color: var(--accent-strong);
}

.comment-item__row {
  margin-bottom: 4px;
}

/* แถวปุ่ม "ตอบกลับ" + เมนูจุดสามจุด (ลบ) ใต้คอมเมนต์แต่ละอัน */
.comment-item__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.comment-item__reply-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--accent-strong);
}
.comment-item__reply-btn:hover {
  text-decoration: underline;
}

/* ---------- เมนูจุดสามจุด (⋮) ของคอมเมนต์ (ตอนนี้มีแค่ "ลบ" ข้างใน) ---------- */
.comment-item__menu-wrap {
  position: relative;
}
.comment-item__menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}
.comment-item__menu-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-main);
}

.comment-item__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 120px;
  background: var(--bg-panel);
  border-radius: 8px;
  box-shadow: 0 10px 24px var(--bg-card-shadow);
  padding: 4px;
  z-index: 10;

  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.comment-item__menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.comment-item__menu-item {
  display: block;
  width: 100%;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: left;
  padding: 7px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
}
.comment-item__menu-item:hover {
  background: var(--border-soft);
}
.comment-item__menu-item--danger {
  color: #c0392b;
}
.comment-item__menu-item--danger:hover {
  background: rgba(192, 57, 43, 0.1);
}

/* รายการคำตอบกลับที่ซ้อนอยู่ใต้ node แม่ เยื้องเข้ามาให้เห็นความเป็นลำดับชั้น
   (ซ้อนได้ไม่จำกัดชั้นในข้อมูล แต่จำกัดการเยื้อง "ทางสายตา" ไว้แค่ 3 ชั้นด้านล่าง) */
.comment-replies {
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* จำกัดความลึกของการเยื้อง (Indent) ไว้แค่ 3 ชั้น กันไม่ให้กล่องคอมเมนต์แคบลงเรื่อยๆ จนอ่าน
   ไม่ไหวเวลาตอบกลับกันลึกๆ (เหมือนที่ Facebook/Reddit ทำ) - ตอบกลับที่ลึกเกิน 3 ชั้น จะไม่เยื้อง
   เพิ่มอีกต่อไปเลย (Padding/เส้นแบ่งเป็น 0 หมด) ความกว้างจะ "คงที่" นับจากชั้นที่ 4 เป็นต้นไป
   ไม่ลดต่อ (เส้นแบ่งของชั้นที่ 1-3 ที่ยังอยู่ก็บอกอยู่แล้วว่าโซนนี้ทั้งหมดคือคำตอบกลับซ้อนกัน)
   Selector นี้จับ .comment-replies ที่มี .comment-replies เป็นบรรพบุรุษอย่างน้อย 3 ชั้นขึ้นไป
   (ชั้นที่ 4 เป็นต้นไปทั้งหมดโดนจับด้วย เพราะ Descendant Selector จับได้ลึกเกินกว่าที่ระบุไว้ด้วย) */
.comment-replies .comment-replies .comment-replies .comment-replies {
  padding-left: 0;
  border-left: none;
  margin-top: 8px;
}
/* .comment-item เองก็มี padding ซ้าย-ขวาของตัวเอง ซึ่งพอซ้อนกันไปเรื่อยๆ ก็ยังบีบแคบต่อไปได้อีก
   แม้จะคุม .comment-replies ให้เยื้องคงที่แล้วก็ตาม เพราะ "ค่า padding เท่าไหร่ก็ตามที่ไม่ใช่ 0"
   ยังคงหักลบความกว้างที่ส่งต่อไปให้ชั้นถัดไปอยู่ดี (สะสมไปเรื่อยๆ) ต้องตัดเหลือ 0 จริงๆ
   ถึงจะหยุดแคบลงสนิท เลยคงไว้แค่ Padding แนวตั้ง (บน-ล่าง) ให้มีระยะห่างพอดูอ่านง่าย
   ส่วนแนวนอน (ซ้าย-ขวา) ตัดออกจากชั้นที่ 4 เป็นต้นไปทั้งหมด ให้ความกว้าง "คงที่" ไม่ลดต่อ */
.comment-replies .comment-replies .comment-replies .comment-replies .comment-item {
  padding: 8px 0;
}

/* ฟอร์มพิมพ์ข้อความตอบกลับ: ซ่อนไว้ก่อน กด "ตอบกลับ" ค่อยกางลงมา (Accordion) */
.reply-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 0;
  overflow: hidden;
  margin-top: 0;
  transition: max-height 0.2s ease, margin-top 0.2s ease;
}
.reply-form.is-open {
  max-height: 90px;
  margin-top: 8px;
}
.reply-form__row {
  display: flex;
  gap: 6px;
}

/* dropdown จำลองตัวตนผู้ตอบกลับ (สำหรับทดสอบลอจิกแจ้งเตือนในเดโม่นี้เท่านั้น) */
.reply-form__persona {
  font-family: inherit;
  font-size: 0.72rem;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: #fff;
  color: var(--text-soft);
}

.reply-form__input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 0.8rem;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: #fff;
  color: var(--text-main);
}
.reply-form__input:focus {
  outline: 2px solid var(--accent);
}
.reply-form__submit-btn {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0 14px;
  border: none;
  border-radius: 8px;
  background: var(--accent-strong);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.reply-form__submit-btn:hover {
  filter: brightness(1.06);
}

.comment-empty {
  font-size: 0.8rem;
  color: var(--text-soft);
  text-align: center;
  padding: 12px 0;
}

/* =========================================================
   4.7) BOOK CATALOG PAGE (book.html) - คลังหนังสือแบ่งตามหมวดหมู่
   ========================================================= */
.library-main {
  padding-top: 32px;
  padding-bottom: 60px;
}

/* ---------- แถบบนสุดของหน้า Book: ปุ่ม Filter (ซ้าย) + หัวข้อ (กลาง) ---------- */
.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  margin-bottom: 20px;
}

.filter-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--bg-panel);
  color: var(--text-main);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.filter-toggle-btn:hover {
  border-color: var(--accent-strong);
  color: var(--accent-strong);
}
.filter-toggle-btn__icon {
  font-size: 1rem;
}

.library-toolbar__spacer {
  width: 90px; /* กะให้พอๆ กับความกว้างปุ่ม Filter ฝั่งซ้าย เพื่อให้หัวข้อกลางจอจริงๆ */
  flex-shrink: 0;
}

.library-title {
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 2.2rem;
  color: var(--accent-strong);
  margin: 0;
}

/* แถบบอกว่ากำลังกรองด้วยแท็กอะไรอยู่ */
.library-active-filter {
  max-width: 1200px;
  margin: 0 auto 20px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.library-active-filter__label {
  font-size: 0.82rem;
  color: var(--text-soft);
}
.library-active-filter__clear-btn {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-strong);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.library-active-filter__clear-btn:hover {
  text-decoration: underline;
}

/* ---------- แผง Filter แท็กย่อย (สไลด์ออกจากฝั่งซ้าย) ---------- */
.filter-sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(40, 25, 45, 0.35);

  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}
.filter-sidebar-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.filter-sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: var(--bg-panel);
  box-shadow: 8px 0 30px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  padding: 20px;

  transform: translateX(-100%);
  transition: transform 0.25s ease;
}
.filter-sidebar-overlay.is-open .filter-sidebar {
  transform: translateX(0);
}

.filter-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.filter-sidebar__title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--accent-strong);
}
.filter-sidebar__close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--border-soft);
  color: var(--text-main);
  font-size: 0.9rem;
  cursor: pointer;
}
.filter-sidebar__close:hover {
  filter: brightness(0.95);
}

.filter-sidebar__hint {
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-bottom: 16px;
}

.filter-sidebar__tags {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  padding-bottom: 16px;
}

.filter-tag-btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.filter-tag-btn:hover {
  border-color: var(--accent-strong);
}
.filter-tag-btn.is-selected {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}

.filter-sidebar__next-btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--accent-strong);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: filter 0.15s ease;
}
.filter-sidebar__next-btn:hover {
  filter: brightness(1.06);
}

.library-shelves {
  display: flex;
  flex-direction: column;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.book-shelf__title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--accent-strong);
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-soft);
}

.book-shelf__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 24px;
}

.book-card__rating-number {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-soft);
  margin-left: 4px;
}

/* =========================================================
   4.8) BOOK DETAIL PAGE (book-detail.html) - รายละเอียด+รีวิวฉบับเต็ม
   ========================================================= */
.book-detail-main {
  padding-top: 32px;
  padding-bottom: 60px;
}

.book-detail {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.book-detail__back-link {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-strong);
  text-decoration: none;
  margin-bottom: 20px;
}
.book-detail__back-link:hover {
  text-decoration: underline;
}

.book-detail__not-found {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-main);
}
.book-detail__not-found .book-detail__back-link {
  margin-top: 16px;
  padding: 10px 20px;
  text-decoration: none;
}

.book-detail__top {
  display: flex;
  gap: 32px;
  background: var(--bg-panel);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 14px 30px var(--bg-card-shadow);
  margin-bottom: 24px;
}

.book-detail__cover {
  flex-shrink: 0;
  width: 220px;
  aspect-ratio: 3 / 4.4;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 22px var(--bg-card-shadow);
}
.book-detail__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-detail__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.book-detail__category-badge {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}

.book-detail__title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.9rem;
  color: var(--accent-strong);
  line-height: 1.2;
}

.book-detail__author {
  font-size: 0.9rem;
  color: var(--text-soft);
}

/* ป้ายเตือนเนื้อหา TW (Trigger Warning) - โทนอำพันอ่อนๆ เตือนชัดแต่ยังละมุนตาตามธีม */
.book-detail__tw {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fdf0dc;
  border: 1px solid #f0d3a3;
}
.book-detail__tw-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: #9a5b1f;
  flex-shrink: 0;
}
.book-detail__tw-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tw-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fbe4c6;
  color: #9a5b1f;
}

.book-detail__rating {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.book-detail__rating-display {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.book-detail__rating-stars {
  color: var(--star);
  font-size: 1.2rem;
  letter-spacing: 2px;
}
.book-detail__rating-number {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}
.book-detail__rating-count {
  font-size: 0.78rem;
  color: var(--text-soft);
}

/* ---------- Widget ให้คะแนนดาวแบบกดโหวตได้จริง ---------- */
.book-rating-widget__label {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.book-rating-widget__stars {
  display: flex;
  gap: 4px;
}
.book-rating-widget__star {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--border-soft);
  cursor: pointer;
  padding: 2px;
  transition: transform 0.1s ease;
}
.book-rating-widget__star:hover {
  transform: scale(1.15);
}
.book-rating-widget__star.is-filled,
.book-rating-widget__star.is-preview {
  color: var(--star);
}

.book-detail__synopsis {
  background: var(--bg-panel);
  border-radius: 16px;
  padding: 24px 28px;
  box-shadow: 0 14px 30px var(--bg-card-shadow);
  margin-bottom: 24px;
}

.book-detail__section-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--accent-strong);
  margin-bottom: 12px;
}

.book-detail__synopsis p {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-main);
}

.book-detail__comments {
  background: var(--bg-panel);
  border-radius: 16px;
  padding: 24px 28px;
  box-shadow: 0 14px 30px var(--bg-card-shadow);
}

/* =========================================================
   4.84) PROFILE PAGE (profile.html)
   ========================================================= */
.profile-main {
  padding-top: 32px;
  padding-bottom: 60px;
}

.profile-card {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0 auto 0;
  padding: 0 24px;
}

.profile-card__inner {
  position: relative;
  background: var(--bg-panel);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 14px 30px var(--bg-card-shadow);
  overflow: hidden;
}

/* แถบ Banner ด้านบนสุด (ตอนนี้เป็นข้อความ Placeholder ไปก่อน ทีหลังเปลี่ยนเป็นรูปภาพ Cover ได้) */
.profile-card__banner {
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border-soft);
  font-family: 'Cormorant Garamond', serif;
  font-weight: 800;
  font-size: 1.7rem;
  letter-spacing: 2px;
  color: var(--text-soft);
  text-transform: uppercase;
}

/* ปุ่มจำลองมุมมองผู้เข้าชม (Mock Viewer) - ไว้ทดสอบระบบ Privacy โดยไม่ต้องมีระบบ Login จริง */
.profile-mock-viewer-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--bg-panel);
  color: var(--text-main);
  cursor: pointer;
  max-width: 190px;
  text-align: right;
  z-index: 2;
}
.profile-mock-viewer-btn:hover {
  border-color: var(--accent-strong);
}
.profile-mock-viewer-btn.is-visitor {
  background: rgba(192, 57, 43, 0.12);
  border-color: rgba(192, 57, 43, 0.35);
  color: #c0392b;
}

/* เมนูจุดสามจุด (⋯) มุมบนขวาของกล่องโปรไฟล์ - โผล่เฉพาะตอนดูโปรไฟล์ "คนอื่น" เท่านั้น */
.profile-card__menu-wrap {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
}
.profile-card__menu-btn {
  width: 32px;
  height: 32px;
  background: var(--bg-panel);
  font-size: 1.2rem;
  box-shadow: 0 4px 10px var(--bg-card-shadow);
}

/* ปุ่ม Follow ตัวใหญ่บนโปรไฟล์คนอื่น เห็นชัดเจนตามที่ขอ */
.profile-card__follow-btn-lg {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}
.profile-card__follow-btn-lg:hover {
  filter: brightness(1.06);
}
.profile-card__follow-btn-lg.is-following {
  background: transparent;
  color: var(--accent-strong);
}
.profile-card__follow-btn-lg.is-following:hover {
  background: rgba(192, 57, 43, 0.08);
  border-color: #c0392b;
  color: #c0392b;
}

/* แถวบน: Avatar ซ้อนทับขอบล่างของ Banner + ชื่อ/username + ปุ่ม Edit ชิดขวา */
.profile-card__top-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 0 24px;
  margin-top: -38px;
}

.profile-card__identity {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  min-width: 0;
}

.profile-card__avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-panel);
  background: var(--border-soft);
  display: block;
  flex-shrink: 0;
}

.profile-card__names {
  padding-bottom: 6px;
  min-width: 0;
}

.profile-card__name {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--accent-strong);
  line-height: 1.25;
}

.profile-card__username {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.profile-card__edit-btn {
  flex-shrink: 0;
  margin-bottom: 8px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--bg-panel);
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.profile-card__edit-btn:hover {
  border-color: var(--accent-strong);
  color: var(--accent-strong);
}

/* แถวล่าง: Following/Followers + fav novel/genre ฝั่งซ้าย, Bio ฝั่งขวา */
.profile-card__details {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 18px 24px 24px;
  background: var(--page-bg-color);
}

.profile-card__stats {
  display: flex;
  gap: 24px;
  flex-shrink: 0;
}
.profile-card__stat {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-soft);
  background: none;
  border: none;
  font-family: inherit;
  cursor: default;
}
.profile-card__stat--clickable {
  cursor: pointer;
  border-radius: 8px;
  padding: 2px 6px;
  transition: background-color 0.15s ease;
}
.profile-card__stat--clickable:hover {
  background: var(--border-soft);
}
.profile-card__stat strong {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.profile-card__meta-list {
  flex-shrink: 0;
  margin-top: 14px;
  font-size: 0.82rem;
  line-height: 1.8;
  color: var(--text-main);
}
.profile-card__meta-list strong {
  font-weight: 700;
  color: var(--accent-strong);
}

.profile-card__bio {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-main);
}

/* ---------- แท็บ Notes / Likes / Save ---------- */
/* ครอบ .profile-tabs ด้วย wrapper ที่ใช้ padding แบบเดียวกับ .profile-card เป๊ะๆ
   เพื่อให้แถบชมพูกว้างเท่ากับการ์ดโปรไฟล์ด้านบนจริงๆ (ไม่ใช่แค่ max-width เดียวกันเฉยๆ) */
.profile-tabs-wrap {
  max-width: 700px;
  margin: 0 auto 20px;
  padding: 0 24px;
}
.profile-tabs {
  display: flex;
  justify-content: flex-start;
  gap: 28px;
  padding: 14px 20px;
  background: var(--bg-navbar);
  border-radius: 0 0 16px 16px;
  box-shadow: 0 14px 30px var(--bg-card-shadow);
}
.profile-tab-btn {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 700;
  padding: 0 0 4px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-soft);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.profile-tab-btn:hover {
  color: var(--accent-strong);
}
.profile-tab-btn.is-active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent-strong);
}

.profile-tab-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 24px auto 0;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- Toggle สวิตช์ความเป็นส่วนตัวในฟอร์ม Edit Profile ---------- */
.privacy-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.privacy-toggle-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.privacy-toggle-track {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--border-soft);
  flex-shrink: 0;
  transition: background-color 0.2s ease;
}
.privacy-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}
.privacy-toggle-checkbox:checked + .privacy-toggle-track {
  background: var(--accent-strong);
}
.privacy-toggle-checkbox:checked + .privacy-toggle-track .privacy-toggle-thumb {
  transform: translateX(18px);
}
.privacy-toggle-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}
.privacy-toggle-hint {
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-top: -8px;
}

/* =========================================================
   ADMIN PANEL (admin.html)
   ========================================================= */
.admin-main {
  padding-top: 32px;
  padding-bottom: 60px;
  max-width: 820px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.admin-section {
  background: var(--bg-panel);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 14px 30px var(--bg-card-shadow);
  margin-bottom: 24px;
}
.admin-section__title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--accent-strong);
  margin-bottom: 6px;
}
.admin-section__hint {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-bottom: 16px;
}

/* ---------- รายการหนังสือรออนุมัติ ---------- */
.admin-shelf-search {
  margin-bottom: 16px;
}

.admin-pending-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.admin-pending-item {
  display: flex;
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
  background: var(--border-soft);
}
.admin-pending-item__cover {
  width: 60px;
  height: 88px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  box-shadow: 0 6px 14px var(--bg-card-shadow);
}
.admin-pending-item__info {
  flex: 1;
  min-width: 0;
}
.admin-pending-item__name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 2px;
}
.admin-pending-item__meta {
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-bottom: 8px;
}
.admin-pending-item__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  justify-content: center;
}
.admin-pending-item__actions button {
  white-space: nowrap;
  font-size: 0.8rem;
  padding: 8px 16px;
}

/* ---------- Report Dashboard ---------- */
.admin-reports-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin-report-item {
  padding: 14px;
  border-radius: 12px;
  background: var(--border-soft);
}
.admin-report-item__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.85rem;
  margin-bottom: 6px;
}
.admin-report-item__reporter,
.admin-report-item__reported {
  font-weight: 700;
  color: var(--accent-strong);
}
.admin-report-item__type-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}
.admin-report-item__reason {
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 6px;
}
.admin-report-item__meta {
  font-size: 0.72rem;
  color: var(--text-soft);
}
.admin-report-item__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.admin-report-item__view-btn {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-strong);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent-strong);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.admin-report-item__view-btn:hover {
  background: var(--accent-strong);
  color: #fff;
}

.admin-report-item__buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-report-item__ban-btn,
.admin-report-item__delete-btn {
  flex-shrink: 0;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.admin-report-item__ban-btn {
  background: none;
  border: 1px solid #c0392b;
  color: #c0392b;
}
.admin-report-item__ban-btn:hover {
  background: #c0392b;
  color: #fff;
}

.admin-report-item__delete-btn {
  background: none;
  border: 1px solid var(--border-soft);
  color: var(--text-soft);
}
.admin-report-item__delete-btn:hover {
  background: var(--border-soft);
  color: var(--text-main);
}

/* ---------- จัดการคลังแท็ก/TW ---------- */
.admin-tag-manager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.admin-tag-manager__col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-tag-add-row {
  display: flex;
  gap: 8px;
}
.admin-tag-add-row .form-text-input {
  flex: 1;
  min-width: 0;
}
.admin-tag-add-row .modal-submit-btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 10px 14px;
}

/* ---------- จัดการลายโฟลเดอร์ (Admin Panel) ---------- */
.admin-folder-pattern-list {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}
.admin-folder-pattern-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-radius: 12px;
  background: var(--border-soft);
  width: 96px;
}
.admin-folder-pattern-item__name {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.admin-folder-pattern-item__delete-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--bg-panel);
  color: #c0392b;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 8px var(--bg-card-shadow);
}
.admin-folder-pattern-item__delete-btn:hover {
  background: #c0392b;
  color: #fff;
}

.admin-folder-pattern-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  border-radius: 12px;
  background: var(--border-soft);
}
.admin-folder-pattern-form__colors {
  display: flex;
  gap: 20px;
}
.admin-folder-pattern-form__colors input[type="color"] {
  width: 56px;
  height: 36px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--bg-panel);
  cursor: pointer;
}

/* =========================================================
   4.85) HISTORY PAGE (history.html) - ประวัติการเข้าชมนิยาย
   ========================================================= */
.history-main {
  padding-top: 32px;
  padding-bottom: 60px;
}

.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 700px;
  margin: 0 auto 24px;
  padding: 0 24px;
}

.history-clear-btn {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: #c0392b;
  background: none;
  border: 1px solid rgba(192, 57, 43, 0.35);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.history-clear-btn:hover {
  background: rgba(192, 57, 43, 0.1);
}

.history-tabs {
  display: flex;
  gap: 8px;
  max-width: 700px;
  margin: 0 auto 20px;
  padding: 0 24px;
}
.history-tab-btn {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--bg-panel);
  color: var(--text-main);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.history-tab-btn:hover {
  border-color: var(--accent-strong);
}
.history-tab-btn.is-active {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}

/* ---------- รายการ Blocked Users / Hidden Posts (หน้า blocked-hidden.html) ---------- */
.bh-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--bg-panel);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 10px 24px var(--bg-card-shadow);
}
.bh-item__info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.bh-item__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  flex-shrink: 0;
}
.bh-item__cover {
  width: 44px;
  height: 64px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 6px 14px var(--bg-card-shadow);
}
.bh-item__text {
  min-width: 0;
}
.bh-item__name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
}
.bh-item__sub {
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-top: 2px;
}
.bh-item__badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
}
.bh-item__badge--blocked {
  background: #c0392b;
  color: #fff;
}
.bh-item__badge--hidden {
  background: var(--accent);
  color: #fff;
}
.bh-item__action-btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--accent-strong);
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.bh-item__action-btn:hover {
  background: var(--accent-strong);
  color: #fff;
}

.history-list {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-panel);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 24px var(--bg-card-shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease;
}
.history-item:hover {
  transform: translateY(-2px);
}

.history-item__cover {
  width: 56px;
  height: 82px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 6px 14px var(--bg-card-shadow);
}
.history-item__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.history-item__info {
  min-width: 0;
  flex: 1;
}
.history-item__name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 4px;
}
.history-item__time {
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.history-item__rating {
  font-size: 0.85rem;
  color: var(--star);
  letter-spacing: 1px;
}
.history-item__rating--none {
  font-size: 0.78rem;
  color: var(--text-soft);
  font-style: italic;
}

/* =========================================================
   4.9) FLOATING ACTION BUTTON + CREATE POST MODAL (หน้า Explore)
   ========================================================= */
.fab-create-post {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 900;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent-strong);
  color: #fff;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 24px var(--bg-card-shadow);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.fab-create-post:hover {
  transform: translateY(-3px) scale(1.05);
  filter: brightness(1.06);
}
.fab-create-post:active {
  transform: translateY(0) scale(0.97);
}

/* ---------- ข้อความ "ไม่พบนิยาย -> Add Book" ---------- */
.create-post__not-found {
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-top: 6px;
}
.create-post__not-found a {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}
.create-post__not-found a:hover {
  text-decoration: underline;
}

/* ---------- พรีวิวปกนิยายที่เลือกจากรายการค้นหา ---------- */
.create-post__preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  background: var(--border-soft);
}
.create-post__preview img {
  width: 52px;
  height: 76px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  box-shadow: 0 6px 14px var(--bg-card-shadow);
}
.create-post__preview-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.create-post__preview-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
}
.create-post__preview-clear {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-strong);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.create-post__preview-clear:hover {
  text-decoration: underline;
}

/* รายการแนะนำนิยายในช่องค้นหา ใช้เค้าโครงคล้าย tag-suggestion แต่โชว์ปกเล็กๆ ด้วย */
.novel-suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 8px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
}
.novel-suggestion-item:hover {
  background: var(--border-soft);
}
.novel-suggestion-item img {
  width: 28px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ---------- รีวิวจากผู้อ่าน (ดึงจาก reviews[] ในหน้า Explore) ---------- */
.reader-review {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--border-soft);
}
.reader-review:last-child {
  border-bottom: none;
}

.reader-review__avatar-link {
  flex-shrink: 0;
  display: block;
  border-radius: 50%;
  transition: transform 0.15s ease;
}
.reader-review__avatar-link:hover {
  transform: scale(1.06);
}

.reader-review__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  display: block;
}

.reader-review__body {
  min-width: 0;
  flex: 1;
}

.reader-review__username {
  display: inline-block;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-main);
  text-decoration: none;
  margin-bottom: 4px;
}
.reader-review__username:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

/* คลิกส่วนนี้ (ดาว+ข้อความรีวิว) -> เด้งไปโพสต์จริงในหน้า Explore */
.reader-review__content-link {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  margin: 0 -8px;
  padding: 4px 8px;
  transition: background-color 0.15s ease;
}
.reader-review__content-link:hover {
  background: var(--border-soft);
}

.reader-review__stars {
  color: var(--star);
  font-size: 0.95rem;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.reader-review__text {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-main);
}

/* =========================================================
   5) ของตกแต่งลอยหน้าสุด (ต้องอยู่ชั้นบนสุดของเว็บเสมอ)
   ========================================================= */
.floating-decor {
  position: fixed;
  inset: 0;
  z-index: 9999;      /* สูงกว่าทุกอย่างในหน้า รวมถึง navbar (500) และ dropdown */
  pointer-events: none; /* ไม่บังการคลิกของปุ่ม/เมนูที่อยู่ข้างใต้ */
}

.decor-item {
  position: absolute;
  /* Responsive Scaling: ปรับขนาดลื่นไหลตามความกว้างจอ ใหญ่สุด ~2.2rem เล็กสุด ~1.1rem */
  font-size: clamp(1.1rem, 2.6vw, 2.2rem);
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.15));
}

/* โชว์/ซ่อนชุดของตกแต่งตามธีมที่เลือกอยู่ */
body[data-theme="angel"] .decor-apple { display: none; }
body[data-theme="apple"] .decor-angel { display: none; }

/* ตำแหน่งของตกแต่งธีมปีกเทวดา (ขนาดอ้างอิงที่ font-size ใหญ่สุด/เล็กสุดต่างกันเล็กน้อยต่อชิ้น) */
.decor-angel--bow-1  { top: 18%;  left: 3%; }
.decor-angel--note-1 { top: 30%;  left: 8%;  font-size: clamp(1.3rem, 3vw, 2.6rem); }
.decor-angel--bow-2  { bottom: 6%; right: 4%; }
.decor-angel--note-2 { bottom: 16%; right: 9%; font-size: clamp(1.4rem, 3.2vw, 2.8rem); }

/* ตำแหน่งของตกแต่งธีมแอปเปิ้ล */
.decor-apple--fruit-1 { top: 20%; left: 4%; }
.decor-apple--house-1 { bottom: 8%; left: 6%; font-size: clamp(1.3rem, 3vw, 2.6rem); }
.decor-apple--fruit-2 { bottom: 14%; right: 5%; }

/* =========================================================
   6) HERO BAND
   ========================================================= */
.hero-band {
  height: 130px;
  background: var(--bg-hero);
}

/* =========================================================
   7) BOOK OF THE MONTH
   ========================================================= */
.botm {
  position: relative;
  max-width: 1200px;
  margin: -40px auto 80px;
  padding: 0 24px;
}

.botm__title {
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 2.2rem;
  color: var(--accent-strong); /* Fix ตายตัวกับธีม เปลี่ยนทันทีไม่มีเฟด */
  margin-bottom: 28px;
}

.botm__panel {
  position: relative;
  background: var(--bg-panel);
  border-radius: 4px;
  padding: 48px 56px;
  box-shadow: 0 20px 40px var(--bg-card-shadow);
}

.botm__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 28px;
}

.book-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: inherit;
}

.book-card__cover {
  width: 100%;
  aspect-ratio: 3 / 4.4;
  border-radius: 4px;
  overflow: hidden;
  background: var(--border-soft);
  margin-bottom: 12px;
  box-shadow: 0 8px 18px var(--bg-card-shadow);
  transition: transform 0.15s ease;
}
.book-card:hover .book-card__cover {
  transform: translateY(-4px);
}

.book-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-card__name {
  font-size: 0.75rem;
  letter-spacing: 1.5px;
  color: var(--text-soft);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.book-card__stars {
  color: var(--star);
  font-size: 1rem;
  letter-spacing: 2px;
}

/* =========================================================
   8) RESPONSIVE
   ========================================================= */
@media (max-width: 1024px) {
  .botm__grid {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 36px;
  }
  .navbar {
    padding: 16px 28px;
  }
  .navbar__menu {
    gap: 22px;
  }
}

/* =========================================================
   REVIEW ALBUMS / FOLDERS (แท็บ Notes ในหน้า Profile + ป๊อปอัปเพิ่มเข้าอัลบั้ม)
   ========================================================= */

/* ---------- ตัวไอคอนโฟลเดอร์ (ใช้ร่วมกันทั้งใน Notes tab และตัวเลือกลายตอนสร้างโฟลเดอร์) ---------- */
.folder-icon {
  display: inline-block;
  position: relative;
  width: 108px;
  height: 84px;
  flex-shrink: 0;
}
.folder-icon--sm {
  width: 52px;
  height: 40px;
  cursor: pointer;
}
.folder-icon__tab {
  position: absolute;
  top: 0;
  left: 6%;
  width: 42%;
  height: 20%;
  border-radius: 8px 8px 0 0;
}
.folder-icon--sm .folder-icon__tab {
  border-radius: 4px 4px 0 0;
}
.folder-icon__body {
  position: absolute;
  top: 15%;
  left: 0;
  width: 100%;
  height: 85%;
  border-radius: 4px 14px 14px 14px;
  overflow: hidden;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}
.folder-icon--sm .folder-icon__body {
  border-radius: 2px 7px 7px 7px;
  box-shadow: 0 3px 7px rgba(0, 0, 0, 0.12);
}

/* ---------- ลายโฟลเดอร์: ใช้ CSS Variable (--folder-color / --folder-accent) ที่ตั้งผ่าน
   inline style ตอน Render แทนคลาสตายตัว เพื่อให้แอดมินเพิ่มลายสีใหม่ๆ เองได้ไม่จำกัด
   (ทรงพื้นฐานมี 4 แบบ: dots / stripe-v / solid / stripe-h กำหนดผ่าน data-pattern-type) ---------- */
.folder-icon__tab,
.folder-icon__body {
  background-color: var(--folder-color, #e3e3e3);
}

.folder-icon[data-pattern-type="dots"] .folder-icon__body {
  background-image: radial-gradient(var(--folder-accent, #999) 1.5px, transparent 1.5px);
  background-size: 12px 12px;
}

.folder-icon[data-pattern-type="stripe-v"] .folder-icon__body {
  background-image: repeating-linear-gradient(90deg, var(--folder-accent, #999), var(--folder-accent, #999) 6px, var(--folder-color, #eee) 6px, var(--folder-color, #eee) 14px);
}

.folder-icon[data-pattern-type="stripe-h"] .folder-icon__body {
  background-image: repeating-linear-gradient(0deg, var(--folder-accent, #999), var(--folder-accent, #999) 6px, var(--folder-color, #eee) 6px, var(--folder-color, #eee) 14px);
}

/* solid ไม่ต้องมี background-image เพิ่ม ใช้แค่ --folder-color เป็นพื้นเรียบๆ พอ */

/* ---------- Grid โฟลเดอร์ในแท็บ Notes ---------- */
.notes-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 28px 16px;
  padding: 6px 0 10px;
}

/* รีวิวทั้งหมดของเจ้าของบัญชี ต่อท้ายใต้ Grid โฟลเดอร์ (ฟอร์แมตเดียวกับหน้า Explore) */
.notes-all-reviews {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-soft);
}
.notes-all-reviews__title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent-strong);
  margin-bottom: 4px;
}

.notes-folder-item {
  position: relative;
}
.notes-folder-item__open-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.notes-folder-item__open-btn:hover {
  transform: translateY(-3px);
}
.notes-folder-item__name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
  max-width: 108px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-folder-item__count {
  font-size: 0.7rem;
  color: var(--text-soft);
  font-weight: 600;
}

/* ปุ่ม ✕ ลบโฟลเดอร์ มุมขวาบนของแต่ละไอคอน */
.notes-folder-item__delete-btn {
  position: absolute;
  top: -6px;
  right: 6px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--bg-panel);
  color: #c0392b;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 8px var(--bg-card-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.notes-folder-item:hover .notes-folder-item__delete-btn {
  opacity: 1;
}
.notes-folder-item__delete-btn:hover {
  background: #c0392b;
  color: #fff;
}

/* ปุ่มโฟลเดอร์ใหม่ ในตัว Grid เอง (ให้กดสร้างจากตรงนี้ได้เลยด้วย ไม่ต้องผ่าน Modal เพิ่มเข้าอัลบั้มก่อน) */
.notes-folder-item--new .folder-icon__body,
.notes-folder-item--new .folder-icon__tab {
  background: var(--border-soft);
}
.notes-folder-item--new .folder-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.notes-folder-item--new .folder-icon__plus {
  position: relative;
  z-index: 1;
  font-size: 1.8rem;
  font-weight: 300;
  color: var(--accent-strong);
}

/* ---------- มุมมองข้างในโฟลเดอร์ (คลิกแล้วคลี่มาโชว์โพสต์) ---------- */
.notes-folder-detail__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.notes-folder-detail__back-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-strong);
  background: none;
  border: 1px solid var(--accent-strong);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.notes-folder-detail__back-btn:hover {
  background: var(--accent-strong);
  color: #fff;
}
.notes-folder-detail__title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--accent-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- ป๊อปอัปเพิ่มเข้าอัลบั้ม ---------- */
/* ---------- ป๊อปอัปรายชื่อ Following/Followers ---------- */
.follow-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}
.follow-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 12px;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.follow-list-item:hover {
  background: var(--border-soft);
}
.follow-list-item__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.follow-list-item__names {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.follow-list-item__name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.follow-list-item__username {
  font-size: 0.75rem;
  color: var(--text-soft);
}

.album-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 14px;
}
.album-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid var(--border-soft);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.album-list-item:hover {
  border-color: var(--accent-strong);
}
.album-list-item.is-selected {
  border-color: var(--accent-strong);
  background: var(--border-soft);
}
.album-list-item__name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.album-list-item__check {
  flex-shrink: 0;
  font-size: 1.1rem;
  color: var(--accent-strong);
  visibility: hidden;
}
.album-list-item.is-selected .album-list-item__check {
  visibility: visible;
}
.album-list__empty {
  font-size: 0.8rem;
  color: var(--text-soft);
  text-align: center;
  padding: 14px 0;
}

.album-create-toggle-btn {
  display: block;
  width: 100%;
  text-align: center;
  margin-bottom: 12px;
}

.album-create-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
  background: var(--border-soft);
  margin-bottom: 14px;
}

.folder-pattern-picker {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.folder-pattern-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.folder-pattern-option .folder-icon--sm {
  border-radius: 8px;
  transition: transform 0.15s ease, outline-color 0.15s ease;
  outline: 2px solid transparent;
  outline-offset: 3px;
}
.folder-pattern-option input:checked + .folder-icon--sm {
  outline-color: var(--accent-strong);
  transform: scale(1.08);
}

@media (max-width: 480px) {
  .notes-folder-grid {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 20px 12px;
  }
  .folder-icon {
    width: 80px;
    height: 62px;
  }
}

/* =========================================================
   LOGIN & REGISTER PAGE (login.html)
   ========================================================= */
.auth-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-panel);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 20px 44px var(--bg-card-shadow);
  text-align: center;
}

.auth-card__logo {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.9rem;
  color: var(--accent-strong);
  letter-spacing: 1px;
}

.auth-card__tagline {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-top: 4px;
  margin-bottom: 24px;
}

/* ---------- แท็บสลับ Login / Register ---------- */
.auth-tabs {
  display: flex;
  background: var(--border-soft);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tab-btn {
  flex: 1;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 9px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.auth-tab-btn.is-active {
  background: var(--bg-panel);
  color: var(--accent-strong);
  box-shadow: 0 4px 10px var(--bg-card-shadow);
}

/* ---------- ฟอร์ม (สลับไปมาแบบนุ่มนวลด้วย Fade+Slide) ---------- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
  animation: auth-form-fade-in 0.25s ease;
}
/* .auth-form { display:flex } มี specificity สูงกว่า [hidden] ของเบราว์เซอร์ ทำให้ฟอร์มที่ควร
   ถูกซ่อนไว้ยังโผล่มาด้วย (บั๊กที่เจอ) แก้โดยบังคับ display:none ทับตอนมี attribute hidden ชัดเจน */
.auth-form[hidden] {
  display: none;
}
@keyframes auth-form-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-submit-btn {
  margin-top: 4px;
  padding: 13px;
  font-size: 1rem;
}

.auth-error {
  font-size: 0.8rem;
  font-weight: 700;
  color: #c0392b;
  background: rgba(192, 57, 43, 0.08);
  border-radius: 8px;
  padding: 8px 12px;
  margin: -4px 0 0;
}

.auth-hint {
  font-size: 0.72rem;
  color: var(--text-soft);
  text-align: center;
  line-height: 1.6;
  margin-top: 4px;
}
.auth-hint strong {
  color: var(--accent-strong);
}

/* ปุ่มลิงก์ข้อความเปล่าๆ ในฟอร์ม Login เช่น "ลืมรหัสผ่าน?" / "ส่งลิงก์ยืนยันอีเมลอีกครั้ง" */
.auth-link-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--accent-strong);
  text-decoration: underline;
  cursor: pointer;
  text-align: center;
  padding: 4px 0;
  margin: 0 auto;
  display: block;
}
.auth-link-btn:hover {
  opacity: 0.75;
}

@media (max-width: 480px) {
  .auth-card {
    padding: 28px 22px;
    border-radius: 16px;
  }
  .auth-card__logo {
    font-size: 1.6rem;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 14px 12px;
    gap: 8px;
  }
  .navbar__logo {
    font-size: 1.15rem;
  }
  .navbar__actions {
    gap: 6px;
  }

  .admin-tag-manager {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .admin-pending-item {
    flex-wrap: wrap;
  }
  .admin-pending-item__actions {
    flex-direction: row;
    width: 100%;
  }
  .admin-pending-item__actions button {
    flex: 1;
  }

  .botm__panel {
    padding: 36px 24px;
  }

  .book-detail__top {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
  }
  .book-detail__cover {
    width: 180px;
  }
  .book-detail__info {
    align-items: center;
  }
  .book-detail__rating-display {
    justify-content: center;
    flex-wrap: wrap;
  }
  .book-rating-widget__stars {
    justify-content: center;
  }
  .book-shelf__grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
  }
  .book-detail__synopsis,
  .book-detail__comments {
    padding: 20px;
  }

  .hamburger {
    display: flex;
  }

  .navbar__menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start; /* กัน justify-content:center ของเดสก์ท็อปมาดันเมนูลอยตรงกลางจนบัง Home/Explore */
    gap: 0;
    background: var(--bg-navbar);
    max-height: 0;
    overflow: hidden;
  }
  .navbar__menu.is-open {
    max-height: 80vh; /* อิงตามความสูงจอจริง แทนค่าตายตัว 420px เดิม */
    overflow-y: auto; /* เลื่อนดูเนื้อหาที่เกินจอได้ (เช่นตอน More dropdown กางเต็มที่) */
    -webkit-overflow-scrolling: touch;
    padding: 8px 28px 20px;
  }
  .navbar__link {
    width: 100%;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .nav-underline {
    display: none; /* บนมือถือเมนูเรียงเป็นแนวตั้ง เส้นใต้แบบเลื่อนไม่จำเป็น */
  }
  .more-dropdown {
    position: static;
    width: 100%;
    max-width: none;
    max-height: none; /* ให้กล่องนอก (.navbar__menu) เป็นคนจัดการเลื่อนแทน กันเลื่อนซ้อนกัน 2 ชั้น */
    overflow-y: visible;
    box-shadow: none;
    padding: 6px 0 6px 10px;
  }

  .search-input {
    right: 0;
  }
  .search-wrap.is-open .search-input {
    width: 200px;
  }
  .nav-search-suggestions {
    top: calc(100% + 26px);
  }

  .notif-dropdown {
    width: min(300px, calc(100vw - 32px));
  }
}

@media (max-width: 480px) {
  .botm__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }
  .library-toolbar {
    padding: 0 16px;
  }
  .library-toolbar__spacer {
    display: none;
  }
  .library-title {
    font-size: 1.6rem;
  }
  .filter-toggle-btn {
    padding: 7px 12px;
    font-size: 0.78rem;
  }
  .filter-sidebar {
    width: 260px;
  }
  .navbar {
    padding: 12px 8px;
    gap: 4px;
  }
  .navbar__logo {
    font-size: 0.95rem;
  }
  .navbar__actions {
    gap: 3px;
  }
  .icon-btn,
  .profile-avatar,
  .hamburger {
    width: 28px;
    height: 28px;
  }
  .botm__title {
    font-size: 1.6rem;
  }
  .botm__panel {
    padding: 28px 16px;
  }
  .modal-box {
    padding: 24px 20px;
  }

  .review-card {
    padding: 16px;
  }
  .review-card__cover-link {
    width: 72px;
  }
  .feed {
    padding: 0 12px;
  }
  .review-card__actions {
    gap: 18px;
  }
}
