/* ============================================
   TV4C Library Stylesystem
   ============================================ */

:root {
  /* Colors */
  --primary-blue: #2563eb;
  --primary-blue-dark: #1e3a8a;
  --primary-cyan: #06b6d4;
  --accent-yellow: #eab308;
  --text-dark: #2B3B51;
  --text-gray: #2B3B51;
  /* User requested all text/icon to be #2B3B51 */
  --bg-light: #f3f4f6;
  --white: #ffffff;
  --red: #dc2626;
  --news-title-color: #46648D;

  /* Spacing (Adjusted for 1rem = 16px) */
  --container-width: 1248px;
  --space-2: 0.3125rem;
  /* 5px */
  --space-3: 0.75rem;
  /* 12px */
  --space-4: 1rem;
  /* 16px */
  --space-6: 1.5rem;
  /* 24px */
  --space-8: 2rem;
  /* 32px */

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

html {
  font-size: 100%;
  /* 1rem = 16px */
}

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

body {
  font-family: 'Inter', sans-serif;
  color: var(--text-dark);
  background: var(--white);
  line-height: 1.5;
  font-size: 1rem;
  /* 16px */
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--news-title-color);
}

a {
  text-decoration: none;
  color: inherit;
  transition: 0.2s;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
  object-fit: cover;
}

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

/* Flex Utilities */
.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.justify-start {
  justify-content: flex-start;
}

.justify-end {
  justify-content: flex-end;
}

.flex-col {
  flex-direction: column;
}

.flex-row {
  flex-direction: row;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.flex-shrink-0 {
  flex-shrink: 0;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-6 {
  gap: var(--space-6);
}

.gap-8 {
  gap: 2rem;
}

/* Padding Utilities */
.p-5 {
  padding: 1.25rem;
  /* 20px */
}

.p-4 {
  padding: 1rem;
}

/* Border Utilities */
.border-t {
  border-top: 1px solid #e5e7eb;
}

.border-gray-200 {
  border-color: #e5e7eb;
}

/* Radius Utilities */
.rounded-b-lg {
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* Grid Utilities */
.grid {
  display: grid;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

/* Text Utilities (Adjusted for 1rem = 16px) */
.text-primary {
  color: var(--primary-blue-dark);
}

.text-red {
  color: var(--red);
}

.text-gray {
  color: var(--text-gray);
}

.font-bold {
  font-weight: 700;
}

.text-xl {
  font-size: 1.25rem;
  /* 20px */
}

.text-2xl {
  font-size: 1.5rem;
  /* 24px */
}

.text-xs {
  font-size: 0.75rem;
  /* 12px */
}

.uppercase {
  text-transform: uppercase;
}

.hidden {
  display: none !important;
}

/* ============================================
   1. TOP HEADER (White)
   ============================================ */
.top-header {
  background: var(--white);
  padding: var(--space-4) 0;
  border-bottom: 1px solid #e5e7eb;
  position: relative;
  z-index: 100;
}

.logo img {
  height: 50px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  color: var(--text-gray);
  font-size: 1.1rem;
}

.icon-btn:hover {
  background: var(--bg-light);
  color: var(--primary-blue);
  border-color: var(--primary-blue);
}

.mobile-menu-btn,
.mobile-user-btn {
  display: none;
}

/* User Dropdown */
/* User Dropdown */
.user-dropdown-container {
  position: relative;
  /* Ensure this container has height/width to be hoverable */
  display: inline-block;
}

.user-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 250px;
  background: var(--white);
  /* User Request 3: Drop Shadow */
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  /* Use visibility/opacity for cleaner transitions if desired, but display is fine for now */
  display: none;
  z-index: 100;
  margin-top: 10px;
}

/* User Request 2: Fix "disappearing when sliding" (Bridge) */
.user-dropdown-container::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 0;
  width: 100%;
  height: 15px;
  /* Bridges the gap between icon and menu */
  background: transparent;
}

.user-dropdown-container:hover .user-menu-dropdown {
  display: block;
}

.user-menu-dropdown a {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-dark);
  text-decoration: none;
  transition: all 0.2s ease;
}

.user-menu-dropdown a:hover {
  background: var(--bg-light);
  color: var(--primary-blue);
}

/* Icon separation */
.user-menu-dropdown a i {
  width: 25px;
  text-align: center;
  margin-right: 10px;
}

.divider {
  height: 1px;
  background: #f3f4f6;
  margin: 5px 0;
}

/* ============================================
   8. INNER PAGES GLOBAL
   ============================================ */
.main-navbar {
  margin-bottom: 0 !important;
}

.breadcrumb,
.breadcrumb-section {
  padding: var(--space-4) 0;
  margin-top: 0 !important;
  color: var(--text-gray);
  font-size: 0.9rem;
  border-bottom: none !important;
}

.breadcrumb a:hover {
  color: var(--primary-blue);
  text-decoration: underline;
}

.breadcrumb i {
  font-size: 0.7rem;
  margin: 0 8px;
  opacity: 0.5;
}

.page-title {
  /* Inherit font-family (Inter) */
  font-size: 1.75rem;
  color: var(--primary-blue-dark);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid #e5e7eb;
}



.breadcrumb a:hover,
.breadcrumb-section a:hover {
  color: var(--primary-blue);
  margin-right: 5px;
}

.breadcrumb i,
.breadcrumb-section i {
  font-size: 0.7rem;
  margin: 0 10px;
  opacity: 0.5;
}

/* Sidebar Filters */
.sidebar-filter {
  background: var(--white);
  padding: 20px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.filter-header {
  font-weight: 700;
  font-size: 1.1rem;
  color: #1e3a8a;
  text-transform: inherit;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 15px;
  border-bottom: 1px solid #f3f4f6;
}

.filter-header::before {
  content: '\f0b0';
  /* Filter icon */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 1rem;
  color: #6b7280;
}

.filter-group {
  margin-bottom: 25px;
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 20px;
}

.filter-group:last-of-type {
  border-bottom: none;
}

.filter-group-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #374151;
  /* Gray 700 */
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.filter-group-title i {
  transition: transform 0.3s ease;
}

.filter-group-title:hover {
  color: var(--primary-blue);
}

.filter-list {
  list-style: none;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out, margin 0.3s ease;
  overflow: hidden;
}

.filter-item {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--text-gray);
  cursor: pointer;
  transition: 0.2s;
}

.filter-item:hover {
  color: var(--primary-blue);
}

.filter-item label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.filter-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-blue);
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
}

.view-more-filter {
  color: #ef4444;
  /* Red 500 */
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Center if desired, or left */
  gap: 5px;
  margin-top: 10px;
  font-weight: 500;
  transition: opacity 0.2s;
}

.view-more-filter:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.filter-search-box {
  position: relative;
  margin-top: 10px;
}

.filter-search-box input {
  width: 100%;
  padding: 8px 30px 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.filter-search-box input:focus {
  border-color: var(--primary-blue);
}

.filter-search-box i {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 0.8rem;
}

.btn-filter-apply {
  background: var(--primary-blue);
  color: var(--white);
  width: 100%;
  padding: 10px 0;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  margin-top: 20px;
  transition: background 0.2s, transform 0.1s;
}

.btn-filter-apply:hover {
  background: var(--primary-blue-dark);
}

.btn-filter-apply:active {
  transform: scale(0.98);
}

.sidebar-banner {
  margin-top: 30px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* Content Tabs (All/Paper/Digital) */
.content-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 0;
}

.tab-btn {
  padding: 8px 24px;
  background: #f3f4f6;
  color: var(--text-gray);
  border-radius: 4px;
  /* Square-ish as per design */
  font-weight: 500;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: 0.2s;
}

.tab-btn.active,
.tab-btn:hover {
  background: #eff6ff;
  color: var(--primary-blue);
  font-weight: 600;
}

/* Sort Dropdown */
.sort-box select {
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 0.9rem;
  color: var(--text-dark);
}

/* ============================================
   Unified Main Footer
   ============================================ */
.main-footer {
  background: #1e3a8a;
  /* Deep Blue base */
  color: var(--white);
  padding-top: 40px;
  font-size: 0.95rem;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-bottom: 30px;
}

.footer-title {
  /* Inherit font-family */
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.footer-text {
  margin-bottom: 6px;
  opacity: 0.9;
  font-size: 0.9rem;
}

.footer-text a {
  color: inherit;
  text-decoration: none;
}

.footer-text a:hover,
.footer-text a:focus-visible {
  color: var(--white);
  text-decoration: underline;
}

.footer-divider {
  width: 60px;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
  margin: 20px auto;
}

.footer-socials {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.footer-socials a {
  width: 36px;
  height: 36px;
  background: var(--white);
  color: #1e3a8a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: 0.2s;
}

.footer-socials a:hover {
  background: var(--primary-cyan);
  color: var(--white);
  transform: translateY(-2px);
}

.footer-bottom {
  background: rgba(0, 0, 0, 0.2);
  padding: 15px 0;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
}

/* Book Detail (book-detail.html) */
.detail-top-grid {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 40px;
  margin-bottom: 50px;
}

/* Dictionary/Gallery */
.detail-gallery {
  display: flex;
  gap: 15px;
  /* Sticky behavior */
  position: sticky;
  top: 20px;
  align-self: start;
}

.detail-thumbs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 80px;
}

/* Vertical Sidebar for Thumbs */
.thumb-sidebar-vertical {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  height: 100%;
  max-height: 500px;
  /* Constrain height */
}

.thumb-list-vertical {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding-right: 2px;
  /* Space for scrollbar */
  /* Hide scrollbar mostly but allow scroll */
  scrollbar-width: thin;
}

.thumb-list-vertical::-webkit-scrollbar {
  width: 4px;
}

.thumb-list-vertical::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

.thumb-item {
  width: 100%;
  aspect-ratio: 2/3;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  opacity: 0.7;
  transition: 0.2s;
}

.thumb-item:hover,
.thumb-item.active {
  opacity: 1;
  border-color: var(--primary-blue);
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-main-img {
  flex: 1;
  border: 1px solid #e5e7eb;
  padding: 5px;
  /* Square container */
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
}

.detail-main-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Ensure full image is visible */
  display: block;
}

/* Info Area */
.detail-title {
  /* Inherit font-family */
  font-size: 1.8rem;
  color: var(--primary-blue-dark);
  margin-bottom: 10px;
}

.detail-meta-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.95rem;
}

.detail-meta-table td {
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
}

.detail-meta-table td:first-child {
  width: 120px;
  color: var(--text-gray);
  font-weight: 500;
}

.detail-meta-table td:last-child {
  color: var(--text-dark);
  font-weight: 600;
}

/* Action Buttons */
.detail-actions {
  display: flex;
  gap: 15px;
  margin-top: 30px;
}

.btn-action {
  flex: 1;
  padding: 12px;
  border-radius: 4px;
  color: white;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  cursor: pointer;
  transition: 0.2s;
}

.btn-green {
  background: #16a34a;
}

/* Green */
.btn-blue {
  background: #2563eb;
}

/* Blue */
.btn-orange {
  background: #ea580c;
}

/* Orange */
.btn-action:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

/* Body Layout (Left Content + Right Sidebar) */
.detail-body-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
}

