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

/* インラインスタイルでテーマCSSに依存しないようにする */
.hoshiyomi-suimei-free {
  padding: 32px;
  border-radius: 12px;
  margin: 40px 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* モバイル用スタイル */
@media (max-width: 767px) {
  .hoshiyomi-suimei-free {
    padding: 0px !important;
    margin: 10px 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden; /* 横スクロールを非表示 */
  }
  
  .hoshiyomi-suimei-free__result-cards {
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }
  
  .hoshiyomi-suimei-free__result-card {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
    margin: 0 !important;
  }
  
  .hoshiyomi-suimei-free__result-card-body {
    padding: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: auto; /* 横スクロールを許可 */
    -webkit-overflow-scrolling: touch; /* iOSでのスムーズスクロール */
  }
  
  .hoshiyomi-suimei-free__result-tuhen {
    font-size: 20px !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
  }
  
  .hoshiyomi-suimei-free__result-description {
    font-size: 14px !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
  }
}

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

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

/* モバイル用フォームスタイル */
@media (max-width: 767px) {
  .hoshiyomi-suimei-free__field {
    margin-bottom: 16px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .hoshiyomi-suimei-free__field label {
    font-size: 13px !important;
    margin-bottom: 6px !important;
  }
  
  .hoshiyomi-suimei-free__date-group {
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .hoshiyomi-suimei-free__submit {
    padding: 12px 24px !important;
    font-size: 15px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
}

.hoshiyomi-suimei-free__field input[type="text"],
.hoshiyomi-suimei-free__field input[type="time"],
.hoshiyomi-suimei-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-suimei-free__date-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

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

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

.hoshiyomi-suimei-free__field input:focus,
.hoshiyomi-suimei-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-suimei-free__field.hoshi-flex {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

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

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

.hoshiyomi-suimei-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-suimei-free__submit:hover {
  background-color: #6949ff;
}

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

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

.hoshiyomi-suimei-free__iframe-wrapper {
  margin-top: 32px;
  border-radius: 8px;
  overflow: hidden;
}

.hoshiyomi-suimei-free__iframe-wrapper iframe {
  min-width: 400px; /* iframeの最小幅を設定 */
  min-height: 720px; /* iframeの最小高さを設定 */
  border: none; /* iframeの境界線を非表示 */
  outline: none; /* iframeの枠線を非表示 */
}

/* モバイル用iframeスタイル */
@media (max-width: 767px) {
  .hoshiyomi-suimei-free__iframe-wrapper {
    margin-top: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 !important; /* パディングをリセット */
    overflow-x: auto; /* 横スクロールを許可 */
    -webkit-overflow-scrolling: touch; /* iOSでのスムーズスクロール */
  }
  
  .hoshiyomi-suimei-free__iframe-wrapper iframe {
    min-width: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 500px !important;
    box-sizing: border-box !important;
    border: none !important; /* 枠線を削除 */
    outline: none !important;
  }
}

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

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

.hoshiyomi-suimei-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-suimei-free__result-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 768px) {
  .hoshiyomi-suimei-free__result-cards {
    grid-template-columns: 1fr;
    max-width: 600px;
    margin: 0 auto;
  }
}

.hoshiyomi-suimei-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-suimei-free__result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

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

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

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

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

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

.hoshiyomi-suimei-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-suimei-free__result-tuhen {
  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-suimei-free__result-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-suimei-free__loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  color: #1e293b;
  font-weight: 500;
}

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

.hoshiyomi-suimei-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-suimei-free__loading-text {
  font-size: 14px;
  color: #1e293b;
}

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