/* ============================================
   ALBASAER — BOOKS LISTING PAGE CSS (Arabic / RTL)
   Figma: vmTA4IVgGrXqZYp0eeWe2h  node 140-28667
   ============================================ */

/* ============================================
   CATALOG GRID GEOMETRY
   The hero and the catalog resolve their columns from these tokens.
   Changing one without the other makes their edges drift apart.
   ============================================ */
:root {
  --bl-container: 1387px;
  --bl-pad: 64px;
  --bl-sidebar: 300px;
  --bl-gap: 40px;
  --bl-column-offset: calc(var(--bl-sidebar) + var(--bl-gap));
  --bl-measure: 672px;
}

/* ============================================
   BOOKS HERO
   ============================================ */
.books-hero {
  border-bottom: 1px solid #F3F4F6;
  background: #F9F6EF;
  padding: calc(var(--header-height) + 48px) 0 64px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

  .books-hero::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 700px;
    /*  background: rgba(138, 21, 56, 0.05);*/
    top: -150px;
    right: 50%;
    transform: translateX(50%);
    pointer-events: none;
  }

.books-hero__inner {
  max-width: var(--bl-container);
  margin: 0 auto;
  padding: 0 var(--bl-pad);
  position: relative;
  z-index: 1;
}

.books-hero__title {
  font-size: 52px;
  font-weight: 700;
  color: #101828;
  letter-spacing: -1px;
  line-height: 1.1;
  margin: 0 auto 16px;
  max-width: var(--bl-measure);
  font-family: var(--font-heading);
}

.books-hero__sub {
  font-size: 16px;
  color: #6a7282;
  line-height: 1.75;
  margin: 0 auto 40px;
  max-width: var(--bl-measure);
  font-family: var(--font-body);
}

/* Narrower than the hero by the sidebar offset, centred in the hero.
   Centring is direction-agnostic, so LTR and RTL need no mirroring. */
.books-hero__search {
  width: calc(100% - var(--bl-column-offset));
  margin: auto;
  position: relative;
}

.books-hero__search-input {
  width: 100%;
  height: 56px;
  padding: 0 20px 0 56px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  font-size: 15px;
  font-family: var(--font-body);
  color: #101828;
  outline: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

  .books-hero__search-input:focus {
    border-color: rgba(138, 21, 56, 0.35);
    box-shadow: 0 0 0 3px rgba(138, 21, 56, 0.08), 0 1px 3px rgba(0, 0, 0, 0.08);
  }

  .books-hero__search-input::placeholder {
    color: #99a1af;
  }

.books-hero__search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: #99a1af;
  pointer-events: none;
  display: flex;
  align-items: center;
}

/* ============================================
   CATALOG LAYOUT
   ============================================ */
.catalog-section {
  padding: 48px 0 80px;
  background: #faf9f6;
}

.catalog-section__container {
  max-width: var(--bl-container);
  margin: 0 auto;
  padding: 0 var(--bl-pad);
  display: flex;
  gap: var(--bl-gap);
  align-items: flex-start;
}

.catalog-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ============================================
   SORT BAR
   ============================================ */
.sort-bar {
  background: #fff;
  border: 1px solid #f3f4f6;
  border-radius: 14px;
  height: 80px;
  padding: 0 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 100;
}

.sort-bar__dropdown {
  position: relative;
}

.sort-bar__dropdown-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 284px;
  height: 44px;
  padding: 0 16px;
  background: #f9fafb;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  color: #101828;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

  .sort-bar__dropdown-btn:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
  }

  .sort-bar__dropdown-btn svg {
    color: #6a7282;
    flex-shrink: 0;
    transition: transform 0.2s ease;
  }

  .sort-bar__dropdown-btn[aria-expanded="true"] svg {
    transform: rotate(-180deg);
  }

.sort-bar__dropdown-list {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 210px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
  z-index: 1000;
  padding: 6px 0;
  list-style: none;
  margin: 0;
}

  .sort-bar__dropdown-list.is-open {
    display: block;
  }

.sort-bar__sort-option {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
  font-family: var(--font-body);
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}

  .sort-bar__sort-option:hover {
    background: #f9fafb;
    color: #101828;
  }

  .sort-bar__sort-option.is-selected {
    color: #8a1538;
    font-weight: 600;
  }

.sort-bar__result-count {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}

.sort-bar__result-label {
  color: #6a7282;
  font-weight: 400;
  font-family: var(--font-body);
}

.sort-bar__result-num {
  font-weight: 700;
  color: #101828;
  font-family: var(--font-body);
}

@media (max-width: 480px) {
  .sort-bar__dropdown-btn {
    min-width: 190px;
  }
}
/* ============================================
   BOOK CARDS
   ============================================ */
.books-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
}

/* Empty state */
.books-grid__empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 24px;
  color: #99a1af;
  font-family: var(--font-body);
  font-size: 15px;
}

  .books-grid__empty svg {
    opacity: 0.5;
  }

.book-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--radius-card);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-card);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  cursor: pointer;
  position: relative;
}

  .book-card:hover {
    box-shadow: var(--shadow-card-hover);
  }

    .book-card:hover .book-card__img {
      transform: scale(1.04);
    }