/* Specific override for sidebar in Detail Page */
.detail-body-grid .sidebar-filter {
  border: none;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.content-tabs-detail {
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 20px;
  display: flex;
  gap: 30px;
}

.tab-detail-link {
  padding-bottom: 12px;
  font-weight: 600;
  color: var(--text-gray);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
}

.tab-detail-link.active {
  color: var(--primary-blue);
  border-color: var(--primary-blue);
}

.detail-desc {
  line-height: 1.8;
  color: var(--text-dark);
  margin-bottom: 40px;
  text-align: justify;
}

/* Intro Text Toggle */
.intro-content {
  overflow: hidden;
  transition: max-height 0.5s ease-in-out;
  max-height: 2000px;
  /* Arbitrary large height for expanded state */
}

.intro-content.collapsed {
  max-height: 260px;
  /* Approx 10 lines * 1.6em line-height + spacing */
  position: relative;
  /* Optional: Add gradient fade at bottom for collapsed state */
  mask-image: linear-gradient(180deg, black 60%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, black 60%, transparent 100%);
}

/* Info Table Wrapper for Toggle (Desktop) */
.d-meta-table-wrapper {
  overflow: hidden;
  transition: max-height 0.4s ease-in-out;
  max-height: 1000px;
  /* Expanded state */
}

.d-meta-table-wrapper.collapsed {
  max-height: 160px;
  /* Approx 4 rows */
  mask-image: linear-gradient(180deg, black 60%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, black 60%, transparent 100%);
}

/* Comments */
.comment-item {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
}

.comment-avatar {
  width: 40px;
  height: 40px;
  background: #e5e7eb;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--text-gray);
}

.comment-box {
  background: #f9fafb;
  padding: 15px;
  border-radius: 8px;
  flex: 1;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}

.comment-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.comment-time {
  font-size: 0.8rem;
  color: var(--text-gray);
}

.comment-reply-admin {
  margin-left: 55px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
}

.comment-input-area textarea {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 15px;
  min-height: 100px;
  resize: vertical;
  margin-bottom: 15px;
  outline: none;
}

.comment-input-area textarea:focus {
  border-color: var(--primary-blue);
}

/* Profile/Table Styles (profile.html, cart.html) */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.data-table th,
.data-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #f3f4f6;
}

.data-table th {
  background: #f9fafb;
  font-weight: 600;
  color: var(--text-gray);
}

.profile-tabs {
  width: 250px;
  flex-shrink: 0;
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 10px;
  height: fit-content;
}

.profile-tab-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  color: var(--text-gray);
  font-weight: 500;
}

.profile-tab-item:hover,
.profile-tab-item.active {
  background: #eff6ff;
  color: var(--primary-blue);
}

/* Reader (reader.html) */
.reader-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #e5e5e5;
}

.reader-toolbar {
  height: 60px;
  background: #333;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.reader-content {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  padding: 40px;
}

.pdf-page {
  background: white;
  width: 800px;
  height: 1131px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  margin-bottom: 20px;
}

/* Audio Player */
.audio-player-ui {
  max-width: 800px;
  margin: 50px auto;
  background: white;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.disk-cover {
  width: 250px;
  height: 250px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 30px;
  animation: spin 10s linear infinite;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  animation-play-state: paused;
}

.disk-cover.playing {
  animation-play-state: running;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

/* ============================================
   19. Authentication Pages
   ============================================ */
/* Global Buttons */
.btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-align: center;
  border: none;
  cursor: pointer;
  transition: 0.2s;
  font-size: 0.95rem;
}

.btn-primary {
  background: var(--primary-blue);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--primary-blue-dark);
}

/* Auth Pages Styles */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 600px;
  padding: 40px 0;
}

.auth-card {
  background: var(--white);
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 450px;
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  color: var(--primary-blue-dark);
  margin-bottom: 10px;
}

.auth-header p {
  color: var(--text-gray);
  font-size: 0.95rem;
}

.auth-tabs {
  display: flex;
  background: #f3f4f6;
  padding: 5px;
  border-radius: 8px;
  margin-bottom: 25px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-gray);
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.2s;
}

.auth-tab.active {
  background: var(--white);
  color: var(--primary-blue);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.form-input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.95rem;
  outline: none;
  transition: 0.2s;
  background: #f9fafb;
}

.form-input:focus {
  border-color: var(--primary-blue);
  background: var(--white);
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  font-size: 0.9rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.forgot-pass-link {
  color: var(--primary-blue);
  font-weight: 500;
}

.auth-submit-btn {
  width: 100%;
  padding: 14px;
}

.auth-footer {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-gray);
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #f3f4f6;
}

.auth-footer a {
  color: var(--primary-blue);
  font-weight: 600;
}

/* ============================================
   2. NAVBAR (Blue)
   ============================================ */
.main-navbar {
  background: var(--primary-blue);
  height: 60px;
  color: var(--white);
}

.cat-trigger-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--white);
  font-weight: 700;
  text-transform: uppercase;
  padding: 0 20px;
  height: 60px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Inter', sans-serif;
  /* Explicitly set font */
  font-size: 16px;
}

.cat-trigger-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Search Box */
.search-box {
  background: var(--white);
  border-radius: 50px;
  /* High radius for pill shape */
  display: flex;
  align-items: center;
  height: 50px;
  /* Increased height */
  width: 60%;
  /* Increased height */
  width: 60%;
  margin: 0 auto;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  /* Soft shadow */
}

/* Wrapper for input and select */
.search-input-group {
  display: flex;
  flex: 1;
  height: 100%;
  align-items: center;
}

/* User Request: Search select styling */
.search-select {
  border: none;
  background: transparent;
  padding: 0 15px 0 20px;
  font-size: 0.95rem;
  border-right: 2px solid #e0e0e0;
  /* Explicit divider */
  outline: none;
  color: #555;
  cursor: pointer;
  height: 60%;
  /* Divider height */
  font-family: inherit;
}

.search-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.95rem;
  color: var(--text-dark);
  flex: 1;
  min-width: 0;
  padding: 0 15px;
  height: 100%;
}

.search-btn {
  background: #ffb700;
  /* Distinct yellow from image */
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--white);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
  flex-shrink: 0;
  margin-right: 0;
}

.search-btn:hover {
  background: #e5a500;
}

.search-btn i {
  color: var(--white);
}

.search-btn:hover {
  background: #facc15;
  transform: scale(1.05);
}

.nav-links a {
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-links a:hover {
  opacity: 0.9;
}

/* ============================================
   3. HERO SECTION
   ============================================ */
.hero-section {
  padding-top: var(--space-4);
  padding-bottom: 24px;
  /* User Request */
}

.sub-banner-section {
  padding-bottom: 0 !important;
  /* User Request */
}

.hero-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-6);
  align-items: stretch;
  /* User Request: Equal height for Sidebar and Slider */
}

/* Sidebar Categories */
.hero-sidebar {
  display: flex;
  flex-direction: column;
}

.cat-list {
  background: var(--white);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  height: 100%;
  /* Match grid cell height */

}

.cat-list ul {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.cat-list li {
  border-bottom: 1px solid #f3f4f6;
}

.cat-list li:last-child {
  border: none;
}

.cat-list a {
  display: block;
  padding: 9px 20px;
  font-size: 0.95rem;
  transition: 0.1s;
}

.cat-list a:hover {
  background: #eff6ff;
  color: var(--primary-blue);
  padding-left: 25px;
  font-weight: 500;
}

.cat-view-all {
  display: block;
  padding: 9px 20px;
  font-size: 0.95rem;
  color: var(--primary-blue-dark);
  font-weight: 600;
  /* Keeping bold for Menu as requested */
  text-align: center;
  border-top: 1px solid #e5e7eb;
  transition: 0.2s;
  background: var(--white);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.cat-view-all:hover {
  color: var(--primary-blue);
  background: #eff6ff;
}


/* Slider */
.hero-slider {
  /* min-height: 400px; - Removed to adhere to aspect ratio */
  width: 100%;
  aspect-ratio: 940 / 400;
  /* Standardize ratio based on design (approx 2.35:1) */
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  background: #f3f4f6;
  min-width: 0;
  /* Fix grid blowout */
}

.slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

.slide a {
  display: block;
  width: 100%;
  height: 100%;
}

.slide.active {
  opacity: 1;
  z-index: 10;
}

.slider-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Slide Content Overlay */
.slide-content {
  position: absolute;
  left: 60px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--white);
  max-width: 500px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  z-index: 20;
}

.slide-content h2 {
  font-size: 2.5rem;
  margin-bottom: 15px;
  line-height: 1.2;
}

.slide-content .btn {
  display: inline-block;
  background: var(--primary-blue);
  color: var(--white);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  margin-top: 20px;
  font-weight: 600;
  text-shadow: none;
}

/* Slider Controls */
.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.5);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 30;
  color: var(--text-dark);
  font-size: 1rem;
  transition: 0.2s;
}

