
/* ===============================
  عکس های صفحات داخل کتاب
================================ */
.view-inside-book-btn {
    margin-top: 10px;
    padding: 8px 12px;
    background: #fafafa;
    color: #000;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 5px 3px 1px rgba(90, 100, 171, .13);
}

.view-inside-book-btn:hover {
    background: #fff;
}
.view-inside-book-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.view-inside-book-btn .btn-icon {
    width: 18px;
    height: 18px;
}    

/* مودال */
/* مودال اصلی */
.book-gallery-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden; /* جلوگیری از اسکرول داخل مودال */
}

/* تصویر */
.book-gallery-modal img {
    max-width: 90%;
    max-height: 70vh; /* فضای بیشتر برای نوارها */
    border-radius: 8px;
    transition: transform 0.3s ease; /* انیمیشن زوم */
    transform: scale(1); /* زوم اولیه */
}

/* نوار بالا */
.book-gallery-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px;
    display: flex;
    justify-content: flex-end;
    background: rgba(0, 0, 0, 0.5); /* نیمه‌شفاف */
}

.book-gallery-close {
    font-size: 32px;
    color: #fff;
    cursor: pointer;
}

/* نوار پایین */
.book-gallery-bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.5); /* نیمه‌شفاف */
    gap: 20px; /* فاصله بین المان‌ها */
}

.book-gallery-nav {
    font-size: 30px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
}

.book-gallery-zoom {
    font-size: 24px;
    background: none;
    border: 1px solid #fff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: #fff;
    cursor: pointer;
}

.book-gallery-counter {
    font-size: 18px;
    color: #fff;
}

/* برای موبایل: مطمئن شدن از responsive */
@media (max-width: 768px) {
    .book-gallery-modal img {
        max-height: 60vh;
    }
    .book-gallery-bottom-bar {
        gap: 10px;
    }
}

/* مخفی کردن دکمه جزئیات بیشتر در دسکتاپ */
  .mobile-details-btn {
    display: none !important;
  }

/* ===============================
   قسمت کارت های مشترک کتاب
================================ */

.book-product-card {
    display: grid;
    grid-template-columns: 210px 1fr 260px 220px;
    gap: 24px;
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 18px; /* فاصله ترجمه‌ها */
    box-shadow: 0 10px 34px rgba(0,0,0,0.06);
    align-items: start;
}

/*==== تصویر کتاب =====*/

.book-image-link{
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;

    overflow: hidden;
    cursor: pointer;
}

.book-image-link img{
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;
    object-position: center;
}

/* روبان یشنهاد ما */

.book-image {
    position: relative;       /* خیلی مهم — روبان نسبت به این div定位 می‌شود */
    overflow: hidden;         /* برای اینکه قسمت‌های بیرون روبان بریده شود */
    border-radius: 8px;       /* اگر می‌خواهی گوشه‌های تصویر گرد باشد */
}

.featured-ribbon {
    position: absolute;
    top: 14px;
    right: -50px;
    z-index: 10;
    background: #e91e63;        /* رنگ اصلی — مثلاً صورتی/قرمز جذاب */
    color: white;
    font-weight: 400;
    font-size: 12px;
    padding: 2px 50px;
    transform: rotate(45deg);
    transform-origin: center;
}


/* ستون اطلاعات کتاب */
.book-identity p {
    font-size: 14px;
    margin: 4px 0;
    color: #444;
}
.book-subtitle {
    font-size: 13px;
    color: #777;
    font-style: italic;
    margin: 2px 0 8px;
}
/* امتیاز ستاره‌ای */
.book-rating {
    display: flex;
    gap: 4px;
    font-size: 18px;
    cursor: pointer;
}

.book-rating span {
    color: #ccc;
    transition: color .15s ease;
}

.book-rating span.active,
.book-rating span.hover {
    color: #f5a623;
}

.book-rating.rated {
    pointer-events: none;
    opacity: .9;
}

.book-rating-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.book-rating-number {
    font-size: 13px;
    color: #555;
}
/* ستون مشخصات */
.book-specs ul {
    list-style: none;
    padding: 0;
    margin: 10px 0;
    font-size: 14px;
}

.book-specs li {
    margin-bottom: 6px;
    color: #444;
}

/* ===============================
   ستون افزودن به سبد خرید و اطلاع از موجودی
================================ */

