/* ===== 見積もりページ専用スタイル ===== */
/* style.css の CSS変数を継承して使用 */

/* ===== ヒーロー ===== */
.est-hero {
  background: linear-gradient(135deg, #0d2e5e 0%, #18689d 100%);
  padding: 48px 20px 40px;
  text-align: center;
}

.est-hero-inner {
  max-width: 800px;
  margin: 0 auto;
}

.est-hero .r99-badge {
  background: rgba(255,255,255,.15);
  color: #fff;
  margin-bottom: 16px;
}

.est-hero-title {
  margin: 0 0 12px;
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 900;
  color: #fff;
  line-height: 1.2;
}

.est-hero-title span {
  color: #ffd84d;
}

.est-hero-desc {
  margin: 0;
  font-size: 15px;
  color: rgba(255,255,255,.85);
}

/* ===== ページ全体 ===== */
.estimate-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 20px 60px;
}

/* ===== 2カラムレイアウト ===== */
.estimate-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: stretch;
}

.estimate-form-area { min-width: 0; }

.estimate-summary-area { position: relative; }

/* ===== セクションカード ===== */
.card {
  background: #fff;
  border-radius: 18px;
  padding: 24px 28px;
  box-shadow: 0 4px 20px rgba(0,0,0,.06);
  margin-bottom: 20px;
  border: 1px solid #f0f0f0;
}

.card h2 {
  margin: 0 0 18px;
  font-size: 17px;
  font-weight: 900;
  color: #111;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f3f3f3;
}

.card h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: #ef1f2f;
  border-radius: 2px;
  flex-shrink: 0;
}

.estimate-form-area > h1 {
  display: none; /* ヒーローセクションに移動済み */
}

.lead { display: none; }

/* ===== フォーム要素 ===== */
.form-grid { display: grid; gap: 16px; }

.form-row label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 14px;
  color: #444;
}

input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-size: 15px;
  transition: border-color .2s;
  outline: none;
  font-family: inherit;
}

input[type="number"]:focus {
  border-color: #18689d;
  box-shadow: 0 0 0 3px rgba(24,104,157,.12);
}

/* ===== チェックボックス・ラジオ ===== */
.option-list {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.option-list label,
.radio-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid #e8e8e8;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  transition: border-color .2s, background .2s;
}

.option-list label:hover,
.radio-group label:hover {
  border-color: #18689d;
  background: #f5faff;
}

.option-list input[type="checkbox"],
.radio-group input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: #ef1f2f;
  margin: 0;
  flex-shrink: 0;
}

/* チェック時のスタイル */
.option-list label:has(input:checked),
.radio-group label:has(input:checked) {
  border-color: #ef1f2f;
  background: #fff8f8;
  color: #c0121e;
  font-weight: 700;
}

.radio-group {
  margin-bottom: 14px;
}

.radio-group > p {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
  color: #444;
}

/* ===== 品目リスト ===== */
.card h3 {
  display: none; /* カテゴリコードは非表示（PHPで取得しているcategory_codeがそのまま出ていたため） */
}

.item-category-block {
  margin-bottom: 8px;
}

.subcategory-block {
  margin-bottom: 12px;
  padding: 16px;
  background: #fafbff;
  border-radius: 12px;
  border: 1px solid #eef0f8;
}

.subcategory-block h4 {
  display: none; /* subcategory_codeも非表示 */
}

.item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #ececec;
}

.item-row:last-child { border-bottom: none; }

.item-meta strong {
  font-size: 14px;
  font-weight: 600;
  color: #222;
}

.item-qty {
  flex-shrink: 0;
}

.qty-stepper {
  display: flex;
  align-items: center;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
}

.qty-btn {
  width: 36px;
  height: 36px;
  background: #f5f5f5;
  border: none;
  font-size: 16px;
  font-weight: 700;
  color: #444;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s;
  line-height: 1;
  padding: 0;
}

.qty-btn:hover {
  background: #ef1f2f;
  color: #fff;
}

.qty-btn:active {
  opacity: .8;
}

.item-qty input[type="number"] {
  width: 44px;
  padding: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-left: 1.5px solid #e0e0e0;
  border-right: 1.5px solid #e0e0e0;
  border-radius: 0;
  background: #fff;
  color: #111;
  -moz-appearance: textfield;
}

.item-qty input[type="number"]::-webkit-inner-spin-button,
.item-qty input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

/* 数量が1以上のとき行をハイライト */
.item-row.is-selected {
  background: #fff8f8;
  border-radius: 8px;
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
}

.item-row.is-selected .item-meta strong {
  color: #ef1f2f;
}

/* ===== 概算料金サイドバー ===== */
.summary-card {
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  border: 1px solid #f0f0f0;
}