.slider-btn:hover {
  background: var(--white);
  color: var(--primary-blue);
}

.slider-btn.prev {
  left: 20px;
}

.slider-btn.next {
  right: 20px;
}

/* Slider Dots */
.slider-dots {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 30;
}

.dot {
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  cursor: pointer;
  transition: 0.2s;
}

.dot.active,
.dot:hover {
  background: var(--white);
  transform: scale(1.2);
}

/* Sub Banners */
.banner-item {
  color: var(--white);
}

/* Start News Section Refactor */
/* News Section Spacing Fix */
.news-section {
  margin-top: 40px;
  /* Fix overlap with sub-banners */
}

.news-container-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 30px;
}

.news-sub-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

/* Featured News Image Wrapper */
.news-featured-img-wrapper {
  position: relative;
  width: 100%;
  /* Ensure image fits */
  display: flex;
}

.news-featured-img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* Featured News Carousel Navigation */
.news-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  z-index: 20;
  transition: background 0.2s;
}

.news-nav-btn:hover {
  background: rgba(0, 0, 0, 0.6);
}

.news-nav-btn.prev {
  left: 10px;
}

.news-nav-btn.next {
  right: 10px;
}

/* Featured News Dots */
.news-carousel-dots {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 20;
}

.news-dot {
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  cursor: pointer;
  transition: 0.2s;
}

.news-dot.active,
.news-dot:hover {
  background: var(--primary-blue);
  transform: scale(1.2);
}

/* End News Section Refactor */

.banner-card {
  padding: 15px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 15px;
  min-height: 80px;
  position: relative;
  overflow: hidden;
}

.red-gradient {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.blue-gradient {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.bg-image {
  background-size: cover;
  background-position: center;
}

.banner-icon {
  font-size: 1.8rem;
  opacity: 0.8;
}

.banner-text h3 {
  font-size: 0.9rem;
  font-weight: 700;
}

.banner-text p {
  font-size: 0.8rem;
  opacity: 0.9;
  margin-top: 2px;
}

.overlay {
  background: rgba(0, 0, 0, 0.5);
  position: absolute;
  inset: 0;
  padding: 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ============================================
   4. NEWS SECTION
   ============================================ */
.section {
  padding: var(--space-8) 0;
}


/* ============================================
   4. NEWS SECTION (Redesign)
   ============================================ */
/* ============================================
   4. NEWS SECTION (Redesign 3 Cols)
   ============================================ */
.news-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  align-items: stretch;
  /* Equal height */
}

/* Col 1: Featured Carousel */
.news-featured-col {
  height: 100%;
}

.news-featured-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.news-featured-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.news-featured-title {
  font-family: 'Inter', sans-serif;
  font-size: 1.8rem;
  /* 18px */
  font-weight: 700;
  /* 18px */
  font-weight: 700;
  color: var(--news-title-color);
  margin-bottom: 8px;
  margin-bottom: 8px;
  line-height: 1.3;
}

.news-featured-desc {
  font-size: 1.4rem;
  color: var(--text-gray);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  /* Max 5 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  /* Push bottom elements down */
}

.news-featured-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.news-time {
  font-size: 1.2rem;
  color: #999;
}

.btn-news-detail {
  padding: 6px 12px;
  background: var(--news-title-color);
  color: white;
  border-radius: 4px;
  font-size: 1.2rem;
  font-weight: 600;
  transition: 0.2s;
}

.btn-news-detail:hover {
  background: var(--primary-blue-dark);
}

/* Col 2 & 3: News Lists */
.news-list-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
}

.news-list-item {
  display: flex;
  gap: 15px;
  /* align-items: flex-start; */
  height: 100%;
  /* Fill available space in grid row if we use grid */
}

.news-list-thumb {
  width: 40%;
  /* Adjust as needed, approx 120-140px */
  flex-shrink: 0;
}

.news-list-thumb img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 4px;
}