/* ستون چهارم */
.book-col.book-buy {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;

    padding: 0 10px;
    box-sizing: border-box;
}

/* باکس داخلی */
.book-buy .buy-box {
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /*چسبیدن به انتهای ستون*/
    height: 100%;
}

/* بالای ستون: زودترین زمان ارسال */
.book-shipping-time {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 11px;
    color: #000;
    margin-bottom: 12px;
}

.book-shipping-time img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
}

/* قیمت – دسکتاپ */
.book-price-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 12px;
}

.book-old-price {
    font-size: 13px;
    color: #777;
    text-decoration: line-through;
}

.book-new-price {
    font-size: 20px;
    font-weight: 600;
    color: #000;
}

.book-discount {
    background: #e53935;
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 600;
}
/* ===== قیمت – دسکتاپ (فیکس قطعی) ===== */
@media (min-width: 769px) {

  .book-price-box {
    display: grid;
    grid-template-columns: auto auto;
    grid-template-areas:
      "old old"
      "discount new";
    gap: 6px;
    justify-content: center;
    align-items: center;
  }

  .book-old-price {
    grid-area: old;
    text-align: center;
  }

  .book-discount {
    grid-area: discount;
    justify-self: end;
  }

  .book-new-price {
    grid-area: new;
    justify-self: start;
  }
}

/* قیمت‌های موبایل*/

@media (max-width: 768px) {

  .book-price-box {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "old old"        /* خط اول: فقط قیمت قدیم */
      "discount new";   /* خط دوم: تخفیف + قیمت جدید */
    gap: 4px 9px;
    align-items: center;
    margin: 10px 0 15px 0;
    width: 100%;
  }

  .book-old-price {
    grid-area: old;
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
    justify-self: center;   /* وسط خط اول */
  }

  .book-discount {
    grid-area: discount;
    background: #e53935;
    color: #fff;
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    justify-self: start;
  }

  .book-new-price {
    grid-area: new;
    font-size: 16px;
    font-weight: 700;
    color: #e53935;
    justify-self: end;
  }
}

/* دکمه‌های خرید و خبرم کن */
.action-box {
    width: 100%;
    display: flex;
    flex-direction: column;
}
.action-box .buy-btn {
    margin-top: auto;
}

.book-buy .buy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 12px 4px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    overflow: hidden;
    transition: all .2s ease;
}

.out-of-stock-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: #e53935;
    font-weight: 500;
}

/* دکمه افزودن به سبد */
.add_to_cart_button {
    background: #e53935;
    color: #fff !important;
}

.add_to_cart_button:hover {
    background: #d32f2f;
}

/* دکمه خبرم کن */
.notify-btn {
    background: #f7c948;
    color: #fff !important;
}

.notify-btn:hover {
    background: #f1b400;

}

.book-buy .buy-btn.added img {
    display: none;
}

.book-buy .buy-btn.added .btn-loading {
    display: none;
}

.book-buy .buy-btn.added .btn-success {
    display: inline-flex;
}

.book-buy .buy-btn.added .btn-text {
    display: inline;
}
.btn-success {
    display: none;
}

/* Loading  - تایید افزودن به سبد خرید */
.btn-loading {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.buy-btn.loading {
    pointer-events: none;
    opacity: .8;
}

.buy-btn.loading img,
.buy-btn.loading .btn-text,
.buy-btn.loading .btn-icon {
    display: none;
}

.buy-btn.loading .btn-loading {
    display: block;
}
/* آیکون داخل دکمه سبد خرید */
.book-buy .buy-btn img,
.book-buy .btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    filter: brightness(0) invert(1);  /*سفید کردن آیکون دکه سبد خرید*/
}

.book-buy .btn-loading,
.book-buy .btn-success {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}


