/* =================================================================== */
/* Custom Modal Styles (No Bootstrap)
/* =================================================================== */

/* لایه پس‌زمینه تیره */
.custom-modal {
  display: none; /* پیش‌فرض مخفی */
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.7); /* رنگ سیاه با شفافیت */
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* کلاس کمکی برای نمایش مودال */
.custom-modal.is-visible {
  display: flex;
  opacity: 1;
}

/* باکس اصلی مودال */
.custom-modal-content {
  background-color: #fefefe;
  margin: auto;
  padding: 0;
  border: 1px solid #888;
  width: 90%;
  max-width: 700px; /* حداکثر عرض */
  border-radius: 10px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
  position: relative;
  animation-name: modalanim;
  animation-duration: 0.4s;
}

/* انیمیشن باز شدن */
@keyframes modalanim {
  from {
    top: -50px;
    opacity: 0;
  }
  to {
    top: 0;
    opacity: 1;
  }
}

/* هدر مودال */
.custom-modal-header {
  padding: 15px 20px;
  background-color: #f1f1f1;
  border-bottom: 1px solid #ddd;
  border-radius: 10px 10px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  color: #333;
}

/* دکمه بستن (ضربدر) */
.custom-close-btn {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.custom-close-btn:hover,
.custom-close-btn:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

/* بدنه مودال */
.custom-modal-body {
  padding: 10px;
}

/* استایل برای iframe آپارات */
.h_iframe-aparat_embed_frame {
  position: relative;
}
.h_iframe-aparat_embed_frame .ratio {
  display: block;
  width: 100%;
  height: auto;
}
.h_iframe-aparat_embed_frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 0 0 10px 10px;
}

/* =================================================================== */
/* 1. Global Resets & Helpers
/* =================================================================== */
div,
span,
h3,
p,
i {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

.clearfix:before,
.clearfix:after,
.modal-header:before,
.modal-header:after,
.modal-footer:before,
.modal-footer:after {
  display: table;
  content: " ";
}

.clearfix:after,
.modal-header:after,
.modal-footer:after {
  clear: both;
}

.post-content p {
  line-height: 200%;
  margin-bottom: 20px;
  font-size: 16px;
  text-align: justify;
  font-weight: 350;
}

.post-content h3 {
  font-size: 18px;
  font-weight: bold;
  margin: 15px 0;
  line-height: 200%;
}

/* =================================================================== */
/* 2. Modal System (Bootstrap-like)
/* =================================================================== */

.modal-backdrop {
  z-index: 1040 !important; /* بک‌دراپ در لایه پایینی */
}

.modal {
  z-index: 1050 !important; /* مودال در لایه بالایی */
  /* مطمئن شوید که display: none در حالت اولیه برای modal وجود دارد */
}
.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1050 !important;
  display: none;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  outline: 0;
  --bs-modal-zindex: 1055;
  --bs-modal-padding: 1rem;
  --bs-modal-margin: 0.5rem;
}

.modal.fade .modal-dialog {
  transform: translate(0, -25%);
  transition: transform 0.3s ease-out;
  width: 40%; /* این مقدار در مدیا کوئری‌ها بازنویسی می‌شود */
}

.modal.in .modal-dialog {
  transform: translate(0, 0);
}

.modal-dialog {
  position: relative;
  width: auto;
  margin: 10px;
}

.modal-dialog-centered {
  display: flex;
  min-height: calc(100% - var(--bs-modal-margin) * 2);
  flex-direction: column;
  justify-content: center;
}

.modal-content {
  position: relative;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #999;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
  outline: 0;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: #000;
  z-index: 1040 !important;
}

.modal-backdrop.fade {
  filter: alpha(opacity=0);
  opacity: 0;
}

.modal-backdrop.in {
  filter: alpha(opacity=50);
  opacity: 0.5;
}

.modal-header {
  padding: 15px;
  border-bottom: 1px solid #e5e5e5;
}

.modal-title {
  margin: 0;
  line-height: 1.42857143;
}

.modal-body {
  position: relative;
  padding: 15px;
}

.modal-footer {
  padding: 15px;
  text-align: right;
  border-top: 1px solid #e5e5e5;
}

.modal-footer .btn + .btn {
  margin-bottom: 0;
  margin-left: 5px;
}

.modal-footer .btn-group .btn + .btn {
  margin-left: -1px;
}

.modal-footer .btn-block + .btn-block {
  margin-left: 0;
}