.news-list-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.news-list-title {
  font-size: 1rem;
  /* 16px */
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 5px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-list-desc {
  font-size: 0.9rem;
  color: var(--text-gray);
  line-height: 1.4;
  margin-bottom: 8px;
  font-weight: 400;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-list-bottom {
  margin-top: 5px;
  /* Push to bottom removed */
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Enforce link size in list */
.news-list-bottom a {
  font-size: 14px !important;
}

.news-section-title {
  font-size: 2.4rem;
  /* 24px */
  color: var(--news-title-color);
  /* #46648D */
  font-weight: 700;
}

/* Responsive */
@media (max-width: 1024px) {
  .news-cols-3 {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   DEMO BOOK CARD (Requested)
   ============================================ */
.book-demo-card {
  display: block;
  /* Make anchor encompass the card */
  cursor: pointer;
  width: 100%;
  text-decoration: none;
}

.book-demo-cover {
  width: 100%;
  aspect-ratio: 2/3;
  margin-bottom: 1.5rem;
  /* Space between image and title */
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.book-demo-card:hover .book-demo-cover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.book-demo-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-demo-title {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  /* 16px */
  font-weight: 500;
  text-align: center;
  text-align: center;
  color: var(--news-title-color);
  line-height: 1.4;
  line-height: 1.4;
  transition: color 0.2s;
}

.book-demo-card:hover .book-demo-title {
  color: var(--primary-blue);
}

/* ============================================
   4. NEWS SECTION
   ============================================ */
.news-section {
  margin-bottom: 2.5rem;
}

.news-section-title {
  /* Inherit font-family */
  font-size: 1.125rem;
  color: var(--news-title-color);
  font-weight: 700;
  margin: 0;
  text-transform: none;
}

.news-redesign-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  /* Removing gap to rely on padding/borders for equal spacing */
  align-items: stretch;
}

/* Column 1: Featured */
.news-featured-col {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.news-featured-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  /* Border removed per user request */
}

.news-featured-img {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 1rem;
}

.news-featured-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.news-featured-card:hover .news-featured-img img {
  transform: scale(1.05);
}

.news-featured-title {
  /* Inherit font-family */
  font-size: 1rem;
  /* Enforce 16px */
  font-weight: 600;
  margin-bottom: 0.625rem;
  line-height: 1.4;
  color: var(--text-dark);
}

.news-featured-desc {
  font-size: 1rem;
  color: var(--text-gray);
  font-weight: 400;
  margin-bottom: 1rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-time {
  font-size: 1rem;
  /* 16px */
  color: #9ca3af;
  margin-right: 15px;
  /* Add spacing between date and link */
  display: none !important;
  /* Force hide date */
}

.news-featured-meta {
  display: flex;
  align-items: center;
  margin-bottom: 0.625rem;
}

.btn-news-detail {
  font-size: 14px;
  /* Keep small or match user request? User said "Chi tiết" link. Usually these are smaller/uppercase */
  font-weight: 400;
  color: #e11d48;
  /* Red */
  text-transform: none;
  text-decoration: none;
  background: none;
  padding: 0;
  border: none;
  cursor: pointer;
}

.btn-news-detail:hover {
  text-decoration: underline;
}

/* Columns 2 & 3: List */
.news-list-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  border-right: 1px solid #e5e7eb;
  padding-right: 1.25rem;
  padding-left: 1.25rem;
  /* Add left padding for spacing from previous col */
  height: 100%;
}

.news-list-col:last-child {
  border-right: none;
  padding-right: 0;
  padding-left: 1.25rem;
  /* Ensure left padding stays */
}

.news-item-small {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.9375rem;
  align-items: start;
  padding-bottom: 0.9375rem;
  border-bottom: 1px solid #f3f4f6;
}

.news-item-small:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.news-thumb-small {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 4px;
  overflow: hidden;
}

.news-thumb-small img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-small-content {
  display: flex;
  flex-direction: column;
}

.news-small-title {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0.3125rem;
  color: var(--text-dark);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-small-desc {
  font-size: 1rem;
  color: var(--text-gray);
  font-weight: 400;
  margin-bottom: 0.3125rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   5. BOOK MODULES
   ============================================ */
.module-header {
  border-bottom: 2px solid #f3f4f6;
}

/* Feature Book Review Card (Điểm sách) - New Design */
.book-review-wrapper {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  /* Background moves here to wrap title */
  background: url('../assets/images/book-review-bg.png') no-repeat center center/cover, linear-gradient(135deg, #fce7f3 0%, #e0f2fe 100%);
  padding: 25px 30px 30px 30px;
}

.book-review-card {
  display: flex;
  gap: 30px;
  align-items: stretch;
  /* Equal height */
  /* No background/padding here */
}

/* Ensure active class display logic if needed for JS, otherwise simple flex */
.book-review-card.active {
  display: flex;
}

.book-review-cover-img {
  width: 50%;
  /* 50/50 split */
  flex: 1;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  position: relative;
}

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

.book-review-content {
  width: 50%;
  /* 50/50 split */
  flex: 1;
  color: #2B3B51;
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* Center content vertically if image is taller? Or stretch? */
}

.book-review-title {
  font-size: 1rem;
  /* 16px */
  font-weight: 700;
  /* 16px */
  font-weight: 700;
  color: var(--news-title-color);
  margin-bottom: 15px;
  margin-bottom: 15px;
  line-height: 1.3;
}

.book-review-desc {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 25px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  /* More space available in 50/50 */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Yellow Button */
.btn-review-detail {
  display: inline-block;
  background: #facc15;
  /* Yellow */
  color: #fff;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 4px;
  transition: 0.2s;
  font-size: 1rem;
  width: fit-content;
  margin-top: auto;
  /* Push to bottom if flex stretch */
}

.btn-review-detail:hover {
  background: #eab308;
  transform: translateY(-2px);
  color: #fff;
}

.module-title {
  font-size: 1.125rem;
  /* 18px */
  text-transform: none;
  font-weight: 600;
  /* or 700, user didn't specify weight for module title but "viet Hoa..." */
  margin: 0;
}

.book-card.compact {
  background: transparent;
  padding: 10px 0;
  /* Removed horizontal padding as requested */
  border: none;
  border-radius: var(--radius-sm);
  transition: 0.2s;
}



/* Add hover effect for book title in body-left */
.book-card.compact:hover .book-title {
  color: #055BF5;
}

/* User Request: Body-left modules below "Điểm sách" get 24px padding */
.body-left>div:nth-child(n+2) {
  padding-top: 24px;
  padding-bottom: 24px;
}

/* User Request: Middle banner padding 0 */
.body-left>.middle-banner {
  padding: 0 !important;
}

.book-cover {
  aspect-ratio: 2/3;
  overflow: hidden;
  margin-bottom: 10px;
  border-radius: 4px;
}

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

.book-title {
  font-size: 1rem;
  /* 16px */
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  transition: color 0.2s;
}

/* Sidebar Widgets */
.sidebar-widget {
  background: var(--white);
  padding: 15px;
  border-radius: var(--radius-sm);
  border: 1px solid #e5e7eb;
}

.sidebar-banner-group {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.banner-main-4-3 {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.banner-row-16-9 {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.banner-sub-16-9 {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.banner-sub-7-2 {
  width: 100%;
  aspect-ratio: 7/2;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.banner-img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.banner-link:hover .banner-img-cover {
  transform: scale(1.05);
}

/* Linked Library Dropdown */
.library-link-widget {
  margin-top: 0;
}

.library-select-wrapper {
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
}

.library-select {
  width: 100%;
  padding: 12px 15px;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  /* 14px */
  /* 14px */
  color: var(--news-title-color);
  outline: none;
  outline: none;
  cursor: pointer;
}

.library-select-wrapper::after {
  content: '\f107';
  /* FontAwesome Chevron Down */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-gray);
  pointer-events: none;
}

.rank-number {
  width: 30px;
  text-align: center;
}

/* Most Read Books Widget */
.most-read-widget {
  margin-bottom: var(--space-4);
}

.most-read-list {
  display: flex;
  flex-direction: column;
}

.most-read-item {
  display: flex;
  gap: 15px;
  padding: 15px 0;
  border-bottom: 1px solid #e5e7eb;
}

.most-read-item:first-child {
  padding-top: 0;
}

.most-read-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.most-read-thumb {
  width: 60px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.most-read-thumb img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
}

.most-read-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--news-title-color);
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.most-read-title a:hover {
  color: var(--primary-blue);
}

/* ============================================
   6 & 7. FEATURED & COLLECTIONS
   ============================================ */
.nav-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #ddd;
  background: var(--white);
  cursor: pointer;
  color: var(--text-gray);
}

.nav-btn:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.featured-item {
  cursor: pointer;
}

/* Collections Specific */
.collection-card {
  text-align: center;
}

.badge-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--primary-blue);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.collection-desc {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* Responsive (Basic) */
@media (min-width: 1025px) {

  /* Enforce equal width for Nav Button and Sidebar */
  .nav-left {
    width: 270px;
    /* Fixed width */
    flex-shrink: 0;
  }

  .cat-trigger-btn {
    width: 100%;
    justify-content: flex-start;
    padding-left: 20px;
  }

  /* Home Page Layout: Sidebar matches Nav width and sits directly below */
  /* Home Page Layout: Sidebar matches Nav width and sits directly below */
  .hero-section {
    padding-top: 0;
    /* Remove top padding to stick to navbar */
  }

  .hero-grid {
    display: grid;
    /* 270px sidebar + gap + remaining slider */
    grid-template-columns: 270px 1fr;
    gap: 0;
    /* No gap between sidebar and slider visually if needed, but slider typically has margin */
    position: relative;
  }

  /* Standardized Hero Slider */
  .hero-slider {
    position: relative;
    overflow: hidden;
    width: 100%;
    /* 21:9 ratio for desktop consistency */
    aspect-ratio: 21/9;
    background: #f0f0f0;
    margin-bottom: 20px;
  }

  .hero-slider .slide {
    width: 100%;
    height: 100%;
    display: none;
    /* Controlled by JS */
  }

  .hero-slider .slide.active {
    display: block;
  }

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

  .slider-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
  }

  /* Slider needs to push right a bit or just sit next to it. 
     If we want the sidebar to look "connected" to navbar, gap should be handled carefully. 
     Let's keep a small gap for content but ensure sidebar aligns. */
  .hero-content {
    padding-left: 15px;
    /* Reduced from 30px */
    padding-top: 15px;
    /* Reduced from 30px */
  }

  .hero-sidebar {
    background: var(--white);
    border-right: 1px solid #e5e7eb;
    border-left: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    height: 430px;
    /* Increased to cover top padding (400px slider + 30px padding) */
    /* overflow-y: auto; Handled in cat-list now */
    position: relative;
    z-index: 90;
    display: flex;
    /* FLEX! for sticky footer */
    flex-direction: column;
    margin-top: 0;
    /* Ensure no top margin */
  }

  /* Special handling for dropdown on OTHER pages */
  /* We will use a class .has-hero-sidebar on body or main to differentiate */

  /* On non-home pages, .hero-sidebar might not exist in HTML in the same place. 
     We need a dropdown mechanism. */

  /* Sub-menu Dropdown Logic for Non-Home Pages (or hover) */
  .nav-left {
    position: relative;
  }

  /* Example: If we have a .dropdown-menu inside .nav-left in other pages */
  .cat-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 270px;
    background: var(--white);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 200;
    /* Sticky footer logic for dropdown too */
    flex-direction: column;
    height: 430px;
    /* Match sidebar height change */
  }

  .nav-left:hover .cat-dropdown {
    display: flex;
    /* Flex to activate sticky layout */
  }
}

.cat-list {
  list-style: none;
  padding: 0;
  margin: 0;
  /* Clear margin */
  /* Removed padding to eliminate gap at top */
  overflow-y: auto;
  /* Scroll here */
  flex: 1;
  /* Grow to fill space */
}

/* Sticky View All Link styles */
.cat-view-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px;
  color: var(--primary-blue);
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  border-top: 1px solid #e5e7eb;
  cursor: pointer;
  transition: 0.2s;
  background: #f9fafb;
  margin-top: auto;
  /* Push to bottom if flex spacing allows */
  flex-shrink: 0;
  /* Never shrink */
}

.cat-list li a {
  display: block;
  padding: 12px 20px;
  color: var(--text-dark);
  font-size: 0.95rem;
  border-bottom: 1px solid #f3f4f6;
  transition: 0.2s;
}

.cat-list li a:hover {
  background: #eff6ff;
  color: var(--primary-blue);
  padding-left: 25px;
}

/* User Request: "View All" link at bottom of category */
.cat-view-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px;
  color: var(--primary-blue);
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  border-top: 1px solid #e5e7eb;
  cursor: pointer;
  transition: 0.2s;
  background: #f9fafb;
}

.cat-view-all:hover {
  background: #eff6ff;
}

/* 3. Sub Banners Section */
.sub-banner-section {
  padding-bottom: 40px;
}

.sub-banner-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin-top: 0;
}

.sub-banner-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 3/1;
  /* Or auto based on image */
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease;
}

.sub-banner-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

.sub-banner-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================================
   20. Utility Classes
   ============================================ */
.hidden {
  display: none !important;
}

.w-full {
  width: 100%;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mb-1 {
  margin-bottom: 0.25rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-3 {
  margin-bottom: 0.75rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.p-2 {
  padding: 0.5rem;
}

.p-4 {
  padding: 1rem;
}

.p-8 {
  padding: 2rem;
}

.rounded {
  border-radius: var(--radius-sm);
}

.bg-white {
  background-color: var(--white);
}

.bg-gray-50 {
  background-color: #f9fafb;
}

.shadow-sm {
  box-shadow: var(--shadow-sm);
}

.border {
  border: 1px solid #e5e7eb;
}

.border-b {
  border-bottom: 1px solid #e5e7eb;
}

.pb-2 {
  padding-bottom: 0.5rem;
}

.pb-8 {
  padding-bottom: 2rem;
}

.block {
  display: block;
}

.font-medium {
  font-weight: 500;
}

.col-span-2 {
  grid-column: span 2;
}

.object-cover {
  object-fit: cover;
}

.flex-1 {
  flex: 1;
}

/* ============================================
   21. Reader Mode (reader.html)
   ============================================ */
body.reader-mode {
  margin: 0;
  overflow: hidden;
  background: #e5e5e5;
}

.reader-header {
  height: 60px;
  background: #2B3B51;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.reader-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.back-btn {
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.8;
}

.back-btn:hover {
  opacity: 1;
}

/* Ebook Mode */
.ebook-container {
  height: calc(100vh - 60px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px;
  background: #d1d5db;
}

.book-page {
  width: 800px;
  height: 1100px;
  background: var(--white);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 60px;
  margin-bottom: 20px;
  color: #374151;
  line-height: 1.8;
  text-align: justify;
  display: none;
}

.book-page.active {
  display: block;
}

/* Audio Mode */
.audio-container {
  height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #1e3a8a, #0f172a);
  color: var(--white);
}

.player-ui {
  width: 400px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.audio-disk {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: url('https://images.unsplash.com/photo-1544947950-fa07a98d237f?w=400') center/cover;
  margin: 0 auto 30px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  animation: spin 10s linear infinite;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 1.5rem;
  margin-top: 20px;
}

.play-btn {
  width: 60px;
  height: 60px;
  background: var(--white);
  color: #1e3a8a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  cursor: pointer;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

/* Reader Playlist Sidebar */
.playlist-ui {
  width: 300px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 20px;
  height: fit-content;
}

/* Stats Widget */
.statistics-widget .stat-group {
  background: var(--white);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid #e5e7eb;
}

.statistics-widget .stat-group:last-child {
  margin-bottom: 0;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.stat-row:last-child {
  margin-bottom: 0;
}

.stat-row .label {
  color: #4b5563;
  /* text-gray-600 */
}

.stat-row .value {
  color: #46648D;
  font-weight: 700;
}

/* ============================================
   Desktop Grid Layouts (Restoring lost inline styles)
   ============================================ */

/* Main Layout (index.html) - 3fr content, 1fr sidebar */
.main-layout {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 32px;
  /* gap-8 */
}

/* Books Layout (books.html) - 250px sidebar, rest content */
.main-layout-books {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 32px;
}

/* Guide Layout (guide.html) - 1fr sidebar, 2fr content */
.guide-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 32px;
}

/* Book Detail Top (book-detail.html) - 400px sidebar, rest content */
.detail-top-grid {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 32px;
}

/* Book Detail Body (book-detail.html) - Content, 300px sidebar */
.detail-body-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
}


/* ============================================
   Fixed Featured Carousel (Desktop Default)
   ============================================ */
.featured-carousel .container {
  max-width: 1280px;
  /* Ensure container has a max width for calc to work reliably */
  margin: 0 auto;
}

.featured-list-wrapper {
  overflow: hidden;
  width: 100%;
  position: relative;
  padding: 10px 0;
  /* Space for shadow */
}

.featured-list {
  display: flex;
  gap: 24px;
  /* Fixed gap */
  transition: transform 0.5s ease-out;
  width: 100%;
}

.book-demo-card {
  /* Exact calculation for 6 items with 24px gap:
       Width = (100% - (5 * 24px)) / 6
    */
  min-width: calc((100% - 120px) / 6);
  flex-shrink: 0;
  display: block;
  text-decoration: none;
}

.book-demo-cover {
  width: 100%;
  aspect-ratio: 3/2;
  border-radius: 4px;
  /* var(--radius-sm) */
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
}

.book-demo-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark, #333);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: center;
}

/* Ensure images cover area */
.book-demo-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.book-demo-card:hover .book-demo-cover img {
  transform: scale(1.05);
}

/* User Request: Aspect Ratio 2/3 for Featured Books */
.aspect-2-3 {
  aspect-ratio: 2/3;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

/* Updates for New Featured Section (User Request) ============================================ */
.grid-6 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 24px;
}

/* Generic Carousel Styles */
.carousel-view {
  overflow: hidden;
  width: 100%;
}

.carousel-track {
  display: flex;
  gap: 24px;
  transition: transform 0.5s ease-out;
}

.carousel-item {
  flex-shrink: 0;
}

/* 6 items: (100% - 5*24px) / 6 */
.carousel-item.col-6 {
  width: calc((100% - 120px) / 6);
}

/* 4 items: (100% - 3*24px) / 4 */
.carousel-item.col-4 {
  width: calc((100% - 72px) / 4);
}

/* User Request: Featured Books images cover style */
.featured-carousel .carousel-item img {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

/* User Request: Padding for headers with carousel nav */
.featured-section .module-header,
.collections-section .module-header {
  padding-bottom: 12px;
}

/* User Request: Fix font size for Most Read */
.most-read-title {
  font-size: 16px !important;
  /* Force 16px */
}

/* Responsive Carousel widths matching JS logic */
@media (max-width: 1200px) {
  .carousel-item.col-6 {
    width: calc((100% - 72px) / 4);
  }

  /* 4 items */
}

@media (max-width: 992px) {

  .carousel-item.col-6,
  .carousel-item.col-4 {
    width: calc((100% - 48px) / 3);
  }

  /* 3 items */
}

@media (max-width: 768px) {

  .carousel-item.col-6,
  .carousel-item.col-4 {
    width: calc((100% - 24px) / 2);
  }

  /* 2 items */
}

@media (max-width: 576px) {

  .carousel-item.col-6,
  .carousel-item.col-4 {
    width: 100%;
  }

  /* 1 item */
}

.aspect-3-2 {
  aspect-ratio: 3/2 !important;
}

/* Unified Book Card Style (User Request) */
.book-card {
  background: white;
  border: 1px solid #e5e7eb;
  /* border-gray-200 */
  border-radius: 8px;
  padding: 12px;
  transition: all 0.3s;
  position: relative;
  text-align: center;
}

.book-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-color: #3b82f6;
  /* blue-500 */
}

.book-card .book-cover {
  aspect-ratio: 2/3;
  overflow: hidden;
  border-radius: 4px;
  margin-bottom: 12px;
  position: relative;
}

.book-card .book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.book-card:hover .book-cover img {
  transform: scale(1.05);
}

.book-card .book-title {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  color: #1e293b;
  /* slate-800 */
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.book-card .book-title a:hover {
  color: #2563eb;
  /* blue-600 */
}

/* Compact modifier (optional, for smaller grids) */
.book-card.compact:hover {
  box-shadow: none;
  /* User requested no shadow */
}

.book-card.compact .book-title {
  font-size: 1rem;
  /* User requested 1rem */
}

/* Footer Title Color Fix */
.footer-title {
  color: var(--white) !important;
}

/* User Request: Body-left modules below "Điểm sách" get 24px padding */

/* ... (Any previous rules for that request, seemingly empty here) ... */

/* ============================================
   UPDATES (Session: Refine UI & Profile)
   ============================================ */



/* 2. Grid 5 Columns (For Profile) */
.grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
}

/* 3. Bootstrap-style Pagination */
/* 3. Bootstrap-style Pagination (Customized: Circular & Gray) */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 2rem;
}

.page-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 36px;
  height: 36px;
  font-size: 16px;
  color: #4b5563;
  /* Gray-600 */
  text-decoration: none;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  /* Gray-200 */
  border-radius: 50%;
  /* Circle */
  transition: all 0.2s ease-in-out;
  cursor: pointer;
}

.page-link:hover {
  z-index: 2;
  color: #111827;
  background-color: #f9fafb;
  border-color: #d1d5db;
}

.page-link.active {
  z-index: 3;
  color: #fff;
  background-color: #64748b;
  /* Slate-500 (Grayish Blue) - Less saturated than primary blue */
  border-color: #64748b;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.page-link i {
  font-size: 0.9em;
}

/* Responsive Grid 5 */

/* News Item Fixes */
.news-thumb {
  width: 240px;
  aspect-ratio: 4/3 !important;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #f3f4f6;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.news-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover !important;
  object-position: center;
  transition: transform 0.5s;
}

.news-item:hover .news-thumb img {
  transform: scale(1.05);
}

.news-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: 5px;
}

/* Latest News Widget */
.latest-news-thumb {
  width: 100px;
  aspect-ratio: 3/2;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.latest-news-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.latest-news-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  /* Align to top */
  gap: 4px;
}

.text-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-category-tag {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text-gray);
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 4px;
  width: fit-content;
}

@media (max-width: 1200px) {
  .grid-5 {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 992px) {
  .grid-5 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 576px) {
  .all-book-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* User Request: Left Body Book Module Responsive (993px - 1200px) */
/* Show 4 items instead of 5 */
@media (min-width: 993px) and (max-width: 1200px) {

  .body-left .grid-5,
  .body-left .book-grid-5 {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  .body-left .grid-5>*:nth-child(5),
  .body-left .book-grid-5>*:nth-child(5) {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .grid-5 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .grid-5 {
    grid-template-columns: 1fr;
  }
}

/* User Request: Fix Search Bar Height to 40px */
.search-box,
.search-select,
.search-input,
.search-btn {
  height: 40px !important;
}

.search-input,
.search-select {
  line-height: 40px;
}

/* ============================================
   Carousel & Grid Classes (Restored)
   ============================================ */
.carousel-view {
  overflow: hidden;
  width: 100%;
  position: relative;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s ease-in-out;
  gap: 24px;
}

.carousel-item {
  flex: 0 0 auto;
}

/* Specific columns for carousel items */
.col-6 {
  width: calc((100% - (5 * 24px)) / 6);
}

@media (max-width: 1200px) {
  .col-6 {
    width: calc((100% - (3 * 24px)) / 4);
    /* Show 4 */
  }
}

@media (max-width: 992px) {
  .col-6 {
    width: calc((100% - (2 * 24px)) / 3);
    /* Show 3 */
  }
}

@media (max-width: 768px) {
  .col-6 {
    width: calc((100% - (1 * 24px)) / 2);
    /* Show 2 */
  }
}

@media (max-width: 576px) {
  .col-6 {
    width: 100%;
    /* Show 1 */
  }
}

/* ============================================
   GLOBAL: LINKED BOOK COVERS
   ============================================ */
.book-cover a,
.book-review-cover-img a {
  display: block;
  height: 100%;
  width: 100%;
}


/* ============================================
   DESKTOP REDESIGN (Book Detail)
   ============================================ */
.book-detail-grid.desktop-redesign {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
}

/* --- Left Col: Visuals --- */
.book-visuals-col {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  /* Sticky Visuals */
  position: sticky;
  top: 90px;
  /* Header offset */
  align-self: start;
}

.thumb-sidebar-vertical {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 80px;
}

.thumb-nav-btn {
  border: none;
  background: transparent;
  color: #666;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px;
}

.thumb-nav-btn:hover {
  color: var(--primary-blue);
}

.thumb-list-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  /* Limit height if many thumbs */
  overflow-y: auto;
}

/* Hide scrollbar for thumbs */
.thumb-list-vertical::-webkit-scrollbar {
  display: none;
}

.v-thumb {
  width: 70px;
  height: 100px;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.2s;
}

.v-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.v-thumb.active {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 1px var(--primary-blue);
}

.v-thumb:hover {
  opacity: 0.9;
}

.main-cover-large {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fff;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  aspect-ratio: 1 / 1;
  /* Force square */
  position: relative;
}

.main-cover-large img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Ensure full image visible */
  box-shadow: none;
  cursor: pointer;
  /* Lightbox trigger */
}

/* --- Right Col: Info --- */
.d-book-title {
  font-size: 1.8rem;
  color: var(--primary-blue-dark);
  font-weight: 700;
  margin-bottom: 8px;
}

.d-collection {
  color: #555;
  margin-bottom: 15px;
  font-size: 0.95rem;
}

.d-collection a {
  color: var(--red);
  font-weight: 500;
}

.d-stats-row {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
  color: #444;
}

.d-stat.divider-l {
  border-left: 1px solid #ddd;
  padding-left: 15px;
}

/* Desktop Meta Table */
.d-meta-table-wrapper {
  margin-bottom: 20px;
}

.d-meta-table {
  width: 100%;
  border-collapse: collapse;
}

.d-meta-table td {
  padding: 12px 10px;
  border: 1px solid #e5e7eb;
  font-size: 0.95rem;
}

.d-meta-table td.label {
  width: 30%;
  background: #f9fafb;
  font-weight: 600;
  color: #4b5563;
}

.d-meta-table td.value {
  color: #2B3B51;
}

.d-actions-group {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.btn-d-action {
  padding: 12px 10px;
  /* Reduced side padding */
  border-radius: 6px;
  border: none;
  color: white;
  font-weight: 400;
  /* Lighter weight */
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Center content */
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  /* Equal width */
  white-space: nowrap;
  /* Prevent breaking inside button text if possible */
  min-width: 180px;
  /* Min width before wrapping */
}

.btn-d-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}


/* ============================================
   Lightbox Styles
   ============================================ */
#lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  /* Darker */
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  flex-direction: column;
  /* Stack image and thumbs */
}

.lightbox-content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  justify-content: center;
}

.lightbox-img-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
  padding: 20px;
}

.lightbox-img {
  max-width: 90%;
  max-height: 80vh;
  object-fit: contain;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Lightbox Thumbs */
.lightbox-thumbs-container {
  width: 100%;
  height: 100px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
  margin-bottom: 20px;
}

.lightbox-thumbs-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  max-width: 80%;
  padding-bottom: 5px;
  scrollbar-width: thin;
  scrollbar-color: #666 transparent;
}

.lightbox-thumbs-list::-webkit-scrollbar {
  height: 6px;
}

.lightbox-thumbs-list::-webkit-scrollbar-thumb {
  background: #666;
  border-radius: 3px;
}

.lb-thumb {
  width: 60px;
  height: 80px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.5;
  transition: 0.2s;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.lb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 2px;
}

.lb-thumb:hover {
  opacity: 0.8;
}

.lb-thumb.active {
  opacity: 1;
  border-color: var(--primary-blue);
  transform: scale(1.05);
}

#lightbox-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  /* Enable interaction */
}

.lightbox-img-wrapper {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lightbox-img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  background: transparent;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  z-index: 1001;
  transition: transform 0.2s;
}

.lightbox-close:hover {
  transform: scale(1.1);
  color: var(--accent-yellow);
}

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  backdrop-filter: blur(5px);
}

.lightbox-nav-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
  left: 30px;
}

.lightbox-next {
  right: 30px;
}

/* Mobile Lightbox Adjustments */
@media (max-width: 768px) {
  .lightbox-nav-btn {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .lightbox-prev {
    left: 10px;
  }

  .lightbox-next {
    right: 10px;
  }
}

/* ============================================
   TABLE OF CONTENTS (New)
   ============================================ */
.toc-container {
  padding: 10px 0;
}

.toc-list {
  list-style: none;
  padding: 0;
}

.toc-list li {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px dashed #e5e7eb;
  font-size: 1rem;
  color: var(--text-dark);
}

.toc-list li:last-child {
  border-bottom: none;
}

.toc-list .chapter-num {
  font-weight: 600;
  color: var(--primary-blue);
  min-width: 80px;
}

.toc-list .chapter-name {
  flex: 1;
  padding: 0 15px;
  font-weight: 500;
}

.toc-list .page-num {
  color: var(--text-gray);
  font-family: monospace;
}

/* ============================================
   COMMENTS & REVIEWS (New UI)
   ============================================ */
.comments-wrapper {
  margin-top: 10px;
}

/* Rating Summary */
.rating-summary {
  display: flex;
  gap: 40px;
  padding: 24px;
  background: #f9fafb;
  border-radius: var(--radius-sm);
  margin-bottom: 30px;
  align-items: center;
}

.rating-score {
  text-align: center;
  min-width: 120px;
}

.score-large {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
  display: block;
}

.score-stars {
  color: var(--accent-yellow);
  font-size: 1.1rem;
  margin: 5px 0;
}

.total-reviews {
  color: var(--text-gray);
  font-size: 0.9rem;
}

.rating-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 0.9rem;
  color: var(--text-gray);
}

.bar-track {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent-yellow);
  border-radius: 4px;
}

