/**
 * スタイル概要: 九星気学フリー診断ショートコード専用のフォームおよび結果表示コンポーネント装飾。
 * 主要仕様: レイアウトの可読性を優先し、フォームとiframeに十分な余白を設定。
 * 制限事項: WordPressテーマ側のCSSに依存するため、必要に応じて上書きクラスを提供してください。
 */

/* インラインスタイルでテーマCSSに依存しないようにする */
.hoshiyomi-kyusei-free {
  padding: 32px;
  border-radius: 12px;
  margin: 40px 0;
  font-family: "游明朝", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "HG明朝E", "ＭＳ Ｐ明朝", "MS PMincho", "serif";
}

.hoshiyomi-kyusei-free__field {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
}

.hoshiyomi-kyusei-free__field label {
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
  font-size: 14px;
}

.hoshiyomi-kyusei-free__field input[type="text"],
.hoshiyomi-kyusei-free__field input[type="time"],
.hoshiyomi-kyusei-free__field select {
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.2s ease;
  width: 100%;
  box-sizing: border-box;
  background-color: #f8fafc;
  color: #1e293b;
}

.hoshiyomi-kyusei-free__date-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hoshiyomi-kyusei-free__date-group select {
  /* 年月日それぞれの幅調整: 年は少し広めに */
  flex: 1;
  min-width: 60px;
}

.hoshiyomi-kyusei-free__date-group .hoshi-year-select {
  flex: 1.4;
}

.hoshi-date-sep {
  font-weight: bold;
  color: #888;
}

.hoshiyomi-kyusei-free__field input:focus,
.hoshiyomi-kyusei-free__field select:focus {
  outline: none;
  border-color: #7f63ff;
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(127, 99, 255, 0.1);
}

.hoshiyomi-kyusei-free__field.hoshi-flex {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.hoshiyomi-kyusei-free__field.hoshi-flex label {
  margin-bottom: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: normal;
}

.hoshiyomi-kyusei-free__field.hoshi-flex input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #7f63ff;
}

.hoshiyomi-kyusei-free__submit {
  padding: 14px 32px;
  border: none;
  background-color: #7f63ff;
  color: #ffffff;
  border-radius: 50px;
  cursor: pointer;
  font-size:16px;
  font-weight: 600;
  width: 100%;
  transition: background-color 0.2s, transform 0.1s;
  margin-top: 8px;
}

.hoshiyomi-kyusei-free__submit:hover {
  background-color: #6949ff;
}

.hoshiyomi-kyusei-free__submit:active {
  transform: translateY(1px);
}

.hoshiyomi-kyusei-free__error {
  color: #d93025;
  min-height: 20px;
  margin-top: 12px;
  font-size: 14px;
  text-align: center;
}

.hoshiyomi-kyusei-free__iframe-wrapper {
  margin-top: 32px;
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
  max-width: 720px; /* PC表示では十分な横幅を確保して九星盤を横並び維持 */
  margin-left: auto;
  margin-right: auto;
  position: relative; /* インジケーターのオーバーレイ配置用 */
}

.hoshiyomi-kyusei-free__iframe-wrapper iframe {
  width: 100%; /* 親幅いっぱいに広げてモバイル時のはみ出しを防止 */
  min-width: 0; /* 余計な最小幅を解除 */
  max-width: 100%;
  height: 400px; /* JSで高さ上書きされるため!importantを外す */
  border: none !important; /* iframeの境界線を確実に非表示 */
  outline: none; /* iframeの枠線を非表示 */
  box-shadow: none; /* ブラウザ側で自動付与される影を抑止 */
}

/* スクロールインジケーター: デスクトップでは非表示 */
.hoshiyomi-kyusei-free__scroll-indicator {
  display: none;
}