.modal-scrollbar-measure {
  position: absolute;
  top: -9999px;
  width: 50px;
  height: 50px;
  overflow: scroll;
}

/* Fade Transition */
.fade {
  opacity: 0;
  transition: opacity 0.15s linear;
}

.fade.in {
  opacity: 1;
}

/* Close Button */
.close {
  float: right;
  font-size: 30px;
  font-weight: bold;
  line-height: 1;
  color: #0699fd;
  text-shadow: 0 1px 0 #fff;
  filter: alpha(opacity=20);
}

.close:hover,
.close:focus {
  color: #000;
  text-decoration: none;
  cursor: pointer;
  filter: alpha(opacity=50);
  opacity: 0.5;
}

button.close {
  padding: 0;
  cursor: pointer;
  background: transparent;
  border: 0;
  appearance: none;
}

/* =================================================================== */
/* 3. Icon Font Styles
/* =================================================================== */
.ic {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "liga";
}

.ic-down:before {
  content: "";
}

.ic-play-solid:before {
  content: "";
}

svg.e-font-icon-svg.e-fas-chevron-down {
  width: 16px;
  fill: #122140;
  transition: transform 0.3s ease; /* افزودن انیمیشن نرم */
}

.open svg.e-font-icon-svg.e-fas-chevron-down {
  transform: rotate(180deg);
}

svg.e-font-icon-svg.e-fas-play {
  width: 11px;
  fill: #fff;
}

svg.lock {
  fill: #565658;
}

.foruser:hover svg {
  fill: #fff !important;
}

/* =================================================================== */
/* 4. Chapter / Syllabus Styles
/* =================================================================== */
.chapters-container {
  border: 1px solid #e1e1e1;
  border-radius: 10px;
  background-color: #ffffff;
  padding: 11px 10px;
  margin-bottom: 10px;
  direction: rtl;
}

.chapter-item.chapter {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.chapter-item.chapter.open {
  border-bottom: unset !important;
  border-radius: 10px 10px 0px 0px !important;
}

.chapter-item .chapter-head {
  display: flex;
  background-color: #ffffff;
  border-radius: 15px;
  flex-direction: column;
  color: #7b7b7b;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  font-variation-settings: "dots" 8;
  gap: 6px;
  width: 100%; /* برای کلیک بهتر */
  cursor: pointer;
}

.chapter-item.open .chapter-head {
  border-bottom-color: rgba(0, 0, 0, 0);
}

.chapter-item .chapter-head > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.chapter-item .chapter-head > span {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--color-primary);
}

.chapter-item .chapter-head .chapter-sell {
  font-weight: 500;
  position: relative;
}

.chapter-item .chapter-head .toggle-chapter {
  font-size: 18px;
  text-align: center;
  color: var(--color-primary);
  cursor: pointer;
  transition: 0.5s ease-in;
}

.chapter-item.show .toggle-chapter {
  transform: rotate(180deg);
}

.chapter-item .chapter-head h3 {
  margin: 0;
  color: #565658;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
}

.chapter-items {
  border-top: 1px solid #ececef;
  padding-top: 6px;
  margin-top: 10px;
  display: none; /* برای کارکرد slideToggle */
}

.chapter-items .file {
  display: grid;
  grid-template-columns: 22px auto 57px 67px 0px;
  align-items: center;
  font-size: 15px;
  font-weight: 400;
  justify-items: stretch;
}

.chapter-items .file:not(:last-child) {
  margin-bottom: 10px;
}

.chapter-items .file p {
  font-size: 10px;
  font-weight: 600;
  text-align: right;
  color: #96989a;
}

.chapter-items .file div {
  text-align: center;
}

.chapter-items .video-counter {
  text-align: center;
}

.chapter-items i.video-play {
  font-size: 24px;
  position: relative;
  cursor: pointer;
}

.chapter-items i.video-play.play-locked {
  color: #939090;
}

.chapter-items i.video-play.play-locked:after {
  content: "lock";
  position: absolute;
  font-size: 13px;
  top: -6px;
  left: 18px;
}

.chapter-items .file .access {
  font-size: 18px;
}

.chapter-items .file .access-label {
  background: #00c77f;
  border-radius: 6px;
  padding: 6px;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  position: relative;
  cursor: pointer;
}

.chapter-items .file .access-label.playable {
  padding: 6px 6px 6px 20px;
}

