/**
 * お気に入り一覧モーダル
 *
 * @layer components
 * @package TKLB
 */

@layer components {
  /* ========================================
     * モーダルオーバーレイ
     * ======================================== */

  :where(.c-favorite-modal) {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--wp--custom--z-index--modal, 1050);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--wp--preset--spacing--base, 1.6rem);
  }

  :where(.c-favorite-modal.is-open) {
    display: flex;
  }

  :where(.c-favorite-modal__overlay) {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--wp--custom--overlay--dark--7, rgba(0, 0, 0, 0.7));
    backdrop-filter: blur(4px);
    cursor: pointer;
  }

  /* ========================================
     * モーダルコンテナ
     * ======================================== */

  :where(.c-favorite-modal__container) {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: 90vh;
    background-color: var(--wp--preset--color--white, #ffffff);
    border-radius: var(--wp--custom--border--radius--xl, 24px);
    box-shadow: var(
      --wp--custom--shadow--2xl,
      0 25px 50px -12px rgba(0, 0, 0, 0.25)
    );
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modal-fade-in 0.3s ease;
  }

  @keyframes modal-fade-in {
    from {
      opacity: 0;
      transform: scale(0.95) translateY(20px);
    }
    to {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
  }

  /* ========================================
     * ヘッダー
     * ======================================== */

  :where(.c-favorite-modal__header) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--wp--preset--spacing--lg, 2.4rem);
    border-bottom: var(--wp--custom--border--width--1, 1px) solid
      var(--wp--preset--color--gray-lighter, #f5f5f5);
  }

  :where(.c-favorite-modal__title) {
    font-size: var(--wp--preset--font-size--xl, 2rem);
    font-weight: var(--wp--custom--font-weight--bold, 700);
    color: var(--wp--preset--color--gray-darkest, #212121);
    margin: 0;
  }

  :where(.c-favorite-modal__close) {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background-color: transparent;
    border-radius: var(--wp--custom--border--radius--full, 9999px);
    color: var(--wp--preset--color--gray-dark, #616161);
    cursor: pointer;
    transition: all var(--wp--custom--transition--duration--fast, 150ms) ease;
  }

  :where(.c-favorite-modal__close:hover) {
    background-color: var(--wp--preset--color--gray-lighter, #f5f5f5);
    color: var(--wp--preset--color--gray-darkest, #212121);
  }

  :where(.c-favorite-modal__close .material-symbols-outlined) {
    font-size: 24px;
  }

  /* ========================================
     * タブナビゲーション
     * ======================================== */

  :where(.c-favorite-modal__tabs) {
    display: flex;
    gap: var(--wp--preset--spacing--xs, 0.8rem);
    padding: var(--wp--preset--spacing--base, 1.6rem)
      var(--wp--preset--spacing--lg, 2.4rem) 0;
    border-bottom: var(--wp--custom--border--width--2, 2px) solid
      var(--wp--preset--color--gray-lighter, #f5f5f5);
  }

  :where(.c-favorite-modal__tab) {
    display: inline-flex;
    align-items: center;
    gap: var(--wp--preset--spacing--2-xs, 0.4rem);
    padding: var(--wp--preset--spacing--xs, 0.8rem)
      var(--wp--preset--spacing--base, 1.6rem);
    border: none;
    background-color: transparent;
    border-radius: var(--wp--custom--border--radius--md, 8px)
      var(--wp--custom--border--radius--md, 8px) 0 0;
    color: var(--wp--preset--color--gray-dark, #616161);
    font-size: var(--wp--preset--font-size--base, 1.6rem);
    font-weight: var(--wp--custom--font-weight--medium, 500);
    cursor: pointer;
    position: relative;
    transition: all var(--wp--custom--transition--duration--fast, 150ms) ease;
  }

  :where(.c-favorite-modal__tab:hover) {
    background-color: var(--wp--preset--color--gray-lightest, #fafafa);
    color: var(--wp--preset--color--gray-darkest, #212121);
  }

  :where(.c-favorite-modal__tab.is-active) {
    background-color: var(--wp--preset--color--white, #ffffff);
    color: var(--wp--preset--color--secondary, #db57a5);
    font-weight: var(--wp--custom--font-weight--semibold, 600);
  }

  :where(.c-favorite-modal__tab.is-active::after) {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--wp--preset--color--secondary, #db57a5);
  }

  :where(.c-favorite-modal__tab .material-symbols-outlined) {
    font-size: 20px;
  }

  :where(.c-favorite-modal__tab-count) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 var(--wp--preset--spacing--3-xs, 0.25rem);
    background-color: var(--wp--preset--color--gray-lighter, #f5f5f5);
    color: var(--wp--preset--color--gray-dark, #616161);
    font-size: var(--wp--preset--font-size--sm, 1.4rem);
    font-weight: var(--wp--custom--font-weight--semibold, 600);
    border-radius: var(--wp--custom--border--radius--full, 9999px);
  }

  :where(.c-favorite-modal__tab.is-active .c-favorite-modal__tab-count) {
    background-color: var(--wp--preset--color--secondary-lighter, #ffd6eb);
    color: var(--wp--preset--color--secondary-dark, #c2185b);
  }

  /* ========================================
     * コンテンツエリア
     * ======================================== */

  :where(.c-favorite-modal__content) {
    flex: 1;
    overflow-y: auto;
    padding: var(--wp--preset--spacing--lg, 2.4rem);
  }

  :where(.c-favorite-modal__panel) {
    display: none;
  }

  :where(.c-favorite-modal__panel.is-active) {
    display: block;
  }

  /* ========================================
     * リスト表示
     * ======================================== */

  :where(.c-favorite-modal__list) {
    display: flex;
    flex-direction: column;
    gap: var(--wp--preset--spacing--base, 1.6rem);
  }

  /* ========================================
     * 空状態
     * ======================================== */

  :where(.c-favorite-modal__empty) {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--wp--preset--spacing--base, 1.6rem);
    padding: var(--wp--preset--spacing--5-xl, 8rem)
      var(--wp--preset--spacing--lg, 2.4rem);
    text-align: center;
  }

  :where(.c-favorite-modal__empty .material-symbols-outlined) {
    font-size: 64px;
    color: var(--wp--preset--color--gray-light, #e0e0e0);
  }

  :where(.c-favorite-modal__empty p) {
    margin: 0;
    color: var(--wp--preset--color--gray-dark, #616161);
    font-size: var(--wp--preset--font-size--base, 1.6rem);
  }

  /* ========================================
     * レスポンシブ調整
     * ======================================== */

  @media (max-width: 768px) {
    :where(.c-favorite-modal) {
      padding: var(--wp--preset--spacing--xs, 0.8rem);
    }

    :where(.c-favorite-modal__container) {
      max-height: 95vh;
      border-radius: var(--wp--custom--border--radius--lg, 16px);
    }

    :where(.c-favorite-modal__header) {
      padding: var(--wp--preset--spacing--base, 1.6rem);
    }

    :where(.c-favorite-modal__title) {
      font-size: var(--wp--preset--font-size--lg, 1.8rem);
    }

    :where(.c-favorite-modal__tabs) {
      padding: var(--wp--preset--spacing--xs, 0.8rem)
        var(--wp--preset--spacing--base, 1.6rem) 0;
    }

    :where(.c-favorite-modal__tab) {
      padding: var(--wp--preset--spacing--2-xs, 0.4rem)
        var(--wp--preset--spacing--xs, 0.8rem);
      font-size: var(--wp--preset--font-size--sm, 1.4rem);
    }

    :where(.c-favorite-modal__tab-text) {
      display: none;
    }

    :where(.c-favorite-modal__content) {
      padding: var(--wp--preset--spacing--base, 1.6rem);
    }

    :where(.c-favorite-modal__list) {
      grid-template-columns: 1fr;
      gap: var(--wp--preset--spacing--xs, 0.8rem);
    }

    :where(.c-favorite-modal__empty) {
      padding: var(--wp--preset--spacing--3-xl, 5rem)
        var(--wp--preset--spacing--base, 1.6rem);
    }
  }
}