/* Input Box */
.comment-input-box {
  margin-bottom: 30px;
}

.input-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 15px;
  color: var(--text-dark);
}

.input-wrapper {
  display: flex;
  gap: 20px;
}

.user-avatar-small {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.input-area {
  flex: 1;
}

.star-rating-select {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.stars-select {
  color: #ccc;
  font-size: 1.2rem;
  cursor: pointer;
}

.stars-select i:hover,
.stars-select i.active {
  color: var(--accent-yellow);
}

.input-area textarea {
  width: 100%;
  height: 100px;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  margin-bottom: 15px;
  resize: vertical;
  font-family: 'Inter', sans-serif;
}

.input-actions {
  text-align: right;
}

/* Review List */
.review-item {
  border-bottom: 1px solid #f3f4f6;
  padding: 24px 0;
}

.review-item:first-child {
  padding-top: 0;
}

.review-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.user-meta {
  flex: 1;
}

.user-name {
  display: block;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.item-rating {
  font-size: 0.8rem;
  color: var(--accent-yellow);
}

.review-date {
  font-size: 0.85rem;
  color: var(--text-gray);
}

.review-content {
  color: #4b5563;
  line-height: 1.6;
  margin-bottom: 15px;
}

.review-actions {
  display: flex;
  gap: 20px;
}

.action-btn {
  background: none;
  border: none;
  color: var(--text-gray);
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.action-btn:hover {
  color: var(--primary-blue);
}

/* Responsive Comments */
@media (max-width: 768px) {
  .rating-summary {
    flex-direction: column;
    gap: 20px;
    align-items: flex-start;
  }

  .rating-score {
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
  }

  .rating-bars {
    width: 100%;
  }

  .input-wrapper {
    flex-direction: column;
  }

  .user-avatar-small {
    display: none;
  }
}

/* ============================================
   FIX: RESPONSIVE CAROUSEL (2.5 items)
   ============================================ */
@media (max-width: 480px) {

  /* Enable horizontal scrolling */
  .featured-carousel .carousel-track {
    display: flex;
    gap: 16px;
    /* slightly smaller gap for mobile */
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    padding-bottom: 10px;
    /* Space for scrollbar if visible */
    width: 100%;
    /* Remove transform transition if using native scroll */
    transform: none !important;
  }

  .featured-carousel .carousel-item {
    /* Calculation for 2.5 items: 
           Viewport width = 100%
           Gap = 16px
           Want to see 2 full items + 0.5 item = 2.5 items
           Width approx = (100% - (gaps)) / 2.5
        */
    min-width: calc((100% - 16px) / 2.2);
    /* Adjust 2.2-2.5 for best fit */
    scroll-snap-align: start;
    flex: 0 0 auto;
    /* Stop shrinking */
    width: auto !important;
    /* Override col-6 styles */
  }

  /* Hide desktop nav buttons on mobile if native scroll is used - DISABLED
  .featured-section .carousel-nav {
    display: none;
  } */

  /* Ensure images fill height */
  .featured-carousel .collection-thumb {
    height: auto;
    aspect-ratio: 2/3;
  }
}

/* Carousel Nav Buttons (Global) */
.nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #2B3B51;
  display: flex !important;
  /* Force flex to ensure visible */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
  /* Ensure clickable on mobile */
  position: relative;
  z-index: 50;
}

.nav-btn:hover {
  background: #eff6ff;
  color: var(--primary-blue);
  border-color: var(--primary-blue);
}


/* Unified View All Links (User Request) */
/* Unified View All Links (User Request) */
.view-all-link,
.view-all-btn,
.section-header a[class*="view-all"] {
  color: #dc2626 !important;
  font-weight: 600;
}

/* =========================================
   14. CART PAGE REDESIGN
   ========================================= */
.cart-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
}

@media (max-width: 991px) {
  .cart-layout {
    grid-template-columns: 1fr;
  }
}

/* Cart Item */
.cart-header,
.cart-item {
  position: relative;
  background: white;
  border-bottom: 1px solid #f0f0f0;
  padding: 24px 0 !important;
}

.cart-item:last-child {
  border-bottom: none;
}

/* Book Cover - 2/3 Aspect Ratio Enforced */
/* Book Cover - Square Frame with Padding */
.cart-thumb {
  width: 120px;
  /* Fixed width, slightly larger for frame */
  aspect-ratio: 1/1;
  /* Square frame */
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  /* Softer corners for frame */
  padding: 12px;
  /* Comfortable padding */
  background: #fff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-thumb img {
  width: auto;
  /* Let height dictate width */
  height: 100%;
  /* Fill height of padding area */
  object-fit: contain;
  /* Ensure image shows fully */
  border-radius: 2px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Checkbox specific to Cart */
.cart-check .form-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1.5px solid #d1d5db;
  cursor: pointer;
  accent-color: var(--primary-color);
}

/* Quantity Spinner - Design Specific */
.quantity-control {
  display: flex;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
  height: 32px;
  border: 1px solid #e5e7eb;
}

.quantity-control button {
  width: 32px;
  background: #e5e7eb;
  /* Darker gray for buttons */
  border: none;
  cursor: pointer;
  color: #374151;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.quantity-control button:hover {
  background: #d1d5db;
}

.quantity-control input {
  width: 44px;
  text-align: center;
  border: none;
  background: white;
  outline: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
}

/* Delete Button */
.btn-delete-item {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #6b7280;
  transition: all 0.2s;
  background: white;
}

.btn-delete-item:hover {
  background: #fee2e2;
  border-color: #fecaca;
  color: #ef4444;
}

/* Info Info Rows */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
}

/* User requested border on last child to separate sections visually */
.info-section .info-row:last-child {
  border-bottom: 1px solid #f3f4f6;
}

/* Sidebar & Widget Styles */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-badge.success {
  background-color: #dcfce7;
  color: #15803d;
}

.cart-sidebar-col .widget-box {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.cart-sidebar-col .widget-header {
  padding: 15px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.cart-sidebar-col .widget-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-blue-dark);
}

.cart-sidebar-col .info-section {
  padding: 20px;
  background: #fff !important;
}

/* Fix Order Info Section Background to White as requested */
.cart-sidebar-col .info-section.bg-gray-50 {
  background-color: #fff !important;
  border-top: 1px solid #e5e7eb;
}

.cart-sidebar-col .info-title {
  font-weight: 700;
  margin-bottom: 0;
  padding-bottom: 12px;
  color: var(--text-dark);
  font-size: 1rem;
  border-bottom: 1px solid #f3f4f6;
}

/* Button Styles Fix: Added padding/margin to ensure visibility */
.btn-primary-action {
  background-color: var(--primary-blue) !important;
  color: white !important;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  display: block;
  width: 100%;
  font-family: 'Inter', sans-serif;
  /* Fix font to match system */
}

.btn-primary-action:hover {
  background-color: var(--primary-blue-dark) !important;
}

.btn-secondary-action {
  background-color: #fff !important;
  color: #4b5563 !important;
  border: 1px solid #d1d5db !important;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  display: block;
  width: 100%;
  font-family: 'Inter', sans-serif;
  /* Fix font to match system */
}

.btn-secondary-action:hover {
  background-color: #f9fafb !important;
}

/* Background Utilities */
.bg-white {
  background-color: var(--white);
}

/* Mobile Filter Button (Hidden on Desktop) */
.btn-mobile-filter {
  display: none;
}

/* Detail Page Body Grid - Increasing Gap */
.detail-body-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  /* Content + Sidebar */
  gap: 80px;
  /* Increased breathing room as requested */
  align-items: start;
  margin-top: 40px;
}