.chapter-items .file .access-label.playable:after {
  /*content: "play-solid";*/
  position: absolute;
  top: 9px;
  font-size: 14px;
  left: 3px;
}

.chapter-title {
  width: 100%;
  line-height: 30px;
  cursor: pointer;
}

.chapter-counter {
  background-color: #fdd406;
  border-radius: 18px !important;
  font-size: 22px !important;
}

.chapter-duration {
  border-right: 2px solid #000f59;
}

.duration {
  font-size: 10px;
  font-weight: 500;
  font-variation-settings: "dots" 8;
  color: #7b7b7b;
}

button.btn.btn-primary.btn-modal {
  background-color: #fdd406;
  padding: 4px 10px;
  border-radius: 4px;
  color: #565658;
  display: flex;
  width: 66px;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 500;
  border: unset;
  transition: background-color 0.3s, color 0.3s; /* انیمیشن هاور */
}

button.btn.btn-primary.btn-modal span {
  padding-right: 4px;
}

button.btn.btn-primary.btn-modal.foruser span {
  padding-left: 2px;
}

button.btn.btn-primary.btn-modal:hover {
  background-color: #565658;
  cursor: pointer;
  color: #fff;
}

/* =================================================================== */
/* 5. Offline Course Box Layout
/* =================================================================== */
.offline-course {
  margin-bottom: 20px;
  padding: 11px 16px 18px 16px;
  border-radius: 20px;
  display: flex;
  box-shadow: 0px 1px 4px 0px #0000001a;
  background-color: #fff;
  color: #3a3a3a;
  flex-wrap: nowrap;
}

.mx-oc-left {
  width: 30%;
  padding-right: 30px;
  display: flex;
  flex-direction: column;
}

.mx-oc-right {
  width: 70%;
  border-left: 1px solid #efefef;
  padding-left: 30px;
}

.mx-oc-right .mx-oc-right {
  border: none;
  padding: 0;
}

.mx-oc-right .mx-oc-left {
  padding: 0;
}

.mx-oc-items {
  display: flex;
  flex-direction: row;
  gap: 12px;
  flex-wrap: nowrap;
  align-items: center;
}

.course-price-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.course-attributes {
  margin-top: auto !important;
  display: flex;
  flex-direction: column;
  border: 1px solid #e1e1e1;
  padding: 10px;
  border-radius: 14px;
  gap: 8px;
  width: 100%;
}

.course-attributes .item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.offline-course-right {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  justify-content: flex-start;
  padding-left: 9px;
  gap: 11px;
}

.offline-course-right h2 {
  font-size: 18px;
  font-weight: 700;
  color: #3a3a3a;
  width: 100%;
  margin-bottom: 2px;
}

.offline-course-right-info {
  display: flex;
  gap: 9px;
}

.offline-course-right-info p {
  color: #565658;
  font-size: 14px;
  font-weight: 500;
}

.offline-course-right-info p:first-of-type {
  border-left: 1px solid #d9d9d9;
  padding-left: 8px;
}

