@charset "utf-8";

/* 元のselectを含むラッパー要素 */
.select_wrap {
  position: relative;
  width: 100%;
  /* margin-bottom: 20px; */
}

/* 元のセレクトボックス自体は非表示にし、カスタムUIのみを表示 */
.select_wrap select.has-custom-select {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

/* -----------------------------------------
  * マーキー（テキストスライド）共通スタイル
  * ----------------------------------------- */
.custom-select-text-wrap {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  display: flex;
  align-items: center;
}

.custom-select-text {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
}

/* スマホ表示時のマーキーアニメーション設定 */
@media only screen and (max-width: 767px) {
  .custom-select-text.is-marquee {
    animation: custom-select-marquee 9s linear infinite;
  }

  @keyframes custom-select-marquee {
    0%, 20% {
      transform: translateX(0);
    }
    65%, 85% {
      transform: translateX(var(--marquee-shift, 0px));
    }
    85.01%, 100% {
      transform: translateX(0);
    }
  }
}

/* -----------------------------------------
  * PC用スタイル (min-width: 768px)
  * ----------------------------------------- */
@media print, (min-width: 768px) {
  .custom-select-container {
    position: relative;
    width: 100%;
    user-select: none;
    font-size: 16px;
  }

  /* トリガー（表示部分） */
  .custom-select-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.983em 18px;
    background-color: #ffffff;
    border: 2px solid #C3C3C3;
    border-radius: 8px;
    color: #333333;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    overflow: hidden;
  }
  .select_wrap.ng .custom-select-trigger {
    border-color: #E73A3A;
  }

  /* トリガーのホバー・フォーカス状態 */
  .custom-select-container.is-open .custom-select-trigger,
  .custom-select-trigger:hover {
    border-color: #a0a0a0;
  }

  /* 矢印アイコン（SVG等を使わずにCSSで表現） */
  .custom-select-trigger::after {
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    border-right: 2px solid #8e8e93;
    border-bottom: 2px solid #8e8e93;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.2s ease-in-out;
    margin-left: 10px;
    flex-shrink: 0;
  }

  /* 開閉時の矢印回転 */
  .custom-select-container.is-open .custom-select-trigger::after {
    transform: translateY(2px) rotate(-135deg);
  }

  /* ドロップダウンリスト (ul) */
  .custom-select-options {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 999;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    padding: 6px 0;
    margin: 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  }

  /* 開いた状態のドロップダウンリスト */
  .custom-select-container.is-open .custom-select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  /* 各選択肢 (li) */
  .custom-select-option {
    padding: 12px 18px;
    color: #333333;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s ease, color 0.15s ease;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
  }
  .custom-select-option:hover {
    background-color: #f5f7fa;
  }

  /* 選択中、無効、非表示スタイル */
  .custom-select-option.is-selected {
    font-weight: bold;
    background-color: #edf2f7;
  }

  .custom-select-option.is-disabled {
    color: #aaaaaa;
    cursor: not-allowed;
    background-color: transparent !important;
  }

  .custom-select-option.is-hidden {
    display: none;
  }
}

/* -----------------------------------------
  * スマホ用スタイル (max-width: 767px)
  * デザイン幅：430px基準でvw算出
  * ----------------------------------------- */
@media only screen and (max-width: 767px) {
  .custom-select-container {
    position: relative;
    width: 100%;
    user-select: none;
  }

  /* トリガー（表示部分） */
  .custom-select-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.888em 1.1em;
    background-color: #ffffff;
    border: 2px solid #C3C3C3;
    border-radius: 1.86vw; /* 8px */
    color: #333333;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    overflow: hidden;
    gap: 0 0.3em;
  }
  .select_wrap.ng .custom-select-trigger {
    border-color: #E73A3A;
  }

  /* トリガーのホバー・フォーカス状態 */
  .custom-select-container.is-open .custom-select-trigger,
  .custom-select-trigger:hover {
    border-color: #a0a0a0;
  }

  /* 矢印アイコン */
  .custom-select-trigger::after {
    content: '';
    display: block;
    width: 2.33vw; /* 10px */
    height: 2.33vw; /* 10px */
    border-right: 2px solid #8e8e93; /* 境界線は固定 */
    border-bottom: 2px solid #8e8e93; /* 境界線は固定 */
    transform: translateY(-0.47vw) rotate(45deg);
    transition: transform 0.2s ease-in-out;
    margin-left: 2.33vw;
    flex-shrink: 0;
  }

  /* 開閉時の矢印回転 */
  .custom-select-container.is-open .custom-select-trigger::after {
    transform: translateY(0.47vw) rotate(-135deg);
  }

  /* ドロップダウンリスト (ul) */
  .custom-select-options {
    position: absolute;
    top: calc(100% + 1.4vw); /* 100% + 6px */
    left: 0;
    right: 0;
    z-index: 999;
    background-color: #ffffff;
    border: 1px solid #e2e8f0; /* 境界線は固定 */
    border-radius: 1.86vw; /* 8px */
    box-shadow: 0 1.4vw 3.72vw rgba(0, 0, 0, 0.08); /* 0 6px 16px */
    padding: 1.4vw 0; /* 6px */
    margin: 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-1.86vw); /* -8px */
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  }

  /* 開いた状態のドロップダウンリスト */
  .custom-select-container.is-open .custom-select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  /* 各選択肢 (li) - 2行表示可能 */
  .custom-select-option {
    padding: 2.79vw 4.19vw; /* 上下 12px, 左右 18px */
    color: #333333;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s ease, color 0.15s ease;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
  }
  .custom-select-option:hover {
    background-color: #f5f7fa;
  }

  .custom-select-option.is-selected {
    font-weight: bold;
    background-color: #edf2f7;
  }

  .custom-select-option.is-disabled {
    color: #aaaaaa;
    cursor: not-allowed;
    background-color: transparent !important;
  }

  .custom-select-option.is-hidden {
    display: none;
  }
}