/* スクロールインジケーター: モバイル時のみ表示可能 */
@media (max-width: 768px) {
  .hoshiyomi-kyusei-free__scroll-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: #7f63ff;
    font-size: 14px;
    font-weight: 500;
    opacity: 1;
    transition: opacity 0.5s ease-out;
    cursor: pointer;
    user-select: none;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
    pointer-events: auto;
  }

  /* 初期状態および非表示時 */
  .hoshiyomi-kyusei-free__scroll-indicator.is-hidden {
    opacity: 0;
    pointer-events: none;
  }

  .hoshiyomi-kyusei-free__scroll-indicator-text {
    font-family: "游明朝", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "HG明朝E", "ＭＳ Ｐ明朝", "MS PMincho", "serif";
    white-space: nowrap;
  }

  .hoshiyomi-kyusei-free__scroll-indicator-icon {
    font-size: 18px;
    animation: hoshiyomi-scroll-bounce 1.5s ease-in-out infinite;
  }
}

/* スクロールインジケーターのアニメーション */
@keyframes hoshiyomi-scroll-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(8px);
  }
}

@media (max-width: 768px) {
  .hoshiyomi-kyusei-free__iframe-wrapper {
    max-width: 360px; /* iframeの表示領域を絞ってモバイルでは縦並びに誘導 */
  }
}

@media (max-width: 640px) {
  .hoshiyomi-kyusei-free {
    padding: 24px 0 !important; /* 左右余白をゼロにしてモバイル配置を最適化 */
  }

  .hoshiyomi-kyusei-free__result .kyusei-box,
  .hoshiyomi-kyusei-free__result .kyuseiban {
    width: 100%;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
  }

  .hoshiyomi-kyusei-free__iframe-wrapper iframe {
    min-height: 380px;
  }
}

.hoshiyomi-kyusei-free__result {
  margin-top: 40px;
  display: none; /* 初期状態では非表示 */
}

.hoshiyomi-kyusei-free__result-title {
  margin-top: 0;
  margin-bottom: 24px;
  color: #1e293b;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  position: relative;
  padding-bottom: 12px;
}

.hoshiyomi-kyusei-free__result-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, #7f63ff 0%, #f47f7f 100%);
  border-radius: 2px;
}

.hoshiyomi-kyusei-free__result-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 768px) {
  .hoshiyomi-kyusei-free__result-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

.hoshiyomi-kyusei-free__result-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
  border: 1px solid rgba(127, 99, 255, 0.1);
}