span.offline-course-right-duration {
  color: #919191 !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}

.offline-course-right-info span {
  color: #000000;
  font-weight: 600;
}

.offline-feature-recorded-course {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.offline-feature-recorded-course p {
  border-left: 1px solid #d9d9d9;
  padding-left: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #404040;
}

.offline-feature-recorded-course p:last-of-type {
  border-left: unset !important;
}

.offline-course-left {
  font-size: 10px;
  font-weight: 500;
  color: #565658 !important;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  width: 28%;
  flex-wrap: wrap;
}

.offline-course-left span:first-of-type {
  font-size: 14px;
  font-weight: 500;
  color: #565658;
}

span.offline-course-price {
  color: #d84315;
  padding: 0px 6px;
  font-size: 20px;
  font-weight: 700;
}

a.offline-course-register {
  border: none;
  font-size: 14px;
  color: #565658;
  background-color: #fdd406;
  border-radius: 50px;
  box-shadow: 0px 8px 24px 0px #fdd4064d !important;
  width: fit-content;
  font-variation-settings: "wght" 500;
  text-align: center;
  vertical-align: middle !important;
  padding: 10px 20px;
  text-decoration: none; /* اضافه شد */
}

/* "Show More" Button */
.offline-course-btn {
  width: 100%;
  text-align: center;
  color: #000000 !important;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

svg.offline-course-chevron-down {
  width: 16px;
  fill: #000000;
  margin-right: 6px;
  transition: transform 0.3s ease; /* انیمیشن نرم */
}

svg.offline-course-chevron-down.uparrow {
  transform: rotate(180deg);
}

/* Collapsible Item Box */
.offline-course-items {
  width: 100%;
  display: none;
  padding-top: 14px;
  padding-bottom: 25px;
}

.active + .offline-course-items {
  display: block;
}

.offline-course-items-left {
  width: 55.3%;
}

.offline-course-items-right {
  width: 40.4%;
  padding-top: 24px;
}

.offline-course-items-top {
  display: flex;
  align-items: center;
  flex-direction: row;
  justify-content: space-between;
  padding-bottom: 13px;
  padding-top: 14px;
}

.offline-course-items-top p {
  font-weight: 700;
  color: #3a3a3a;
  font-size: 18px;
}

.offline-course-items-bottom {
  overflow-y: auto;
  height: 200px;
  direction: ltr;
  padding-right: 7px;
}

/* Scrollbar Styles */
.offline-course-items-bottom::-webkit-scrollbar {
  width: 15px !important;
}

.offline-course-items-bottom::-webkit-scrollbar-track {
  background-color: #fafafa;
  border-left: 1px solid #f0f0f0;
  border-right: 1px solid #f0f0f0;
}

.offline-course-items-bottom::-webkit-scrollbar-thumb {
  border: 3.5px solid rgba(0, 0, 0, 0);
  background-clip: padding-box;
  border-radius: 9999px;
  background-color: #c1c1c1;
}

/* Video Preview */
.video-container {
  max-width: 100% !important;
  width: 358px;
  height: 241px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.preview-video-play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: none;
  cursor: pointer;
  background: unset;
}

button.preview-video-play-button:focus,
button.preview-video-play-button:hover {
  background: unset;
}

/* =================================================================== */
/* 6. Media Queries (Grouped)
/* =================================================================== */

/* Un-nested from @media all */
@media screen and (max-width: 768px) {
  .chapter-item .file {
    display: block;
    text-align: end;
    padding-bottom: 14px;
  }

  .chapter-item .file > :nth-child(n + 2) {
    display: inline-block;
    margin: 0px 2px;
  }
}

.chapter-item .file.no-download-item {
  grid-template-columns: 32px auto 100px 64px !important;
}

@media (min-width: 576px) {
  .modal-dialog {
    max-width: var(--bs-modal-width, 500px); /* Fallback added */
    margin-right: auto;
    margin-left: auto;
  }
}

@media (min-width: 768px) {
  .modal-dialog {
    width: 600px;
    margin: 30px auto;
  }

  .modal-content {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
  }

  .modal-sm {
    width: 300px;
  }
}

@media (min-width: 992px) {
  .modal-lg {
    width: 900px;
  }
}

@media screen and (max-width: 1024px) {
  .mx-oc-left,
  .mx-oc-right {
    width: 100%;
    padding: 0;
    border: none;
  }

  .mx-oc-items {
    flex-direction: column;
  }

  .course-price-info {
    flex-direction: column;
  }

  .offline-course {
    display: flex;
    flex-direction: column;
  }

  .course-attributes {
    margin-top: 12px !important;
  }

  .offline-course-items {
    flex-wrap: wrap;
    justify-content: center;
    flex-direction: column;
    align-items: center;
  }

  .video-container {
    width: 358px;
  }

  .offline-course-items-right {
    display: flex;
    justify-content: center;
    width: 100%;
    padding-top: 3px;
  }

  .offline-course-items-left {
    width: 100%;
  }
}

@media (max-width: 1366px) {
  .offline-course-left {
    width: 27%;
  }

  .video-container {
    width: 350px;
  }
}

@media (max-width: 1200px) {
  .offline-course-right {
    border-left: unset;
  }

  .offline-course-left {
    justify-content: flex-start;
    flex-wrap: nowrap;
    width: 100%;
    padding-top: 30px;
  }

  .offline-course-btn {
    justify-content: flex-start;
    padding-right: 17px;
  }

  .video-container {
    width: 305px;
  }

  .offline-course-items-right {
    align-content: center;
  }
}

@media (max-width: 880px) {
  .offline-course-items-left {
    display: flex;
    flex-direction: column-reverse;
  }

  .offline-course-items-top p {
    display: none;
  }

  .offline-course-items-right {
    padding-bottom: 29px;
  }

  .offline-course-items-top {
    justify-content: center;
  }

  a.offline-course-register {
    width: 100%;
  }
}