/* Books Page Layout (Match Nav Category Width) */
.main-layout-books {
  grid-template-columns: 270px 1fr !important;
  /* Force 270px sidebar */
}

@media (max-width: 991px) {
  .main-layout-books {
    grid-template-columns: 1fr !important;
  }
}

/* User Request: Make "View All" links normal weight */
.view-all-link,
.view-all-btn {
  font-weight: 400 !important;
}

/* Responsive Book Review Card */
@media (max-width: 768px) {
  .book-review-card {
    flex-direction: column;
    gap: 20px;
  }

  .book-review-cover-img,
  .book-review-content {
    width: 100%;
    flex: auto;
  }
}

/* User Request: Remove Pagination padding/margin */
.pagination {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Featured Books Carousel Styles */
.featured-section .carousel-container {
  overflow: hidden;
  position: relative;
  width: 100%;
}

.featured-section .carousel-track {
  display: flex;
  gap: 24px;
  transition: transform 0.5s ease-in-out;
}

.featured-section .carousel-item {
  flex: 0 0 calc((100% - 24px * 5) / 6);
  /* 6 items */
  min-width: 0;
}

/* Responsive Item Widths (Must match JS getItemsToShow) */
@media (max-width: 1200px) {
  .featured-section .carousel-item {
    flex: 0 0 calc((100% - 24px * 3) / 4);
    /* 4 items */
  }
}

@media (max-width: 992px) {
  .featured-section .carousel-item {
    flex: 0 0 calc((100% - 24px * 2) / 3);
    /* 3 items */
  }
}

@media (max-width: 768px) {
  .featured-section .carousel-item {
    flex: 0 0 calc((100% - 24px * 1) / 2);
    /* 2 items */
  }
}

@media (max-width: 576px) {
  .featured-section .carousel-item {
    flex: 0 0 100%;
    /* 1 item */
  }
}

/* User Request: Object-fit for Featured Books images */
.featured-section .book-cover img,
.featured-section .collection-thumb img {
  object-fit: cover !important;
}

/* User Request: All Books Grid Margin */
.all-book-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
  /* Sync with profile page spacing */
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid #e5e7eb;
}