.summary-card.sticky {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.summary-card h2 {
  margin: 0 0 18px;
  font-size: 16px;
  font-weight: 900;
  color: #111;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f3f3f3;
}

.summary-card h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: #18689d;
  border-radius: 2px;
}

/* 合計金額 */
.summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #ef1f2f, #c0121e);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 18px;
}

.summary-total span {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,.9);
}

.summary-total strong {
  font-size: 26px;
  font-weight: 900;
  color: #fff;
}

/* 内訳 */
.summary-lines > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px dashed #eee;
  gap: 8px;
}

.summary-lines > div:last-child { border-bottom: none; }

.summary-lines > div span:first-child {
  color: #666;
  flex-shrink: 0;
}

.summary-lines > div span:last-child {
  font-weight: 700;
  color: #222;
  text-align: right;
}

hr {
  border: none;
  border-top: 2px solid #f3f3f3;
  margin: 14px 0;
}

.summary-card h3 {
  font-size: 13px;
  font-weight: 700;
  color: #888;
  margin: 14px 0 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.summary-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.summary-list li {
  font-size: 13px;
  color: #444;
  padding: 5px 0 5px 14px;
  position: relative;
  border-bottom: 1px dashed #f0f0f0;
}

.summary-list li:last-child { border-bottom: none; }

.summary-list li::before {
  content: '●';
  position: absolute;
  left: 0;
  color: #ef1f2f;
  font-size: 8px;
  top: 8px;
}

/* CTAボタン */
.summary-cta {
  margin-top: 20px;
  display: grid;
  gap: 10px;
}

.summary-cta a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  transition: opacity .2s, transform .2s;
}

