/* ==========================================================================
   Cognitive Pharmacy - Books Grid Widget
   أنماط هيكلية أساسية فقط. كل الألوان/الحدود/المقاسات القابلة للتحكم تأتي
   من CSS التي يولّدها Elementor تلقائيًا اعتمادًا على إعدادات الويدجت.
   ========================================================================== */

.cp-books-grid-wrapper {
  width: 100%;
}

.cp-books-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  row-gap: 15px;
  column-gap: 15px;
  align-items: stretch;
}

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

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

.cp-books-grid__item {
  display: flex;
}

/* الألوان أدناه (title/author/price/category/بطاقة نفسها) قيم افتراضية فقط، مبنية على
   متغيرات Elementor Global Colors الفعلية للموقع (var(--e-global-color-*)). أي ويدجت
   Elementor مُخصَّص فعليًا يبقى يتفوّق عليها دائمًا (محدّد {{WRAPPER}} أعلى دقة) - فتبقى
   الصفحة الرئيسية كما هي بالضبط. الغاية فقط أن تحصل صفحات القوالب الخام (صفحة الكتاب
   المفردة/صفحة المؤلف المفردة - لا تمر عبر Elementor إطلاقًا) على نفس شكل الكارت المعتاد
   بدل الاعتماد على لون النص المحيط بها بالصدفة. */
.cp-book-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  background: var(--e-global-color-3bca2e6, #ffffff);
  border: 1px solid var(--e-global-color-text, #30465a);
  border-radius: 10px;
  overflow: hidden;
  box-sizing: border-box;
}

.cp-book-card__badge {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  z-index: 2;
  background: #222222;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.cp-book-card__media {
  position: relative;
  display: block;
  width: 100%;
  height: 275px;
  overflow: hidden;
  background: #efeae0;
}

.cp-book-card__media-link {
  display: block;
  width: 100%;
  height: 100%;
}

.cp-book-card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.cp-book-card__body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  padding: 12px 12px 12px;
  box-sizing: border-box;
  min-width: 0;
}

.cp-book-card__category {
  align-self: flex-start;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.25;
  margin: 0 0 7px;
  color: var(--e-global-color-742c12a, #6a6a6a);
  opacity: 1;
}

.cp-book-card__title {
  margin: 0 0 7px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--e-global-color-text, #30465a);
  letter-spacing: 0;
}

.cp-book-card__title a {
  color: inherit;
  text-decoration: none;
}

.cp-book-card__author {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--e-global-color-primary, #bd6e53);
  opacity: 1;
  margin: 0;
}

.cp-book-card__price {
  margin-top: 11px;
  padding-top: 0;
  font-weight: 700;
  font-size: 25px;
  line-height: 1.1;
  color: var(--e-global-color-text, #30465a);
}

.cp-book-card__currency {
  font-weight: 400;
  font-size: 0.68em;
  margin-inline-start: 4px;
  opacity: 0.85;
}

.cp-book-card__actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  margin-top: auto;
  padding-top: 16px;
}

.cp-book-card__actions--stretch .cp-book-card__btn {
  width: auto;
  aspect-ratio: auto;
}

.cp-book-card__actions--stretch .cp-book-card__btn--cart {
  flex: 0 0 41px;
  width: 41px;
  padding: 0;
}

.cp-book-card__actions--stretch .cp-book-card__btn--whatsapp {
  flex: 1 1 auto;
  min-width: 0;
}

.cp-book-card__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 41px;
  min-width: 0;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
  gap: 8px;
  padding: 0;
  white-space: nowrap;
  transition:
    background-color 0.2s ease,
    transform 0.15s ease,
    opacity 0.2s ease;
  box-sizing: border-box;
}

.cp-book-card__btn--has-label {
  aspect-ratio: unset;
  padding-inline: 18px;
}

.cp-book-card__btn-text {
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.cp-book-card__btn:active {
  transform: scale(0.97);
}

.cp-book-card__btn--cart {
  background-color: #252525;
  color: #ffffff;
}

.cp-book-card__btn--cart.is-added {
  background-color: #2e7d32;
}

.cp-book-card__btn--whatsapp {
  background-color: #22d366;
  color: #ffffff;
}

.cp-books-empty {
  width: 100%;
  text-align: center;
  padding: 50px 20px;
  opacity: 0.6;
  font-size: 15px;
}

.cp-books-load-more-row {
  text-align: center;
  margin-top: 30px;
}

.cp-books-load-more-btn {
  padding: 11px 30px;
  border-radius: 30px;
  border: 1px solid currentColor;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    opacity 0.2s ease;
}

.cp-books-load-more-btn:hover {
  background: #1f1f1f;
  color: #fff;
}

.cp-books-load-more-btn.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

/* 1.1.4: fixed Font Awesome 5 card icons + website Global Color hover states. */
.cp-book-card__btn--cart:hover,
.cp-book-card__btn--cart:focus-visible {
  background-color: var(--e-global-color-primary, #a9512f) !important;
  color: #ffffff !important;
  fill: #ffffff !important;
}

.cp-book-card__btn--whatsapp:hover,
.cp-book-card__btn--whatsapp:focus-visible {
  background-color: var(--e-global-color-accent, #d28e74) !important;
  color: #ffffff !important;
  fill: #ffffff !important;
}

.cp-book-card__btn i.fas.fa-shopping-cart {
  display: inline-block;
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  font-style: normal;
  font-variant: normal;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
}

.cp-book-card__btn i.fab.fa-whatsapp {
  display: inline-block;
  font-family: "Font Awesome 5 Brands";
  font-weight: 400;
  font-style: normal;
  font-variant: normal;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
}
