/* ==========================================
   ウェディング汎用フォームスタイル
   ========================================== */

/* 日本語フォント */
@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@300;400;500;700&family=Shippori+Mincho:wght@400;500;600;700&display=swap');

/* リセットとベース設定 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Yu Gothic', 'YuGothic', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'メイリオ', 'Meiryo', sans-serif;
  font-weight: 500;
  font-size: 14px;
  color: #3d3d3d;
  line-height: 1.6;
  background: linear-gradient(180deg, #faf8f5 0%, #f5f1ed 30%, #f0ebe6 60%, #fdfcfb 100%);
  min-height: 100vh;
  padding: 30px 15px;
  position: relative;
  overflow-x: hidden;
}

/* 背景装飾 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 300px;
  background: linear-gradient(180deg, rgba(218, 192, 163, 0.08) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(0deg, rgba(237, 224, 212, 0.1) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* フォームコンテナ */
form {
  max-width: 600px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  padding: 40px 30px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(139, 119, 101, 0.08), 0 2px 4px rgba(189, 169, 151, 0.05);
  position: relative;
  z-index: 1;
  border: 1px solid rgba(237, 224, 212, 0.2);
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 上部の装飾ライン */
form::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #c9a88f 0%, #d4b8a0 25%, #dac0a3 50%, #d4b8a0 75%, #c9a88f 100%);
  border-radius: 12px 12px 0 0;
}

/* フォーム内タイトル（divを含むpタグ） */
form > p:has(div) {
  margin-bottom: 24px !important;
  margin-top: 0 !important;
  padding: 0 !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  border-left: none !important;
}

form > p:has(div) div {
  text-align: center;
  padding: 12px 20px;
  margin: 0;
}

form > p:has(div) strong {
  display: block;
  font-weight: 500;
}

form > p:has(div) span {
  font-size: 16px !important;
  letter-spacing: 0.2em;
  color: #1a237e !important;
  font-family: 'Yu Mincho', 'YuMincho', 'Hiragino Mincho ProN', serif;
}

/* ラベル（質問テキスト）のスタイル */
form > p:not(:has(input)):not(:has(select)):not(:has(div)):not(:has(strong)) {
  font-size: 14px;
  font-weight: 500;
  margin-top: 20px;
  margin-bottom: 6px;
  letter-spacing: 0.06em;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}

/* テキスト入力フィールド */
input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  font-family: 'Yu Gothic', 'YuGothic', 'Hiragino Kaku Gothic ProN', sans-serif;
  font-weight: 500;
  border: 1px solid #d4c4b8;
  border-radius: 4px;
  background: #ffffff;
  color: #3d3d3d;
  transition: all 0.2s ease;
  outline: none;
  letter-spacing: 0.04em;
}

input[type="text"]:focus,
input[type="email"]:focus {
  border-color: #c9a88f;
  box-shadow: 0 0 0 3px rgba(201, 168, 143, 0.1);
}

input[type="text"]:hover:not(:focus),
input[type="email"]:hover:not(:focus) {
  border-color: #c9a88f;
}

/* プレースホルダー */
input::placeholder {
  color: #999;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
}