.book-card__img-wrap {
  position: relative;
  height: 270px;
  overflow: hidden;
  flex-shrink: 0;
}

.book-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.book-card__cover-placeholder,
.book-card__img-placeholder {
  width: 100%;
  height: 100%;
  display: block;
}

.book-card__badge {
  position: absolute;
  top: 12px;
  right: 12px;
  width: fit-content;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #101828;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-family: var(--font-body);
}

.book-card__body {
  padding: 16px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.book-card__stars {
  display: flex;
  align-items: center;
  gap: 2px;
}

.book-card__rating {
  font-size: 12px;
  color: #99a1af;
  margin-right: 4px;
  font-family: var(--font-body);
}

.book-card__title {
  font-size: 16px;
  font-weight: 700;
  color: #101828;
  line-height: 1.35;
  margin: 0;
  font-family: var(--font-heading);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.book-card__author {
  font-size: 13px;
  color: #6a7282;
  margin: 0;
  line-height: 1.4;
  font-family: var(--font-body);
}

.book-card__footer {
  padding: 12px 16px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.book-card__price {
  font-size: 16px;
  font-weight: 700;
  color: #8a1538;
  line-height: 1;
  font-family: var(--font-body);
}

.book-card__price--free {
  color: #059669;
}

.book-card__original-price {
  display: block;
  font-size: 12px;
  color: #9ca3af;
  text-decoration: line-through;
  line-height: 1.3;
  font-family: var(--font-body);
}

.book-card__wishlist {
  width: 36px;
  height: 36px;
  background: #f9fafb;
  border: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6a7282;
  transition: color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

  .book-card__wishlist:hover {
    color: #8a1538;
    background: rgba(138, 21, 56, 0.08);
  }

  .book-card__wishlist.is-active {
    color: #8a1538;
  }

    .book-card__wishlist.is-active svg {
      fill: #8a1538;
      stroke: #8a1538;
    }

/* ============================================
   PAGINATION
   ============================================ */
.catalog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 32px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 6px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  color: #4a5565;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  font-family: var(--font-body);
}

  .page-btn:hover {
    border-color: rgba(138, 21, 56, 0.3);
    color: #8a1538;
    background: rgba(138, 21, 56, 0.04);
  }

  .page-btn.is-active {
    background: #8a1538;
    border-color: #8a1538;
    color: #fff;
    font-weight: 700;
    pointer-events: none;
  }

.page-btn--nav svg {
  transform: scaleX(-1);
}

.page-btn--nav {
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #4a5565;
  transform: scaleX(-1);
}

  .page-btn--nav:hover {
    border-color: rgba(138, 21, 56, 0.3);
    color: #8a1538;
  }

  .page-btn--nav[disabled],
  .page-btn--nav[aria-disabled="true"] {
    opacity: 0.35;
    pointer-events: none;
  }

/* ============================================
   FILTER SIDEBAR
   ============================================ */
.filter-sidebar {
  width: var(--bl-sidebar);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  order: -1; /* In LTR flex, order:-1 places sidebar first = leftmost */
  background: #fff;
  border: 1px solid #f3f4f6;
  border-radius: 14px;
  padding: 4px 20px;
  box-shadow: var(--shadow-sm);
}

  .filter-sidebar::-webkit-scrollbar {
    width: 4px;
  }

  .filter-sidebar::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 4px;
  }

.filter-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 25px 0;
  border-bottom: 1px solid #f0f1f3;
}

.filter-sidebar__title {
  font-size: 18px;
  font-weight: 700;
  color: #101828;
  margin: 0;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-sidebar__reset-btn {
  font-size: 13px;
  color: #8a1538;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-body);
  font-weight: 600;
  transition: opacity 0.2s;
}

  .filter-sidebar__reset-btn:hover {
    opacity: 0.75;
  }

/* Filter Section */
.filter-section {
  border-bottom: 1px solid #f0f1f3;
  overflow: hidden;
}

  .filter-section:last-child {
    border-bottom: none;
  }

.filter-section__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: right;
}

  .filter-section__toggle:focus-visible {
    outline: 2px solid rgba(138, 21, 56, 0.4);
    outline-offset: -2px;
  }

.filter-section__label {
  font-size: 15px;
  font-weight: 700;
  color: #101828;
  font-family: var(--font-body);
}

.filter-section__chevron {
  color: #99a1af;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-section.is-open .filter-section__chevron {
  transform: rotate(-180deg);
}

.filter-section__body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.25s ease;
  padding: 0;
}

.filter-section.is-open .filter-section__body {
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 0 0 16px;
}

  .filter-section.is-open .filter-section__body::-webkit-scrollbar {
    display: none;
  }

/* Filter options */
.filter-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  cursor: pointer;
  user-select: none;
}

  .filter-opt input[type="checkbox"],
  .filter-opt input[type="radio"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: #8a1538;
    flex-shrink: 0;
    margin: 0;
  }

.filter-opt__label {
  font-size: 14px;
  color: #4a5565;
  cursor: pointer;
  line-height: 1.4;
  font-family: var(--font-body);
  flex: 1;
}

