/**
 * ------------------------------
 * tl-dashboard-courses.css
 * ------------------------------
 * @purpose
 * Tutor LMSダッシュボード内の講座一覧ページ用css
 *
 * @pages
 * ・登録済み講座ページ
 * ・学習中講座ページ
 * ・完了講座ページ
 * ・お気に入りページ
 * ・Quiet Test結果ページ
 *
 * @note
 * ・ページ種別に応じた補助リンクを見出し行右側へ表示
 * ・対象ページでは「まなびの部屋へ ☞」見出しを非表示
 * ・気になる一覧のみレビューの星を非表示
 *
 * @version
 * 1.4.0
 */

/**
 * ----------------------------------------
 *  # 気になる一覧のレビュー非表示 [pc,sp]
 * ----------------------------------------
 */
.tutor-dashboard-wishlist-wrapper .tutor-course-card-rating {
  display: none !important;
}

/**
 * ----------------------------------------
 *  # 講座一覧ページ見出し行 [pc,sp]
 * ----------------------------------------
 */
body.wm-dashboard-courses-page .wm-dashboard-courses-heading-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

/**
 * お気に入り／Quiet Test結果ページでは、
 * PC・SPともに「まなびの部屋へ ☞」見出しを表示しない。
 */
body.wm-dashboard-courses-page .wm-dashboard-courses-heading-row h4 {
  margin: 0;
  display: none;
}

.wm-dashboard-courses-switch-link {
  flex: 0 0 auto;
  margin-left: auto;
  color: #5474a3;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  transition:
    color 0.2s ease,
    opacity 0.2s ease,
    transform 0.2s ease;
}

.wm-dashboard-courses-switch-link:visited {
  color: #5474a3;
  text-decoration: none;
}

.wm-dashboard-courses-switch-link:hover {
  color: #4169d8;
  opacity: 0.78;
  transform: translateX(2px);
}

/**
 * 旧配置のリンクは使用しない
 */
.tutor-dashboard-courses-tab > .wm-dashboard-courses-all-link {
  display: none !important;
}

@media screen and (max-width: 768px) {
  body.wm-dashboard-courses-page .wm-dashboard-courses-heading-row {
    min-height: 24px;
    margin-bottom: 10px;
  }

  /**
   * SPでは全対象ページで「まなびの部屋へ ☞」見出しを非表示
   */
  body.wm-dashboard-courses-page .wm-dashboard-courses-heading-row h4 {
    display: none;
  }

  .wm-dashboard-courses-switch-link {
    max-width: 100%;
    margin-left: auto;
    font-size: 10.5px;
    line-height: 1.35;
    text-align: right;
    white-space: normal;
  }
}

/**
 * ----------------------------------------
 *  # v1.2.2 講座タブを画面幅内へ固定 [sp]
 *    ・登録済み／学習中／完了のドロップダウン
 *    ・お気に入り
 *    ・Quiet Test結果
 *    を横スクロールさせず、3列で画面幅内へ収める
 * ----------------------------------------
 */
@media screen and (max-width: 768px) {
  body.wm-dashboard-courses-page .tutor-dashboard-courses-tab {
    width: 100%;
    max-width: 100%;
    overflow: visible !important;
    box-sizing: border-box;
  }

  body.wm-dashboard-courses-page .tutor-dashboard-courses-tab > .tutor-nav {
    width: 100%;
    max-width: 100%;
    min-width: 0;

    display: grid !important;
    grid-template-columns:
      minmax(0, 1.3fr)
      minmax(0, 1fr)
      minmax(0, 1.35fr);
    align-items: stretch;
    gap: 4px;

    overflow: visible !important;
    box-sizing: border-box;
  }

  /**
   * 先頭のドロップダウン用ラッパー
   */
  body.wm-dashboard-courses-page
    .tutor-dashboard-courses-tab
    > .tutor-nav
    > div {
    position: relative;
    min-width: 0;
    width: 100%;
  }

  /**
   * 各タブを列幅いっぱいに揃える
   */
  body.wm-dashboard-courses-page .tutor-dashboard-courses-tab .tutor-nav-item {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 40px;
    padding: 7px 5px !important;

    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;

    box-sizing: border-box;
    overflow: hidden;
    white-space: nowrap;

    font-size: 10.5px !important;
    line-height: 1.2;
    letter-spacing: -0.02em;
  }

  body.wm-dashboard-courses-page
    .tutor-dashboard-courses-tab
    .tutor-nav-item
    svg {
    flex: 0 0 auto;
    width: 16px !important;
    height: 16px !important;
  }

  /**
   * 登録済み／学習中／完了タブの矢印も小さくして文字幅を確保
   */
  body.wm-dashboard-courses-page
    .tutor-dashboard-courses-tab
    button.tutor-nav-item
    svg:last-child {
    width: 14px !important;
    height: 14px !important;
  }

  /**
   * ドロップダウン自体は従来どおり表示可能にする
   */
  body.wm-dashboard-courses-page
    .tutor-dashboard-courses-tab
    .tutor-nav-dropdown {
    min-width: 190px;
    max-width: calc(100vw - 28px);
    z-index: 10020;
  }
}