@media (max-width: 768px) {
  .all-book-list {
    margin-bottom: 16px;
    /* Responsive adjustment (typically 2/3 of desktop) */
  }
}

@media (max-width: 576px) {
  .featured-section .carousel-item {
    flex: 0 0 100%;
    /* 1 item */
  }
}

/* ============================================
   News Detail Page Styles
   ============================================ */

.font-outfit {
  font-family: 'Outfit', sans-serif;
}

.text-news-title-color {
  color: var(--news-title-color);
}

/* Sapo Text */
.news-detail-content .article-sapo {
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--text-dark);
  font-style: italic;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

/* Detail Image Figure */
.detail-figure {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  padding: 8px;
  background: white;
  width: 100%;
  /* Ensure full width */
  display: block;
  /* Ensure block level */
}

.detail-figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.detail-caption {
  font-size: 0.875rem;
  color: #6b7280;
  text-align: center;
  margin-top: 8px;
  font-style: italic;
}

/* Utility Classes */
.py-3 {
  padding-top: 0.75rem !important;
  padding-bottom: 0.75rem !important;
}

/* ============================================
   FEATURED NEWS CAROUSEL (Fix)
   ============================================ */
.news-featured-carousel {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}

.news-featured-card {
  width: 100%;
}

.news-featured-img-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  /* Enforce aspect ratio */
  overflow: hidden;
  border-radius: 8px;
}

.news-featured-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Nav Buttons - Positioned relative to the image wrapper's height approx */
.news-nav-btn {
  position: absolute;
  top: 35%;
  /* Approx center of the 16/9 image section */
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.8);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex !important;
  align-items: center;
  justify-content: center;
  color: #333;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.news-nav-btn:hover {
  background: #fff;
  color: var(--primary-color);
}

.news-nav-btn.prev {
  left: 10px;
}

.news-nav-btn.next {
  right: 10px;
}

/* Dots */
.news-carousel-dots {
  position: absolute;
  top: 60%;
  /* Bottom of the image area */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 10;
  margin-top: -20px;
  /* Pull up into image */
}

.news-dot {
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s;
}

.news-dot.active {
  background: #fff;
  width: 24px;
  border-radius: 4px;
}

.news-featured-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-featured-title:hover {
  color: var(--primary-color);
}

.news-featured-desc {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 15px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-news-detail {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-color);
  text-decoration: none;
}

.btn-news-detail:hover {
  text-decoration: underline;
}

.news-featured-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #888;
}



/* Audio Player */
.audio-player .progress-bar .thumb {
  transition: transform 0.1s;
}

.audio-player .progress-bar:hover .thumb {
  transform: translate(-50%, -50%) scale(1.2);
}

.voice-selector:hover .text-xs {
  background-color: var(--bg-light);
}

/* ============================================
   News Header Redesign
   ============================================ */
.news-header-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.news-date {
  color: #6b7280;
  font-size: 0.95rem;
  font-weight: 400;
}

.news-actions {
  display: flex;
  gap: 0.5rem;
}

.action-btn-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  transition: all 0.2s;
  font-size: 14px;
}

.action-btn-circle:hover {
  background-color: #f9fafb;
  border-color: #d1d5db;
  color: var(--primary-blue);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Audio Player Customization */
.audio-player-wrapper {
  background-color: #f0f9ff;
  border-radius: 50px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2rem;
}

.play-button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #0f766e;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
}