.hoshiyomi-kyusei-free__result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.hoshiyomi-kyusei-free__result-card--honmei .hoshiyomi-kyusei-free__result-card-header {
  background: linear-gradient(135deg, #7f63ff 0%, #9f7fff 100%);
}

.hoshiyomi-kyusei-free__result-card--getumei .hoshiyomi-kyusei-free__result-card-header {
  background: linear-gradient(135deg, #f47f7f 0%, #ff9f9f 100%);
}

.hoshiyomi-kyusei-free__result-card-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.hoshiyomi-kyusei-free__result-card-icon {
  font-size: 32px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.hoshiyomi-kyusei-free__result-card-title {
  margin: 0;
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.hoshiyomi-kyusei-free__result-card-body {
  padding: 24px;
}

.hoshiyomi-kyusei-free__result-star-name {
  text-align: center;
  margin-bottom: 20px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(127, 99, 255, 0.05) 0%, rgba(244, 127, 127, 0.05) 100%);
  border-radius: 12px;
  border: 2px solid rgba(127, 99, 255, 0.15);
}

.hoshiyomi-kyusei-free__result-honmei,
.hoshiyomi-kyusei-free__result-getumei {
  font-weight: 700;
  font-size: 28px;
  color: #1e293b;
  font-family: "游明朝", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "HG明朝E", "ＭＳ Ｐ明朝", "MS PMincho", "serif";
  letter-spacing: 0.1em;
  display: inline-block;
  position: relative;
}

.hoshiyomi-kyusei-free__result-honmei-description,
.hoshiyomi-kyusei-free__result-getumei-description {
  color: #475569;
  font-size: 15px;
  line-height: 1.8;
  margin: 0;
  text-align: left;
}

/* 時間ピッカー用スタイルをコメントアウト */
/*
#time-picker-popup {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#time-picker-popup select {
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 14px;
}

#time-picker-popup button {
  transition: background-color 0.2s;
}

#time-picker-popup button:hover {
  opacity: 0.9;
}
*/

/* 出生地プルダウン用スタイルをコメントアウト */
/*
#birthplace-dropdown {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
}

#birthplace-dropdown div {
  border-bottom: 1px solid #f0f0f0;
}

#birthplace-dropdown div:last-child {
  border-bottom: none;
}
*/

/* 九星気学結果表示用スタイル */
.hoshiyomi-kyusei-free__result .kyusei-box {
  display: flex;
  flex-flow: column;
  margin: 0 auto;
  width: 100%;
  max-width: 560px; /* PC時は横並びでも違和感のない幅を保持 */
}

.hoshiyomi-kyusei-free__loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  color: #1e293b;
  font-weight: 500;
}

.hoshiyomi-kyusei-free__loading.is-active {
  display: flex;
}

.hoshiyomi-kyusei-free__loading-spinner {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  border: 3px solid rgba(127, 99, 255, 0.2);
  border-top-color: #7f63ff;
  animation: hoshiyomi-spin 0.8s linear infinite;
}

.hoshiyomi-kyusei-free__loading-text {
  font-size: 14px;
  color: #1e293b;
}

@keyframes hoshiyomi-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.hoshiyomi-kyusei-free__result .kyusei-box .header {
  background-color: #f47f7f;
  color: #ffffff;
  text-align: center;
  border-right: 1px solid #fff;
  font-weight: 100;
  padding: 4px 0;
  font-family: "游明朝", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "HG明朝E", "ＭＳ Ｐ明朝", "MS PMincho", "serif";
}

.hoshiyomi-kyusei-free__result .kyusei-box .kyusei {
  font-size: 1.5rem;
  line-height: 2.3rem;
  text-align: center;
  font-family: "游明朝", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "HG明朝E", "ＭＳ Ｐ明朝", "MS PMincho", "serif";
}

.hoshiyomi-kyusei-free__result .kyusei-box .kanshi {
  background-color: #14a690;
  color: #fff;
  padding: 2px 2em;
  border-radius: 0.5em;
  margin: 0 auto;
  font-size: 0.9rem;
  display: inline-block;
}

.hoshiyomi-kyusei-free__result .kyuseiban {
  margin: 0 auto;
}

.hoshiyomi-kyusei-free__result .kyusei-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  white-space: nowrap;
  text-align: center;
  font-family: "游明朝", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "HG明朝E", "ＭＳ Ｐ明朝", "MS PMincho", "serif";
}

.hoshiyomi-kyusei-free__result .kyusei-table th {
  background-color: #f47f7f;
  color: #ffffff;
  text-align: center;
  border-right: 1px solid #fff;
  font-weight: 100;
  padding: 8px 0;
  font-family: "游明朝", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "HG明朝E", "ＭＳ Ｐ明朝", "MS PMincho", "serif";
}

.hoshiyomi-kyusei-free__result .kyusei-table td {
  vertical-align: top;
  text-align: center;
  padding-top: 5px;
  padding-bottom: 5px;
  border: 1px solid;
  font-family: "游明朝", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "HG明朝E", "ＭＳ Ｐ明朝", "MS PMincho", "serif";
}

.hoshiyomi-kyusei-free__result .kyusei-table td h2 {
  text-align: center;
  font-family: "游明朝", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "HG明朝E", "ＭＳ Ｐ明朝", "MS PMincho", "serif";
  font-size: 16px;
}

.hoshiyomi-kyusei-free__result .kyusei-table td aside {
  display: inline-block;
  background-color: #14a690;
  color: #fff;
  padding: 5px 2em;
  border-radius: 0.5em;
  margin: 0 auto;
  font-size: 0.9rem;
}
