/* ============================================================
   public.css — ธีมเว็บไซต์หน้าบ้าน ระบบห้องสมุดวิทยาลัยบัณฑิตเอเซีย
   ============================================================ */
:root {
  --brand-primary: #0b3d91;
  --brand-secondary: #f59e0b;
}

body { font-family: 'Kanit', 'Segoe UI', sans-serif; color: #1f2937; background: #fff; }
a { text-decoration: none; }

.top-strip { font-size: .85rem; }
.top-strip-link { text-decoration: none; }

/* -------- Navbar -------- */
.public-navbar { background: #fff; box-shadow: 0 2px 14px rgba(15,23,42,.08); padding: .6rem 0; }
.public-navbar .navbar-brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--brand-primary); font-size: 1.15rem; }
.public-navbar .navbar-brand i { font-size: 1.6rem; color: var(--brand-secondary); }
.brand-logo { height: 38px; width: auto; border-radius: 6px; }
.public-navbar .nav-link { font-weight: 500; color: #374151 !important; padding: .5rem .85rem !important; white-space: nowrap; }
.public-navbar .nav-link:hover { color: var(--brand-primary) !important; }
.nav-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid var(--brand-secondary); }

/* -------- เมนูย่อย (dropdown): เปิดเมื่อชี้เมาส์ (hover) แทนการคลิก บนหน้าจอขนาดใหญ่ -------- */
@media (min-width: 992px) {
  /* ไม่ใช้ margin-top เว้นระยะห่างจากเมนูหลัก เพราะจะเกิดช่องว่างที่เมาส์ "หลุด" ออกจากโซน hover
     ระหว่างเลื่อนจากเมนูหลักลงมายังเมนูย่อย ทำให้เมนูปิดตัวไปก่อนคลิกทัน — ใช้ padding-top แทนแทน
     (padding อยู่ในกรอบของ .dropdown-menu เอง เมาส์ยังอยู่ในโซน hover ตลอดขณะเลื่อนผ่าน) */
  .public-navbar .dropdown > .dropdown-menu {
    margin-top: 0;
    padding-top: .6rem;
    animation: navDropdownFade .15s ease;
  }
  .public-navbar .dropdown > .dropdown-menu.show { display: none; }
  .public-navbar .dropdown:hover > .dropdown-menu { display: block; }
  /* เผื่อกรณีเมาส์เลื่อนผ่านช่องว่างเล็กๆ ระหว่างตัวลิงก์เมนูหลักกับกรอบเมนูย่อยจริงๆ (ก่อนนับ padding)
     เพิ่มพื้นที่มองไม่เห็นคลุมช่องว่างนั้นไว้ด้วย กันหลุด hover ระหว่างทาง */
  .public-navbar .dropdown > .dropdown-menu::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
  }
}
@keyframes navDropdownFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* มือถือ/แท็บเล็ต (เมนูแบบแฮมเบอร์เกอร์): กางเมนูย่อยเป็นรายการซ้อนให้เห็นเลยเมื่อเปิดเมนูหลัก ไม่ต้องกดเปิดซ้ำอีกชั้น */
@media (max-width: 991.98px) {
  .public-navbar .dropdown-menu { display: block; position: static; box-shadow: none; border: none; padding-left: 1rem; background: transparent; }
}
.btn-brand-outline { border: 1.5px solid var(--brand-primary); color: var(--brand-primary); border-radius: 50px; padding: .35rem 1.1rem; font-weight: 500; white-space: nowrap; }
.btn-brand-outline:hover { background: var(--brand-primary); color: #fff; }
.public-navbar .nav-actions { flex-shrink: 0; white-space: nowrap; }
.public-navbar .nav-actions > * { flex-shrink: 0; }
.btn-brand { background: var(--brand-primary); color: #fff; border-radius: 50px; padding: .55rem 1.5rem; font-weight: 500; border: none; }
.btn-brand:hover { filter: brightness(1.12); color: #fff; background-color: var(--brand-primary); }

/* -------- Hero slider -------- */
.hero-slider { position: relative; }
.hero-slide {
  min-height: 420px; display: flex; align-items: center;
  background-size: cover; background-position: center;
  position: relative;
}
.hero-slide::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(11,61,145,.88) 0%, rgba(11,61,145,.35) 60%, rgba(11,61,145,.1) 100%);
}
.hero-slide-content { position: relative; z-index: 2; color: #fff; max-width: 640px; }
.hero-slide-content h2 { font-size: 2.2rem; font-weight: 700; margin-bottom: .75rem; }
.hero-slide-content p { font-size: 1.05rem; opacity: .92; }
.hero-no-banner {
  min-height: 340px; display: flex; align-items: center; justify-content: center; text-align: center;
  background: linear-gradient(120deg, var(--brand-primary), #17469e);
  color: #fff;
}

/* -------- Sections -------- */
.section-title { font-weight: 700; font-size: 1.6rem; color: var(--brand-primary); margin-bottom: .3rem; }
.section-sub { color: #6b7280; margin-bottom: 2rem; }
.section-py { padding: 3.5rem 0; }
.bg-soft { background: #f6f8fc; }

/* -------- แถบหัวข้อหน้า (Page Hero): พื้นหลังไล่สีสองโทนแนวนอนตามสีแบรนด์ ใช้กับหัวข้อของแต่ละหน้า (บุคลากร/ข่าวสาร/แกลเลอรี่/ค้นหาหนังสือ ฯลฯ) -------- */
.page-hero {
  background: linear-gradient(110deg, var(--brand-secondary) 0%, var(--brand-secondary) 38%, var(--brand-primary) 62%, var(--brand-primary) 100%);
  padding: 2.75rem 0;
}
.page-hero .section-title { color: #fff; margin-bottom: .25rem; }
.page-hero .section-sub { color: rgba(255,255,255,.85); margin-bottom: 0; }

/* -------- Category chips -------- */
.chip { display: inline-block; padding: .45rem 1.1rem; border-radius: 50px; font-size: .88rem; font-weight: 500; border: 1.5px solid #e5e7eb; color: #374151; transition: .15s; margin: 0 .3rem .5rem 0; }
.chip:hover, .chip.active { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }

/* -------- Book cards -------- */
.book-card { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 2px 12px rgba(15,23,42,.07); transition: transform .18s, box-shadow .18s; height: 100%; border: 1px solid #f0f1f5; }
.book-card:hover { transform: translateY(-5px); box-shadow: 0 10px 24px rgba(15,23,42,.14); }
.book-cover { aspect-ratio: 3/4; width: 100%; object-fit: cover; background: linear-gradient(135deg,#e5e7eb,#f3f4f6); }
.book-card-body { padding: .9rem 1rem 1.1rem; }
.book-title { font-weight: 600; font-size: .95rem; color: #1f2937; margin-bottom: .2rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.book-author { font-size: .82rem; color: #6b7280; }
.book-status-badge { font-size: .72rem; }

/* -------- News cards -------- */
.news-card { border-radius: 14px; overflow: hidden; box-shadow: 0 2px 12px rgba(15,23,42,.07); height: 100%; background: #fff; border: 1px solid #f0f1f5; }
.news-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.news-card-body { padding: 1.1rem 1.2rem; }
.news-date { font-size: .78rem; color: var(--brand-secondary); font-weight: 600; }
.news-title { font-weight: 600; font-size: 1.02rem; margin: .3rem 0; }
.news-excerpt { font-size: .87rem; color: #6b7280; }

/* -------- Gallery -------- */
.gallery-item { border-radius: 12px; overflow: hidden; aspect-ratio: 1/1; position: relative; display: block; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gallery-item:hover img { transform: scale(1.08); }

/* -------- Footer -------- */
.public-footer { background: #0b1e46; color: #fff; margin-top: 3rem; }
.footer-brand { font-weight: 700; }
.footer-heading { font-weight: 600; margin-bottom: 1rem; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: .5rem; }
.footer-links a { color: rgba(255,255,255,.65); font-size: .88rem; }
.footer-links a:hover { color: #fff; }
.social-btn { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; color: #fff; }
.social-btn:hover { background: var(--brand-secondary); color: #1f2937; }
.footer-bottom { background: #071534; }

/* -------- Login page -------- */
.login-wrapper { min-height: 100vh; display: flex; }
.login-visual {
  flex: 1.1; background: linear-gradient(135deg, var(--brand-primary), #17469e);
  color: #fff; display: flex; align-items: center; justify-content: center; padding: 3rem;
  position: relative; overflow: hidden;
}
.login-visual::before {
  content: ''; position: absolute; width: 500px; height: 500px; border-radius: 50%;
  background: rgba(255,255,255,.06); top: -150px; right: -150px;
}
.login-form-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; background: #fff; }
.login-card { width: 100%; max-width: 400px; }
.login-logo { height: 4.5rem; width: auto; max-width: 100%; border-radius: 14px; background: #fff; padding: .4rem; box-shadow: 0 10px 28px rgba(0,0,0,.22); }

/* -------- Utilities -------- */
.rounded-14 { border-radius: 14px; }
.shadow-soft { box-shadow: 0 2px 12px rgba(15,23,42,.07); }

/* ภาพปกหนังสือขนาดย่อในตาราง (เช่น ตารางประวัติยืม-คืนในหน้า "บัญชีของฉัน")
   เดิมหน้าฝั่งสมาชิกไม่มีคลาสนี้กำหนดไว้ (มีแต่ฝั่งหลังบ้านใน admin.css) ทำให้ภาพปกที่อัปโหลดไว้ขนาดใหญ่
   แสดงเต็มขนาดจริงในตาราง ทำให้แถวข้อมูลสูงเกินไปไม่เข้าชุดกับข้อมูลคอลัมน์อื่น จึงเพิ่มคลาสนี้ให้ตรงกับฝั่งหลังบ้าน */
.book-cover-thumb { width: 46px; height: 62px; object-fit: cover; border-radius: 6px; background: #e5e7eb; }

/* -------- เนื้อหาเพจแบบ Rich Text (จากตัวแก้ไข TinyMCE) -------- */
.page-rich-content img { max-width: 100%; height: auto; border-radius: 8px; }
.page-rich-content table { max-width: 100%; border-collapse: collapse; margin: 1rem 0; }
.page-rich-content table td, .page-rich-content table th { border: 1px solid #dee2e6; padding: .5rem .75rem; }
.page-rich-content iframe, .page-rich-content video { max-width: 100%; }
.page-rich-content a { color: var(--brand-primary); }

@media (max-width: 767.98px) {
  .hero-slide { min-height: 320px; }
  .hero-slide-content h2 { font-size: 1.6rem; }
  .login-visual { display: none; }
}