.buy-btn.added {
    background: #2e7d32 !important;
    color: #fff;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ستون خرید – Modal notify */

.notify-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.notify-box {
    background: #fff;
    width: 90%;
    max-width: 360px;
    padding: 20px;
    border-radius: 12px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notify-box h3 {
    font-size: 16px;
    text-align: center;
}

.notify-box input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.notify-submit {
    background: #e53935;
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
}

.notify-close {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 22px;
    cursor: pointer;
}
.added_to_cart.wc-forward {
    display: none !important;
}

/* ====================== مودال جزئیات کتاب در موبایل ====================== */
.book-mobile-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.book-mobile-modal.active {
    display: block;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    max-height: 90vh;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
}

.book-mobile-modal.active .modal-sheet {
    transform: translateY(0);
}

/* ─── Header ─────────────────────────────────────────────── */
.modal-header {
    padding: 12px 20px;
    background: #f2f2f2;
    color: #686868;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    position: absolute;
    inset-inline-start: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 22px;
    color: #ff0000;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Scrollable Content ─────────────────────────────────── */
.modal-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 8px 20px 20px;
    -webkit-overflow-scrolling: touch;
}

/* ─── Fixed Bottom Section ───────────────────────────────── */
.modal-fixed-bottom {
    padding: 10px 16px 22px;
    background: white;
    box-shadow: 0px -3px 5px 0px rgba(0, 0, 0, .06);
    flex-shrink: 0;
}

/* ─── Content Styling (identity + specs) ─────────────────── */
.modal-scrollable .book-identity,
.modal-scrollable .book-specs {
    margin: 0;
    padding: 0;
}

.modal-scrollable .book-identity .product-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.9em;
    color: #111;
}

.modal-scrollable .book-identity p,
.modal-scrollable .book-specs li {
    margin: 0.65em 0;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.45;
    border: none !important;
    list-style: none;
}

.modal-scrollable .book-identity strong,
.modal-scrollable .book-specs strong {
    font-weight: 600;
    color: #222;
    margin-left: 0.4em;
    display: inline;
}

.modal-scrollable .book-identity a,
.modal-scrollable .book-identity span:not(.book-rating-wrap),
.modal-scrollable .book-specs li:not(:has(strong)) {
    color: #444;
    font-weight: 400;
}

.modal-scrollable .book-specs {
    margin-top: 1.1em;           /* فاصله ملایم از بخش هویت */
}

.modal-scrollable .book-specs ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.modal-scrollable .book-specs li {
    border: 0 !important;
    padding-bottom: 0.1em;
}

/* ─── Price / Out of stock message ───────────────────────── */
.modal-price .out-of-stock-msg {
    padding: 16px 0;
    font-size: 1.1rem;
    color: #d32f2f;
    text-align: center;
    font-weight: 500;
}

/* ─── Action Buttons (Add to cart / Notify) ──────────────── */
.modal-actions .buy-btn,
.modal-actions .notify-btn,
.modal-actions .full-width-action {
    width: 100% !important;
    min-height: 40px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1rem;
    padding: 0 20px;
    border-radius: 12px;
    box-sizing: border-box;
    white-space: nowrap;
}

.modal-actions .buy-btn img,
.modal-actions .notify-btn img {
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    object-fit: contain;
    flex-shrink: 0;
}

.modal-actions img {
    max-width: 28px;
    max-height: 28px;
}

/* رنگ‌های پیشنهادی دکمه‌ها */
.modal-actions .buy-btn {
    background-color: #4CAF50;     /* سبز برای موجود */
    color: white;
    font-weight: 600;
}

.modal-actions .notify-btn {
    background: #f7c948;           /* زرد برای خبرم‌کن */
    color: white;
}
.modal-price {
    margin: 0.3em 0.3em 0.3em 0.3em;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    color: #000; 
    border-top: dashed;
}

.modal-price .new-price {
    color: #e91e63;
    font-size: 0.95rem;
}

.modal-price .old-price {
    color: #999;
    text-decoration: line-through;
    margin-left: 0.6em;
    font-size: 0.75rem;
}

.modal-price .discount {
    background: #ff5252;
    color: white;
    font-size: 0.85rem;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 0.6em;
}

.modal-price .out-of-stock-msg {
    padding: 16px 0;
    font-size: 1.1rem;
    color: #d32f2f;
    text-align: center;
    font-weight: 500;
}
/* مهم: نمایش اجباری مشخصات داخل مودال */
.book-mobile-modal .book-specs {
    display: block !important;
}
.book-mobile-modal .book-shipping-time {
    display: flex !important;
}
/*-------------- انتهای مودال جزئیات کتاب ------------*/

/*---پیغام سبد خرید ایجکس در صفحه محصول ----*/
#custom-cart-notice{
    position: fixed;
    top: 20px;
    left: 20px;
    background: #2ecc71;
    color: #fff;
    padding: 12px 18px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 999999;
    display: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

/*-----مودال سایر نویسندگان----*/
.simple-modal{
    display:none;
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.4);
    z-index:999999;
    align-items:center;
    justify-content:center;
}