/* セレクトボックス */
select {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  font-family: 'Yu Gothic', 'YuGothic', 'Hiragino Kaku Gothic ProN', sans-serif;
  font-weight: 500;
  border: 1px solid #d4c4b8;
  border-radius: 4px;
  background: #ffffff;
  color: #3d3d3d;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  appearance: none;
  letter-spacing: 0.04em;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23c9a88f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

select:focus {
  border-color: #c9a88f;
  box-shadow: 0 0 0 3px rgba(201, 168, 143, 0.1);
}

select:hover:not(:focus) {
  border-color: #c9a88f;
}

select option[value=""] {
  color: #999;
}

select option {
  color: #3d3d3d;
  padding: 10px;
}

/* 入力欄を含むpタグ（送信ボタンは除外） */
p:has(input:not([type="submit"])),
p:has(select) {
  margin-bottom: 18px;
  padding: 0 !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

/* strong/spanタグとinputが混在する場合の対応 */
p:has(strong) {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

p strong,
p strong span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

/* date入力フィールドのスタイル */
input[type="date"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  font-family: 'Yu Gothic', 'YuGothic', 'Hiragino Kaku Gothic ProN', sans-serif;
  font-weight: 500;
  border: 1px solid #d4c4b8;
  border-radius: 4px;
  background: #ffffff;
  color: #3d3d3d;
  transition: all 0.2s ease;
  outline: none;
  letter-spacing: 0.04em;
  cursor: pointer;
}

input[type="date"]:focus {
  border-color: #c9a88f;
  box-shadow: 0 0 0 3px rgba(201, 168, 143, 0.1);
}

input[type="date"]:hover:not(:focus) {
  border-color: #c9a88f;
}

/* 注意書きのスタイル */
p:has(+ p > input[type="submit"]) {
  font-size: 12px;
  color: #6b5d52;
  margin-top: 24px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: #fef9f6;
  border: 1px solid #f0dfd4;
  border-radius: 4px;
  line-height: 1.7;
  text-align: center;
}

p:has(+ p > input[type="submit"]) strong {
  font-weight: 500;
  display: inline;
}

p:has(+ p > input[type="submit"]) span {
  color: #2962ff !important;
  font-weight: 500;
}

/* 送信ボタン */
input[type="submit"] {
  width: 100%;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 500;
  font-family: 'Yu Gothic', 'YuGothic', 'Hiragino Kaku Gothic ProN', sans-serif;
  color: #ffffff;
  background: linear-gradient(135deg, #c9a88f 0%, #b89777 100%);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(201, 168, 143, 0.2);
  letter-spacing: 0.18em;
  margin-top: 0;
}

input[type="submit"]:hover {
  background: linear-gradient(135deg, #b89777 0%, #a68662 100%);
  box-shadow: 0 4px 8px rgba(201, 168, 143, 0.3);
  transform: translateY(-1px);
}

input[type="submit"]:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(201, 168, 143, 0.2);
}

input[type="submit"]:disabled {
  background: linear-gradient(135deg, #bfb3a7 0%, #afa397 100%);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* 送信ボタンを含むpタグ */
p:has(input[type="submit"]) {
  margin-bottom: 0;
  margin-top: 24px;
}

/* ==========================================
   姓名分割入力のスタイル
   ========================================== */

/* 姓名入力を含むpタグ */
p:has(input[name$="_sei"]),
p:has(input[name$="_mei"]) {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* 姓名の入力フィールド */
input[name$="_sei"],
input[name$="_mei"] {
  flex: 1;
  min-width: 120px;
  max-width: 200px;
}

/* ==========================================
   ラジオボタンのスタイル
   ========================================== */

/* ラジオボタンを含むpタグ */
p:has(input[type="radio"]) {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 8px;
  margin-bottom: 18px;
  align-items: center;
}

/* ラジオボタン本体 */
input[type="radio"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #d4c4b8;
  border-radius: 50%;
  outline: none;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  vertical-align: middle;
  margin-right: 8px;
  flex-shrink: 0;
  grid-column: 1;
}

input[type="radio"]:hover {
  border-color: #c9a88f;
}

input[type="radio"]:checked {
  border-color: #c9a88f;
  background: #ffffff;
}

input[type="radio"]:checked::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c9a88f;
}

input[type="radio"]:focus {
  box-shadow: 0 0 0 3px rgba(201, 168, 143, 0.1);
}

/* ラジオボタンのラベル */
p:has(input[type="radio"]) label {
  font-size: 14px;
  color: #3d3d3d;
  cursor: pointer;
  transition: color 0.2s ease;
  line-height: 1.6;
  grid-column: 2;
}

p:has(input[type="radio"]) label:hover {
  color: #c9a88f;
}

/* ラベルがラジオボタンの前にある場合 */
label:has(input[type="radio"]) {
  display: flex;
  align-items: center;
  cursor: pointer;
  gap: 8px;
}

/* ==========================================
   テキストエリア対応
   ========================================== */

textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  font-family: 'Yu Gothic', 'YuGothic', 'Hiragino Kaku Gothic ProN', sans-serif;
  font-weight: 500;
  border: 1px solid #d4c4b8;
  border-radius: 4px;
  background: #ffffff;
  color: #3d3d3d;
  transition: all 0.2s ease;
  outline: none;
  resize: vertical;
  min-height: 100px;
  line-height: 1.7;
  letter-spacing: 0.04em;
}

textarea:focus {
  border-color: #c9a88f;
  box-shadow: 0 0 0 3px rgba(201, 168, 143, 0.1);
}

textarea:hover:not(:focus) {
  border-color: #c9a88f;
}

textarea::placeholder {
  color: #999;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
}

/* フォーム全体のアニメーション */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* アクセシビリティ向上 */
input:focus-visible,
select:focus-visible {
  outline: 3px solid #c9a88f;
  outline-offset: 3px;
}

/* 入力エラー時のスタイル */
input:invalid:not(:placeholder-shown),
select:invalid:not(:placeholder-shown) {
  border-color: #d4a88f;
}

/* 美しいスクロールバー（Webkit系ブラウザ） */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f5f0eb;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #c9a88f, #dac0a3);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #b89777, #c9a88f);
}

/* ==========================================
   レスポンシブデザイン
   ========================================== */

/* タブレット */
@media (max-width: 768px) {
  body {
    padding: 20px 12px;
  }
  
  form {
    padding: 30px 24px;
  }
  
  input[type="submit"] {
    font-size: 14px;
    padding: 13px 24px;
  }
}

/* スマートフォン */
@media (max-width: 480px) {
  body {
    padding: 0;
  }
  
  form {
    padding: 24px 16px;
    border-radius: 0;
    box-shadow: none;
    border: none;
  }
  
  form::before {
    border-radius: 0;
  }
  
  /* フォーム内タイトル（スマホ） */
  form > p:has(div) {
    margin-bottom: 20px !important;
  }
  
  form > p:has(div) div {
    padding: 10px 16px;
  }
  
  form > p:has(div) span {
    font-size: 14px !important;
    letter-spacing: 0.15em;
  }
  
  /* ラベル（スマホ） */
  form > p:not(:has(input)):not(:has(select)):not(:has(div)):not(:has(strong)) {
    font-size: 13px;
    margin-top: 16px;
  }
  
  input[type="text"],
  input[type="email"],
  select {
    font-size: 14px;
    padding: 11px 12px;
  }
  
  select {
    background-position: right 12px center;
    padding-right: 38px;
  }
  
  input[type="date"] {
    font-size: 14px;
    padding: 11px 12px;
  }
  
  p strong,
  p strong span {
    font-size: 12px;
  }
  
  input[type="submit"] {
    font-size: 14px;
    padding: 13px 24px;
    letter-spacing: 0.8px;
  }
  
  p:has(+ p > input[type="submit"]) {
    font-size: 11px;
    padding: 10px 12px;
    margin-top: 20px;
    margin-bottom: 16px;
    line-height: 1.8;
  }
  
  p:has(+ p > input[type="submit"]) span {
    display: inline;
    word-break: keep-all;
  }
  
  /* 姓名入力（スマホ） */
  p:has(input[name$="_sei"]),
  p:has(input[name$="_mei"]) {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  input[name$="_sei"],
  input[name$="_mei"] {
    max-width: 100%;
  }
  
  /* ラジオボタン（スマホ） */
  p:has(input[type="radio"]) {
    gap: 10px 6px;
  }
  
  input[type="radio"] {
    width: 16px;
    height: 16px;
  }
  
  input[type="radio"]:checked::before {
    width: 8px;
    height: 8px;
  }
  
  p:has(input[type="radio"]) label {
    font-size: 13px;
  }
}
