/* === サンマックス出張費見積もりツール === */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Meiryo", "Yu Gothic", sans-serif;
  background: #f4f6f8;
  color: #1a1a1a;
  line-height: 1.6;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }

header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2c5582 100%);
  color: white;
  padding: 28px 0 24px;
  margin-bottom: 24px;
}
header h1 { font-size: 1.6rem; margin-bottom: 6px; }
header .lead { font-size: 0.95rem; opacity: 0.92; }

.card {
  background: white;
  border-radius: 8px;
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.card h2 {
  font-size: 1.05rem;
  color: #1e3a5f;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1e3a5f;
  color: white;
  font-size: 0.85rem;
  font-weight: bold;
}

label {
  display: block;
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 6px;
}
label small { color: #999; font-weight: normal; margin-left: 4px; }

input[type="text"], select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d0d7de;
  border-radius: 5px;
  font-size: 1.05rem;
  background: white;
  transition: border 0.15s;
}
input[type="text"]:focus, select:focus {
  outline: none;
  border-color: #2c5582;
  box-shadow: 0 0 0 2px rgba(44,85,130,0.15);
}

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.suggest {
  list-style: none;
  background: white;
  border: 1px solid #d0d7de;
  border-radius: 5px;
  margin-top: 4px;
  max-height: 280px;
  overflow-y: auto;
  position: relative;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.suggest li {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.92rem;
}
.suggest li:last-child { border-bottom: none; }
.suggest li:hover { background: #eef4fa; }
.suggest li .pcd { color: #2c5582; font-weight: 600; margin-right: 8px; }

/* === デカデカ市区町村バナー === */
.city-banner {
  margin-top: 16px;
  padding: 20px 24px;
  background: linear-gradient(135deg, #1e3a5f 0%, #2c5582 100%);
  color: white;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(30,58,95,0.18);
}
.city-banner .icon {
  display: inline-block;
  font-size: 1.6rem;
  margin-right: 6px;
  vertical-align: middle;
}
.city-banner .city-name {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  vertical-align: middle;
}
.city-banner .pcd-tag {
  display: block;
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 4px;
}

.note {
  font-size: 0.85rem;
  color: #b8651b;
  background: #fff7ed;
  padding: 8px 12px;
  border-left: 3px solid #f59e0b;
  border-radius: 3px;
  margin-top: 8px;
}
.note:empty { display: none; }

/* === 比較サマリーカード === */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.sum-card {
  border: 1px solid #e0e6ec;
  border-radius: 8px;
  padding: 18px 16px;
  position: relative;
  background: white;
  transition: all 0.15s;
  cursor: pointer;
}
.sum-card:hover:not(.unavail) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.sum-card.active {
  border: 2px solid #2c5582 !important;
  background: #eef4fa;
  box-shadow: 0 4px 14px rgba(44,85,130,0.2);
}
.sum-card.cheapest {
  border: 2px solid #d4a017;
  background: #fffbeb;
  box-shadow: 0 2px 8px rgba(212,160,23,0.15);
}
.sum-card.cheapest.active {
  border: 2px solid #2c5582 !important;
  background: #eef4fa;
}
.sum-card.unavail {
  background: #f7f7f7;
  color: #999;
  border-style: dashed;
}
.sum-card .mode {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e3a5f;
}
.sum-card.unavail .mode { color: #999; }
.sum-card .price {
  font-size: 1.7rem;
  font-weight: 700;
  color: #b8651b;
  margin: 8px 0 2px;
}
.sum-card.unavail .price { color: #999; font-size: 1.05rem; }
.sum-card .subtotal {
  font-size: 0.82rem;
  color: #666;
}
.sum-card .meta {
  margin-top: 8px;
  font-size: 0.82rem;
  color: #555;
}
.sum-card .badge-top {
  position: absolute;
  top: -10px;
  right: 14px;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge.best { background: #d4a017; color: white; }
.badge.lcc { background: #b91c1c; color: white; }
.badge.flex { background: #2563eb; color: white; }

/* === タブ === */
.quote-tabs {
  display: flex;
  border-bottom: 2px solid #e0e6ec;
  margin-bottom: 16px;
}
.quote-tabs button {
  background: none;
  border: none;
  padding: 12px 20px;
  font-size: 0.95rem;
  color: #555;
  cursor: pointer;
  position: relative;
  font-family: inherit;
  font-weight: 500;
}
.quote-tabs button.active {
  color: #1e3a5f;
  font-weight: 700;
}
.quote-tabs button.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: #2c5582;
}
.quote-tabs button:disabled { color: #ccc; cursor: not-allowed; }

.quote-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.btn {
  background: #2c5582;
  color: white;
  border: none;
  padding: 11px 22px;
  border-radius: 5px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s;
  font-weight: 500;
}
.btn:hover { background: #1e3a5f; }
.btn.primary { background: #b8651b; }
.btn.primary:hover { background: #9a5114; }
.btn:disabled { background: #ccc; cursor: not-allowed; }

#quote {
  background: white;
  padding: 32px;
  border: 1px solid #e0e0e0;
  font-size: 0.88rem;
}

.quote-doc h3 {
  text-align: center;
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 2px solid #1e3a5f;
}

.quote-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
  font-size: 0.85rem;
}
.quote-meta .to strong { font-size: 1.05rem; display: block; margin-bottom: 4px; }

.quote-items {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
}
.quote-items th {
  background: #1e3a5f;
  color: white;
  padding: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}
.quote-items td {
  padding: 8px;
  border-bottom: 1px solid #e0e0e0;
  font-size: 0.85rem;
}
.quote-items td.right { text-align: right; }
.quote-items tr.total td {
  border-top: 2px solid #1e3a5f;
  padding-top: 10px;
  font-weight: bold;
  background: #fef8e7;
}
.quote-items tr.tax td { padding-top: 6px; padding-bottom: 6px; }

.quote-notes {
  margin-top: 18px;
  padding: 12px;
  background: #f8f9fa;
  border-left: 3px solid #2c5582;
  font-size: 0.82rem;
  line-height: 1.7;
}

.loader {
  text-align: center;
  padding: 30px;
  color: #666;
  font-size: 0.95rem;
}

footer {
  background: #1e3a5f;
  color: #c8d0d8;
  padding: 28px 0;
  margin-top: 40px;
  text-align: center;
  font-size: 0.85rem;
}
footer a { color: #88b8e8; }

@media (max-width: 600px) {
  header h1 { font-size: 1.3rem; }
  .grid-3 { grid-template-columns: 1fr; }
  .quote-meta { grid-template-columns: 1fr; }
  #quote { padding: 18px; }
  .quote-doc h3 { font-size: 1.2rem; }
  .city-banner .city-name { font-size: 1.5rem; }
  .sum-card .price { font-size: 1.4rem; }
}

/* === A4 印刷用 === */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 15mm;
  }
  body { background: white; font-size: 10pt; }
  header, footer, .card:not(#quoteSection),
  .quote-tabs, .quote-actions, .quote-header button,
  #loader { display: none !important; }
  #quoteSection {
    box-shadow: none;
    border: none;
    padding: 0;
    margin: 0;
  }
  #quote {
    background: white;
    border: none;
    padding: 0;
    font-size: 10pt;
  }
  .quote-doc h3 {
    font-size: 18pt;
    margin-bottom: 14pt;
    padding-bottom: 6pt;
  }
  .quote-meta {
    font-size: 9pt;
    margin-bottom: 14pt;
  }
  .quote-meta .to strong { font-size: 11pt; }
  .quote-items {
    font-size: 9pt;
    page-break-inside: avoid;
  }
  .quote-items th { padding: 5pt; font-size: 9pt; }
  .quote-items td { padding: 5pt; font-size: 9pt; }
  .quote-items tr { page-break-inside: avoid; }
  .quote-notes {
    font-size: 8pt;
    padding: 8pt;
    page-break-inside: avoid;
  }
  a { color: black !important; text-decoration: none !important; }
}

/* PDF生成時の見積書整形 (A4幅 = 210mm 相当) */
.quote-doc-print {
  width: 210mm;
  padding: 10mm 14mm;
  margin: 0 auto;
  background: white;
  box-sizing: border-box;
  font-size: 10.5pt;
  line-height: 1.4;
}
.quote-doc-print h3 { font-size: 16pt; margin-bottom: 10pt; padding-bottom: 4pt; }
.quote-doc-print .quote-meta { font-size: 9pt; margin-bottom: 10pt; }
.quote-doc-print .quote-items { font-size: 9.5pt; }
.quote-doc-print .quote-items th,
.quote-doc-print .quote-items td { padding: 4pt 6pt; }
.quote-doc-print .quote-notes { font-size: 8.5pt; padding: 6pt 8pt; margin-top: 8pt; line-height: 1.4; }