.simple-modal-box{
    background:#fff;
    padding:20px;
    border-radius:8px;
    max-width:400px;
    width:90%;
    position:relative;
}

.simple-modal-close{
    position:absolute;
    top:8px;
    left:12px;
    cursor:pointer;
    font-size:18px;
}

/* ====================== موبایل ====================== */

@media (max-width: 768px) {
  .container {
      padding: 0 6px;
  }
}

@media (max-width: 768px) {
  .book-product-card {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    column-gap: 12px;
    gap: 16px;
    padding: 10px;
    border-radius: 10px;
  }
}

@media (max-width: 768px) {
    .modal-scrollable .book-identity .product-title {
    font-size: 1rem;
    }
}


@media (max-width: 768px) {
  .book-buy {
    width: 100%;
    min-width: 0; /* 👈 خیلی مهم */
  }
}

@media (max-width: 768px) {
    .book-col.book-buy {
      padding: 0 10px;
    }
}

@media (max-width: 768px) {
  .book-buy .buy-btn,
  .book-buy .notify-btn {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* تصویر → راست */
  .book-image {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    justify-self: center;
  }
/* کراپ عکس */
.book-image {
  overflow: hidden;      /* 👈 خیلی مهم */
  border-radius: 12px;
  height: 193px;
}

.book-image img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  object-position: center center; /* یا center top */
}

  /* هویت → چپ بالا */
  .book-identity {
    grid-column: 2 / 3;
    grid-row: 1;
  }

  /* ستون خرید → چپ پایین (فقط دکمه سبد خرید دیده میشه) */
  .book-buy {
    grid-column: 2 / 3;
    grid-row: 3;
    padding: 0;
  }

  /* دکمه جزئیات → راست پایین */
  .mobile-details-btn {
    grid-column: 1 / 2;
    grid-row: 3;
    display: flex !important;
    margin: 0;
  }

  /* مشخصات مخفی */
  .book-specs {
    display: none !important;
  }
/* زودترین زمان ارسال مخفی */
.book-shipping-time {
   display: none !important; 
  }
}

/* تراز شدن دکمه‌ها در پایین‌ترین نقطه ستون‌ها */
@media (max-width: 768px) {

  .book-buy {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 88px; /* 👈 عدد طلایی */
  }

  .mobile-details-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin-top: auto; /* 👈 کلید طلایی */
  }
}


/* -----------تنظیم فونت و مرتب کردن سلسله مراتب------------ */

/* عنوان دو خطی و از کادر نزنه بیرون */
@media (max-width: 768px) {

  .book-identity h3 {
    white-space: normal;        /* 👈 مهم */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;      /* نهایتاً ۲ خط */
    -webkit-box-orient: vertical;
    line-height: 1.45;
    font-size: 15px;
  }
}

  /* زیرعنوان */
  .book-subtitle {
    font-size: 11px;
    margin-bottom: 8px;
    color: #777;
  }

  /* امتیاز */
  .book-rating-wrap {
    font-size: 12px;
    margin-bottom: 8px;
  }

  /* نویسنده / مترجم / ناشر */
  .book-identity p {
    font-size: 12px;
    margin-bottom: 4px;
    color: #444;
  }


@media (max-width: 768px) {

  .book-buy .buy-btn {
    font-size: 13px;
    padding: 0px;
    border-radius: 10px;
    height: 44px;              /* touch-friendly */
  }

  .book-buy .buy-btn img {
    width: 15px;
    height: 15px;
  }
}
/* دکمه جزئیات */
@media (max-width: 768px) {

  .mobile-details-btn {
    height: 44px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 0 6px;
  }

  .mobile-details-btn .arrow {
    font-size: 18px;
    opacity: 0.6;
  }
}

/* امتیاز: یک‌خطی و فشرده */
@media (max-width: 768px) {

  .book-rating-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    white-space: nowrap;
  }

  .book-rating span {
    font-size: 12px;
  }

  .book-rating-number,
  .book-rating-count {
    font-size: 11px;
    color: #666;
  }
}

/* روبان یشنهاد ما */
@media (max-width: 640px) {
    .book-image.has-ribbon::after {
        top: 8px;
        right: -32px;
        font-size: 10px;
        padding: 5px 40px;
    }
}
/* پایان مودال جزئیات کتاب در موبایل */