.play-button:hover {
  background-color: #115e59;
}

.audio-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: #4b5563;
  min-width: 70px;
}

.audio-progress {
  flex: 1;
  height: 4px;
  background-color: #d1d5db;
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}

.audio-progress-bar {
  height: 100%;
  background-color: #9ca3af;
  width: 0%;
  border-radius: 2px;
}

.voice-select-btn {
  background: transparent;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

/* ============================================
   Featured News Carousel (Home)
   ============================================ */
.news-slider {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 400px;
  overflow: hidden;
  border-radius: 0.5rem;
}

.news-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  z-index: 1;
}

.news-slide.active {
  opacity: 1;
  z-index: 10;
}

.news-slide .absolute.inset-0.bg-gradient-to-t {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 50%, rgba(0, 0, 0, 0) 100%);
}

/* Voice Selector Dropdown */
.voice-selector {
  position: relative;
}

.voice-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 50;
  min-width: 150px;
  margin-top: 4px;
  overflow: hidden;
}

.voice-dropdown.show {
  display: block;
}

.voice-option {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.875rem;
  color: #374151;
  transition: background-color 0.2s;
}

.voice-option:hover {
  background-color: #f3f4f6;
  color: var(--primary-color);
}

.voice-option.active {
  background-color: #eff6ff;
  color: var(--primary-color);
  font-weight: 500;
}

/* Featured News Image Aspect Ratio Fix */
.news-featured-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 16/9;
  border-radius: var(--radius-md);
}

/* Utility: Text Red (Requested for consistency) */
.text-red {
  color: var(--red) !important;
}

/* ============================================
   Updated Reading Progress & Buttons
   ============================================ */
.w-full {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* Reading Progress Bar */
.reading-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.reading-progress .progress-track {
  flex: 1;
  height: 6px;
  background-color: #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}

.reading-progress .progress-fill {
  height: 100%;
  background-color: var(--primary-blue);
  border-radius: 10px;
}

.reading-progress .progress-percent {
  font-size: 0.75rem;
  color: var(--text-gray);
  font-weight: 500;
  width: 35px;
  /* Fixed width for alignment */
  text-align: right;
  flex-shrink: 0;
}

/* ============================================
   Refined Button & Title Styles (tinted-blue)
   ============================================ */

/* Tinted Blue Button */
.btn-tinted-blue {
  background-color: rgba(70, 100, 141, 0.1);
  color: #46648d !important;
  /* Force color override */
  transition: all 0.2s ease;
}

.btn-tinted-blue:hover {
  background-color: rgba(70, 100, 141, 0.2);
  color: #2c4260 !important;
}

/* Book Title Formatting */
.book-title-clamped {
  display: block;
  /* Fallback */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Fixed height logic: line-height * 2 lines. */
  line-height: 1.4;
  height: calc(1.4em * 2);
  margin-bottom: 5px;
}

.book-title-clamped a {
  display: inline;
  /* allows line clamping to work on text */
  color: inherit;
}

/* User Request: Account Management Specifics */
.account-book-grid {
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid #e5e7eb;
}

.account-book-grid .book-title-clamped {
  font-size: 16px;
}

/* User Request: Password Toggle */
.password-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.password-toggle:hover {
  color: var(--primary-color, #0ea5e9);
}

/* User Request: Success Alert Toast */
.alert-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: #f0fdf4;
  /* green-50 */
  border: 1px solid #22c55e;
  /* green-500 */
  color: #15803d;
  /* green-700 */
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  font-weight: 500;
  transition: all 0.3s ease-in-out;
  transform: translateX(100%);
  opacity: 0;
}

.alert-toast.show {
  transform: translateX(0);
  opacity: 1;
}

.alert-toast.hidden {
  display: flex;
  /* Override display:none to allow transition, controlled by opacity/transform */
  visibility: hidden;
}

.alert-toast.show {
  visibility: visible;
}

.alert-toast i {
  font-size: 1.25rem;
}

.book-title-clamped a {
  display: inline;
  /* allows line clamping to work on text */
  color: inherit;
}

/* ============================================
   Refactored Mobile Header & Profile Layout
   ============================================ */
/* Profile Sidebar (Desktop Defaults) */
.profile-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  height: fit-content;
}

.profile-tab-item {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  color: #4b5563;
  margin-bottom: 4px;
  border-radius: 6px;
  transition: all 0.2s;
  text-decoration: none;
  font-size: 0.95rem;
}

.profile-tab-item i {
  width: 24px;
  text-align: center;
  margin-right: 10px;
}

.profile-tab-item:hover,
.profile-tab-item.active {
  background-color: #eff6ff;
  color: var(--primary-blue);
  font-weight: 500;
}

/* Global Typography Overrides */
.sidebar-user-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  min-height: 72px;
  overflow: visible;
}

.sidebar-user-header .user-avatar {
  flex-shrink: 0;
}

.sidebar-user-header .user-details h3 {
  font-size: 16px !important;
  line-height: 1.4;
}

/* 1. Custom Mobile Header (Visible < 992px) */
.mobile-header-custom {
  display: none;
  background-color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 50;
}

.mobile-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
  padding: 0 16px;
}

.mobile-menu-btn,
.mobile-user-btn {
  font-size: 1.5rem;
  color: #4b5563;
  background: none;
  border: none;
  cursor: pointer;
}

.logo-mobile img {
  height: 40px;
  width: auto;
}

/* Sub-header / Search Area */
.mobile-header-bottom {
  background-color: var(--primary-blue);
  padding: 8px 16px;
}

.mobile-search-wrapper {
  position: relative;
}

.mobile-search-box {
  display: flex;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  height: 36px;
  align-items: center;
}

.search-select-mobile {
  font-size: 0.75rem;
  background: transparent;
  padding-left: 12px;
  padding-right: 4px;
  border: none;
  border-right: 1px solid #e5e7eb;
  outline: none;
  color: #4b5563;
  height: 100%;
  width: 110px;
  cursor: pointer;
}

.search-input-mobile {
  flex: 1;
  padding: 0 12px;
  font-size: 0.75rem;
  border: none;
  outline: none;
  height: 100%;
}

.search-btn-mobile {
  background-color: var(--accent-yellow);
  color: white;
  width: 36px;
  height: 100%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobile-only-icon {
  display: none;
}

/* 2. Responsive Layout Fixes (< 1024px) */
@media (max-width: 1023px) {

  /* Show custom header */
  .mobile-header-custom {
    display: block !important;
  }

  /* Hide default header elems */
  .top-header,
  .main-navbar,
  .breadcrumb-section {
    display: none !important;
  }

  /* Profile Layout Container */
  .profile-layout {
    flex-direction: column !important;
    gap: 16px !important;
    margin-top: 16px !important;
  }

  /* Re-assert Sidebar styling from previous step */
  .profile-sidebar {
    width: 100%;
    order: -1;
    cursor: pointer;
    position: relative;
    z-index: 20;
    /* Mobile specific style overrides */
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    height: auto !important;
    /* Force auto height */
  }

  .sidebar-user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0;
    margin-bottom: 12px;
    width: 100%;
  }

  /* Fix User Name Font Size - Moved to Global */
  .sidebar-user-header .user-avatar {
    flex-shrink: 0;
    margin-right: 12px;
  }

  /* Menu Container */
  .sidebar-menu {
    display: none;
    margin-top: 0;
    border-top: 1px solid #e5e7eb;
    padding-top: 16px;
    width: 100%;
    position: relative;
    /* Ensure it takes up space */
  }

  .profile-sidebar.active .sidebar-menu {
    display: block;
    animation: slideDown 0.3s ease-out;
  }

  .profile-sidebar.active .mobile-only-icon {
    transform: rotate(180deg);
  }

  .mobile-only-icon {
    display: block;
  }
}

/* 3. Force Desktop Header Visibility (Safety Net) */
@media (min-width: 1024px) {

  .top-header,
  .main-navbar,
  .breadcrumb-section {
    display: block !important;
  }

  .mobile-header-custom {
    display: none !important;
  }

  /* Reset Sidebar Spacing for Desktop if needed */
  .sidebar-user-header {
    margin-bottom: 0;
  }

  .profile-sidebar {
    height: fit-content;
    align-self: flex-start;
  }
}

/* ============================================
   Utility Classes (replacing inline styles)
   ============================================ */

/* Search box in navbar */
.nav-center .search-box {
  width: 70%;
  margin: 0 auto;
}

/* Hotline font weight */
.hotline {
  font-weight: 400;
}

/* Module title variants */
.module-title--blue {
  color: #46648D;
  font-size: 18px;
}

.module-title--dark {
  color: #1e293b;
  font-size: 18px;
}

/* Featured section book title */
.collection-title--sm {
  font-size: 1rem;
}

/* Widget title */
.widget-title--blue {
  font-size: 1rem;
  color: #46648D;
}

.statistics-widget .widget-title {
  color: #46648D;
  text-transform: none;
  font-size: 1rem;
}

/* Book title color */
.book-title--blue {
  color: #46648D;
}

/* Book grid gap */
.book-grid-5 {
  gap: 24px;
}

/* News featured carousel height */
.news-featured-carousel {
  height: 100%;
  position: relative;
}

/* Section no padding top */
.section--no-pt {
  padding-top: 0;
}

/* Book module no margin/padding bottom */
.book-module--flush {
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Link full height */
.link-full-height {
  height: 100%;
}

/* News link margin top */
.news-link-mt {
  margin-top: 15px;
  display: block;
}