/**
 * バンドル受講特典メニュー [pc,sp]
 * 既存の三点メニューがある場合は、そのリスト末尾に追加した行だけを整える。
 * WaterMe登録特典と同系統の黄色グラデーションで特典項目を明確にする。
 */
.tutor-bundle-progress-card.wm-dashboard-bundle-gift-available {
  position: relative;
}

.wm-dashboard-bundle-gift-menu {
  position: absolute;
  z-index: 4;
  top: 12px;
  right: 12px;
}

/* 単講座は既存CTAの右隣を、同じ主操作 + 補助メニュー領域として使う。 */
.tutor-progress-card.wm-dashboard-course-gift-available
  > .tutor-progress-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wm-dashboard-course-gift-menu {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
}

.tutor-bundle-progress-card .tutor-dashboard-bundle-action-button,
.wm-dashboard-bundle-gift-trigger,
.wm-dashboard-course-gift-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0 !important;
  border: 1px solid rgba(171, 152, 37, 0.42) !important;
  border-radius: 8px;
  background: linear-gradient(135deg, #fffef0 0%, #fff9d4 100%) !important;
  color: #4e4a1c !important;
  box-shadow: 0 1px 2px rgba(131, 113, 22, 0.06);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 1;
}

.tutor-bundle-progress-card .tutor-dashboard-bundle-action-button:hover,
.tutor-bundle-progress-card .tutor-dashboard-bundle-action-button:focus,
.wm-dashboard-bundle-gift-trigger:hover,
.wm-dashboard-bundle-gift-trigger:focus,
.wm-dashboard-course-gift-trigger:hover,
.wm-dashboard-course-gift-trigger:focus {
  border-color: rgba(171, 152, 37, 0.58);
  background: linear-gradient(135deg, #fffef5 0%, #fff4b8 100%) !important;
  color: #373410 !important;
}

.tutor-bundle-progress-card .tutor-dashboard-bundle-action-button:focus-visible,
.wm-dashboard-bundle-gift-trigger:focus-visible,
.wm-dashboard-course-gift-trigger:focus-visible,
.wm-dashboard-bundle-gift-link:focus-visible,
.wm-dashboard-bundle-page-link:focus-visible {
  outline: 2px solid rgba(65, 105, 216, 0.56);
  outline-offset: 2px;
}

.wm-dashboard-bundle-gift-popover {
  position: absolute;
  z-index: 5;
  top: calc(100% + 6px);
  right: 0;
  width: max-content;
  min-width: 142px;
  padding: 5px;
  border: 1px solid rgba(233, 199, 74, 0.9);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(38, 53, 77, 0.14);
}

.wm-dashboard-course-gift-popover {
  position: absolute;
  z-index: 5;
  top: calc(100% + 6px);
  right: 0;
  width: max-content;
  min-width: 142px;
  padding: 5px;
  border: 1px solid rgba(233, 199, 74, 0.9);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(38, 53, 77, 0.14);
}

.wm-dashboard-bundle-gift-popover[hidden] {
  display: none !important;
}

.wm-dashboard-course-gift-popover[hidden] {
  display: none !important;
}

.wm-dashboard-bundle-gift-menu-item {
  margin: 0;
  padding: 0;
  list-style: none;
}

.wm-dashboard-bundle-gift-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  box-sizing: border-box;
  border: 1px solid rgba(171, 152, 37, 0.42);
  border-radius: 6px;
  background: linear-gradient(135deg, #fffde0 0%, #fff8bd 54%, #f7ef7a 100%);
  color: #4e4a1c;
  box-shadow: 0 1px 2px rgba(131, 113, 22, 0.08);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}

.wm-dashboard-bundle-page-link {
  display: block;
  min-height: 38px;
  padding: 9px 10px;
  box-sizing: border-box;
  border-radius: 6px;
  color: #364866;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}

.wm-dashboard-bundle-page-link:hover,
.wm-dashboard-bundle-page-link:focus {
  background: #f3f7fb;
  color: #223a5c;
  text-decoration: none;
}

.wm-dashboard-bundle-gift-link:visited,
.wm-dashboard-bundle-gift-link:hover,
.wm-dashboard-bundle-gift-link:focus {
  color: #4e4a1c;
  text-decoration: none;
}

.wm-dashboard-bundle-gift-link:hover,
.wm-dashboard-bundle-gift-link:focus {
  border-color: rgba(171, 152, 37, 0.58);
  background: linear-gradient(135deg, #fffef0 0%, #fff9ca 54%, #f8f08a 100%);
  color: #373410;
}

.wm-dashboard-bundle-gift-icon {
  flex: 0 0 auto;
}

.tutor-bundle-progress-card .tutor-badge-highlight {
  background: #dff5fc !important;
  border-color: #8ed8ed !important;
  color: #155f79 !important;
}

.tutor-bundle-progress-card .tutor-badge-highlight svg {
  color: #2587aa !important;
}

.tutor-bundle-progress-card .tutor-badge-highlight svg [stroke="currentColor"] {
  stroke: #2587aa !important;
}

/* Match wishlist bundle badges to the active-course bundle badge. */
body.wm-dashboard-courses-wishlist
  .tutor-dashboard-wishlist-wrapper
  .tutor-course-card
  a[href*="/course-bundle/"]
  .tutor-badge-highlight {
  background: #dff5fc !important;
  border-color: #8ed8ed !important;
  color: #155f79 !important;
}

body.wm-dashboard-courses-wishlist
  .tutor-dashboard-wishlist-wrapper
  .tutor-course-card
  a[href*="/course-bundle/"]
  .tutor-badge-highlight
  svg {
  color: #2587aa !important;
}

body.wm-dashboard-courses-wishlist
  .tutor-dashboard-wishlist-wrapper
  .tutor-course-card
  a[href*="/course-bundle/"]
  .tutor-badge-highlight
  svg [stroke="currentColor"] {
  stroke: #2587aa !important;
}

/* Tutor LMSのPC用「ホバー時だけ表示」指定を解除する。 */
.tutor-bundle-progress-card > .tutor-progress-card-actions,
.tutor-bundle-progress-card .tutor-dashboard-bundle-action,
.tutor-bundle-progress-card .tutor-dashboard-bundle-action-button {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/**
 * ----------------------------------------
 *  # バンドル講座の重ねカード／内包講座アコーディオン [pc,sp]
 * ----------------------------------------
 */
.tutor-bundle-progress-card.wm-dashboard-bundle-card {
  position: relative;
  z-index: 0;
  isolation: isolate;
  overflow: visible;
  width: auto;
  margin-top: 14px;
  margin-right: 0;
  margin-bottom: 14px;
  padding: 12px 22px 22px 12px !important;
  box-sizing: border-box;
  background: #fff !important;
}

/* バンドル本体は通常のシングル講座カードと同じ白背景に揃える。 */
.tutor-bundle-progress-card.wm-dashboard-bundle-card
  > .tutor-progress-card {
  background: #fff !important;
}

.tutor-bundle-progress-card.wm-dashboard-bundle-card
  > .tutor-progress-card-inner {
  width: 100%;
  max-width: 100%;
  margin: 0 0 10px !important;
  padding: 0;
  box-sizing: border-box;
  background: #fff !important;
}

.tutor-bundle-progress-card.wm-dashboard-bundle-card
  > .tutor-progress-card-actions {
  right: 22px !important;
}

/* 三点メニューを開いている間は、後続カードより前面に表示する。 */
.tutor-bundle-progress-card.wm-dashboard-bundle-card:focus-within {
  z-index: 20;
}

.tutor-bundle-progress-card.wm-dashboard-bundle-card
  .tutor-dashboard-bundle-action {
  position: relative;
  z-index: 21;
}

.tutor-bundle-progress-card.wm-dashboard-bundle-card .tutor-popover {
  z-index: 22 !important;
}

.tutor-bundle-progress-card.wm-dashboard-bundle-card::before,
.tutor-bundle-progress-card.wm-dashboard-bundle-card::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  display: block;
  border: inherit;
  border-radius: inherit;
  background: #fff;
  box-shadow: 0 5px 12px rgba(38, 53, 77, 0.16);
  content: "";
  pointer-events: none;
}

.tutor-bundle-progress-card.wm-dashboard-bundle-card::before {
  transform: translate(-5px, -5px);
}

.tutor-bundle-progress-card.wm-dashboard-bundle-card::after {
  transform: translate(-10px, -10px);
  background: #fff;
  box-shadow: 0 7px 16px rgba(38, 53, 77, 0.19);
}

.wm-dashboard-bundle-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  margin-right: 6px;
  padding: 5px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #5474a3;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
}

.wm-dashboard-bundle-toggle:hover,
.wm-dashboard-bundle-toggle:focus {
  background: #f1f6fc;
  color: #4169d8;
}

.wm-dashboard-bundle-toggle:focus-visible {
  outline: 2px solid rgba(65, 105, 216, 0.56);
  outline-offset: 2px;
}

.wm-dashboard-bundle-toggle--floating {
  position: absolute;
  z-index: 4;
  top: 12px;
  right: 52px;
}

.wm-dashboard-bundle-toggle-icon {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.2s ease;
}

.wm-dashboard-bundle-toggle[aria-expanded="true"]
  .wm-dashboard-bundle-toggle-icon {
  transform: translateY(2px) rotate(225deg);
}

.wm-dashboard-bundle-courses-wrapper[hidden] {
  display: none !important;
}

.wm-dashboard-bundle-courses-wrapper {
  margin: 14px 0 20px 14px;
  padding: 10px;
  border-left: 2px solid #c7d8e8;
  border-radius: 0 9px 9px 0;
  background: #fff;
}

.wm-dashboard-bundle-courses-wrapper > .tutor-progress-card {
  min-height: 0;
  margin: 0 0 8px;
  padding: 12px 14px;
  border: 1px solid #e1e9f0;
  border-radius: 8px;
  background: #fff !important;
  box-shadow: none;
}

.wm-dashboard-bundle-courses-wrapper > .tutor-progress-card:last-child {
  margin-bottom: 0;
}

.wm-dashboard-bundle-courses-wrapper
  > .tutor-progress-card
  .tutor-progress-card-thumbnail,
.wm-dashboard-bundle-courses-wrapper
  > .tutor-progress-card
  .tutor-course-thumbnail,
.wm-dashboard-bundle-courses-wrapper
  > .tutor-progress-card
  .tutor-card-image,
.wm-dashboard-bundle-courses-wrapper > .tutor-progress-card > figure {
  display: none !important;
}

@media screen and (max-width: 768px) {
  .wm-dashboard-bundle-gift-menu {
    top: 8px;
    right: 8px;
  }

  .wm-dashboard-bundle-gift-trigger {
    width: 32px;
    min-width: 32px;
    height: 32px;
  }

  .wm-dashboard-course-gift-trigger {
    width: 32px;
    min-width: 32px;
    height: 32px;
  }

  .tutor-bundle-progress-card .tutor-dashboard-bundle-action-button {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
  }

  .tutor-bundle-progress-card.wm-dashboard-bundle-card {
    width: auto;
    margin-top: 12px;
    margin-right: 0;
    margin-bottom: 12px;
    padding: 10px 18px 18px 10px !important;
  }

  .tutor-bundle-progress-card.wm-dashboard-bundle-card
    > .tutor-progress-card-inner {
    margin-bottom: 8px !important;
  }

  .tutor-bundle-progress-card.wm-dashboard-bundle-card
    > .tutor-progress-card-actions {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    min-height: 32px;
    margin: 0 0 10px !important;
    padding: 0 !important;
  }

  .tutor-bundle-progress-card.wm-dashboard-bundle-card
    > .tutor-progress-card-actions
    .tutor-dashboard-bundle-action,
  .tutor-bundle-progress-card.wm-dashboard-bundle-card
    > .tutor-progress-card-actions
    .tutor-dashboard-bundle-action-button {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    align-self: center;
    margin: 0 !important;
  }

  .tutor-bundle-progress-card.wm-dashboard-bundle-card
    > .tutor-progress-card-actions
    .tutor-dashboard-bundle-action {
    display: flex;
    align-items: center;
  }

  .tutor-bundle-progress-card.wm-dashboard-bundle-card
    > .tutor-progress-card-actions
    .tutor-dashboard-bundle-action-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  .tutor-bundle-progress-card.wm-dashboard-bundle-card::before {
    transform: translate(-4px, -4px);
  }

  .tutor-bundle-progress-card.wm-dashboard-bundle-card::after {
    transform: translate(-8px, -8px);
  }

  .wm-dashboard-bundle-toggle {
    min-height: 32px;
    margin-right: 3px;
    padding: 4px 5px;
    font-size: 11px;
  }

  .wm-dashboard-bundle-toggle--floating {
    top: 8px;
    right: 44px;
  }

  .wm-dashboard-bundle-courses-wrapper {
    margin: 10px 0 16px 8px;
    padding: 8px;
  }

  .wm-dashboard-bundle-courses-wrapper > .tutor-progress-card {
    padding: 10px;
    border-color: #c5d3e0;
  }
}