.filter-opt:hover .filter-opt__label {
  color: #101828;
}

.filter-opt input:checked + .filter-opt__label {
  color: #8a1538;
  font-weight: 700;
}

/* More button */
.filter-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #8a1538;
  background: none;
  border: none;
  padding: 6px 0;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  transition: opacity 0.2s;
}

  .filter-more-btn:hover {
    opacity: 0.75;
  }

/* Price Range */
.filter-price-wrap {
  padding: 4px 0 8px;
}

.filter-price-slider {
  width: 100%;
  cursor: pointer;
  accent-color: #8a1538;
  margin-bottom: 6px;
}

.filter-price-labels {
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  font-size: 12px;
  color: #6a7282;
  font-family: var(--font-body);
}

/* Rating filter */
.filter-rating-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  cursor: pointer;
  user-select: none;
}

  .filter-rating-row input[type="radio"] {
    width: 17px;
    height: 17px;
    accent-color: #8a1538;
    flex-shrink: 0;
    margin: 0;
  }

.filter-rating-stars {
  display: flex;
  align-items: center;
  gap: 2px;
}

.filter-rating-and-up {
  font-size: 12px;
  color: #6a7282;
  font-family: var(--font-body);
  white-space: nowrap;
}

/* ============================================
   MOBILE FILTER TOGGLE
   ============================================ */
.filter-mobile-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  background: #8a1538;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

  .filter-mobile-toggle:hover {
    opacity: 0.88;
  }

.filter-overlay {
  display: none;
  position: fixed;
  top: var(--header-height);
  right: 0;
  left: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1090;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

  .filter-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

/* Drawer slides in from the RIGHT */
.filter-drawer {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 320px;
  max-width: 90vw;
  height: calc(100% - var(--header-height));
  background: #fff;
  z-index: 1100;
  overflow-y: auto;
  padding: 24px 20px;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

  .filter-drawer.is-open {
    transform: translateX(0);
  }

.filter-drawer__close {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.filter-drawer__close-title {
  font-size: 18px;
  font-weight: 700;
  color: #101828;
  font-family: var(--font-body);
}

.filter-drawer__close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #6a7282;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

  .filter-drawer__close-btn:hover {
    color: #101828;
  }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1280px) {
  :root {
    --bl-pad: 40px;
    --bl-sidebar: 270px;
    --bl-gap: 32px;
  }
}

/* Sidebar is gone below this width, so there is no column to align to —
   the search returns to the full content width. */
@media (max-width: 1024px) {
  :root {
    --bl-pad: 32px;
    --bl-gap: 0px;
    --bl-column-offset: 0px;
  }

  .filter-sidebar {
    display: none;
  }

  .filter-mobile-toggle {
    display: inline-flex;
  }

  .filter-overlay {
    display: block;
  }

  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .sort-bar {
    height: 72px;
  }

  .books-hero__title {
    font-size: 40px;
  }
}

@media (max-width: 768px) {
  :root {
    --bl-pad: 20px;
  }

  .catalog-section {
    padding: 32px 0 60px;
  }

  .catalog-section__container {
    flex-direction: column;
    align-items: stretch;
  }

  .books-hero {
    padding: calc(var(--header-height) + 32px) 0 48px;
  }

  .books-hero__title {
    font-size: 32px;
  }

  .books-hero__sub {
    font-size: 15px;
    margin-bottom: 28px;
  }

  .books-hero__search-input {
    height: 50px;
  }

  .sort-bar {
    height: auto;
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .book-card__img-wrap {
    height: 190px;
  }

  .book-card__title {
    font-size: 14px;
  }

  .book-card__price {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .books-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .book-card__img-wrap {
    height: 220px;
  }
}

/* ============================================
   GSAP INITIAL STATES
   ============================================ */
.js-hero-fade {
  opacity: 0;
  transform: translateY(24px);
}

.books-grid .book-card {
  opacity: 0;
  transform: translateY(20px);
}

.js-sidebar-fade {
  opacity: 0;
  transform: translateX(16px);
}

.js-sortbar-fade {
  opacity: 0;
  transform: translateY(-10px);
}

@media (prefers-reduced-motion: reduce) {
  .js-hero-fade,
  .books-grid .book-card,
  .js-sidebar-fade,
  .js-sortbar-fade {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   PER-LIST FILTER SEARCH (categories / publishers / authors)
   ============================================================ */
.filter-search {
  margin-bottom: 8px;
}

.filter-search__input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  color: #374151;
  outline: none;
  transition: border-color .15s ease, background .15s ease;
}

  .filter-search__input:focus {
    border-color: #99a1af;
    background: #fff;
  }

  .filter-search__input::placeholder {
    color: #9ca3af;
  }

.filter-options {
  max-height: 320px;
  overflow-y: auto;
}

.filter-options__empty,
.filter-options__hint {
  margin: 6px 2px 0;
  font-size: 12px;
  color: #6a7282;
}

  .filter-options__empty[hidden],
  .filter-options__hint[hidden] {
    display: none;
  }