.summary-cta a:hover { opacity: .9; transform: translateY(-1px); }
.summary-cta .btn-phone { background: linear-gradient(135deg, #ff2a36, #df1325); }
.summary-cta .btn-line  { background: linear-gradient(135deg, #34d25a, #16a34a); }

/* ===== 申し込みボタン ===== */
.btn-apply {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #18689d, #0d4a72);
  border: none;
  cursor: pointer;
  transition: opacity .2s, transform .2s;
  font-family: inherit;
}
.btn-apply:hover { opacity: .9; transform: translateY(-1px); }

/* ===== モーダル ===== */
.apply-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.apply-modal[hidden] { display: none; }

body.modal-open { overflow: hidden; }

.apply-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
}

.apply-modal-body {
  position: relative;
  background: #fff;
  border-radius: 20px;
  padding: 32px 28px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: #f0f0f0;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  color: #555;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.modal-close:hover { background: #ddd; }

.apply-modal-body h2 {
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 900;
  color: #111;
  display: flex;
  align-items: center;
  gap: 10px;
}
.apply-modal-body h2 i { color: #18689d; }

/* 見積もり確認エリア */
.modal-estimate-summary {
  background: #f5faff;
  border: 1.5px solid #c8dff0;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 22px;
}

.modal-estimate-label {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: #18689d;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.modal-estimate-total {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #333;
}
.modal-estimate-total strong {
  font-size: 22px;
  color: #ef1f2f;
}

.modal-items-list {
  margin: 0;
  padding: 0 0 0 16px;
  list-style: disc;
}
.modal-items-list li { font-size: 13px; color: #444; margin-bottom: 3px; }
.modal-items-list .option-item { color: #888; }

/* フォームグリッド */
.modal-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.modal-form-row--full { grid-column: 1 / -1; }

.modal-form-row label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #444;
  margin-bottom: 5px;
}

.required {
  display: inline-block;
  background: #ef1f2f;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.modal-form-row input,
.modal-form-row select,
.modal-form-row textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
  box-sizing: border-box;
}

.modal-form-row input:focus,
.modal-form-row select:focus,
.modal-form-row textarea:focus {
  border-color: #18689d;
  box-shadow: 0 0 0 3px rgba(24,104,157,.12);
}

.modal-form-row textarea { resize: vertical; }

.modal-note {
  font-size: 12px;
  color: #888;
  margin-bottom: 18px;
  line-height: 1.6;
}

.btn-submit {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #ef1f2f, #c0121e);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity .2s, transform .2s;
}
.btn-submit:hover { opacity: .9; transform: translateY(-1px); }

/* ===== 申込完了ページ ===== */
.apply-complete {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}

.apply-complete-inner {
  max-width: 600px;
  width: 100%;
  text-align: center;
}

.apply-complete-icon {
  font-size: 72px;
  color: #22c55e;
  margin-bottom: 20px;
  line-height: 1;
}

.apply-complete h1 {
  margin: 0 0 12px;
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 900;
  color: #111;
}

.apply-complete-sub {
  color: #555;
  font-size: 15px;
  margin-bottom: 28px;
  line-height: 1.8;
}

.apply-complete-box {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 16px;
  padding: 24px;
  text-align: left;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,.05);
}

.apply-complete-box dl { margin: 0; }

.apply-complete-box dl > div {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px dashed #eee;
  font-size: 14px;
}

.apply-complete-box dl > div:last-child { border-bottom: none; }

.apply-complete-box dt {
  width: 100px;
  flex-shrink: 0;
  color: #888;
  font-weight: 700;
}

.apply-complete-box dd {
  margin: 0;
  color: #222;
  font-weight: 500;
}

.apply-complete-price {
  font-size: 18px;
  font-weight: 900;
  color: #ef1f2f;
}

.apply-complete-note {
  font-size: 12px;
  color: #999;
  line-height: 1.8;
  margin-bottom: 28px;
}

.apply-complete-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== SP 合計料金固定バー ===== */
.est-fixed-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: #fff;
  border-top: 2px solid #e8e8e8;
  padding: 10px 16px;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.1);
}

.est-fixed-bar-total {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.est-fixed-bar-total span {
  font-size: 11px;
  color: #888;
  font-weight: 700;
}

.est-fixed-bar-total strong {
  font-size: 22px;
  font-weight: 900;
  color: #ef1f2f;
  line-height: 1.1;
}

.est-fixed-apply {
  flex-shrink: 0;
  padding: 12px 18px;
  background: linear-gradient(135deg, #18689d, #0d4a72);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

/* ===== レスポンシブ ===== */
@media (max-width: 767px) {
  /* estimate専用固定バーを表示、サイト共通の電話/LINEバーを非表示 */
  body.page-estimate .mobile-fixed-cta { display: none !important; }
  body.page-estimate { padding-bottom: 0; }
  .est-fixed-bar { display: flex; }
  .estimate-page { padding-bottom: 80px; }
}

@media (max-width: 900px) {
  .estimate-layout {
    grid-template-columns: 1fr;
  }

  .summary-card.sticky {
    position: static;
    max-height: none;
  }

  /* SPでは概算を上に */
  .estimate-summary-area {
    order: -1;
  }
}

@media (max-width: 600px) {
  .estimate-page { padding: 20px 12px 80px; }
  .card { padding: 18px; }
  .est-hero { padding: 36px 16px 28px; }
}

/* ===== 住所選択・距離計算UI ===== */
.address-block {
  border: 1.5px solid #e0e8f0;
  border-radius: 12px;
  padding: 16px 16px 12px;
  margin-bottom: 14px;
  background: #f8fafd;
}

.address-block:last-of-type {
  margin-bottom: 0;
}

.section-desc {
  font-size: 13px;
  color: #666;
  margin: -4px 0 16px;
  line-height: 1.7;
}

.address-block-title {
  font-size: 14px;
  font-weight: 700;
  color: #18689d;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dce8f4;
  display: flex;
  align-items: center;
  gap: 6px;
}

.address-block-desc {
  font-size: 12px;
  color: #777;
  margin: -8px 0 12px;
  line-height: 1.6;
}

.address-pref {
  margin-bottom: 12px;
}

.address-pref-label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin: 0 0 8px;
}

.pref-radio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 12px;
}

.pref-radio-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  transition: border-color .15s, background .15s;
}

.pref-radio-grid label:has(input:checked) {
  border-color: #18689d;
  background: #e8f4ff;
  font-weight: 600;
  color: #18689d;
}

.address-select-row {
  margin-bottom: 10px;
}

.address-select-row:last-child {
  margin-bottom: 0;
}

/* select要素 */
.address-select-row select {
  width: 100%;
  padding: 10px 36px 10px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  cursor: pointer;
}

.address-select-row select:focus {
  border-color: #18689d;
  box-shadow: 0 0 0 3px rgba(24,104,157,.12);
}

.address-select-row select:disabled {
  background-color: #f0f0f0;
  color: #aaa;
  cursor: not-allowed;
}

/* 距離計算エリア */
.distance-calc-area {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-calc-distance {
  width: 100%;
  padding: 13px 16px;
  background: linear-gradient(135deg, #18689d 0%, #0d4a72 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity .2s, transform .1s;
}

.btn-calc-distance:not(:disabled):hover {
  opacity: .88;
}

.btn-calc-distance:not(:disabled):active {
  transform: scale(.98);
}

.btn-calc-distance:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.distance-result {
  padding: 12px 14px;
  background: #e8f7ec;
  border: 1px solid #a8d8b0;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  color: #1d5c2a;
}

.distance-result strong {
  font-size: 15px;
}

.distance-error {
  padding: 12px 14px;
  background: #fde8e8;
  border: 1px solid #f5a0a0;
  border-radius: 10px;
  font-size: 13px;
  color: #b01010;
}

@media (max-width: 600px) {
  .pref-radio-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .address-block {
    padding: 14px 12px 10px;
  }
}
