/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Hiragino Sans', 'Meiryo', sans-serif;
  font-size: 15px;
  color: #333;
  background: #f2e0c8;
  line-height: 1.7;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ===== Variables ===== */
:root {
  --primary:   #4a90b8;
  --primary-d: #357a9e;
  --accent:    #e8836a;
  --light:     #eaf4fb;
  --border:    #dde4ea;
  --text-sub:  #777;
  --radius:    8px;
  --shadow:    0 2px 8px rgba(0,0,0,0.08);
}

/* ===== Layout ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo span { font-size: 22px; }

nav { display: flex; gap: 24px; }
nav a {
  font-size: 14px;
  color: #555;
  transition: color .2s;
}
nav a:hover { color: var(--primary); }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, #f5e8d5 0%, #eddcc4 100%);
  padding: 64px 20px 56px;
  text-align: center;
}

.hero h1 {
  font-size: 28px;
  font-weight: 700;
  color: #2c5f7a;
  margin-bottom: 10px;
  line-height: 1.4;
}

.hero p {
  color: #5a7a8a;
  margin-bottom: 32px;
  font-size: 15px;
}

/* ===== Quick Search ===== */
.quick-search {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 24px 28px;
  max-width: 720px;
  margin: 0 auto;
}

.quick-search-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.qs-group { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 140px; }
.qs-group label { font-size: 12px; color: var(--text-sub); font-weight: 600; }

select, input[type="text"] {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: #333;
  background: #fff;
  width: 100%;
  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;
}

select:focus, input:focus { outline: none; border-color: var(--primary); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s, transform .1s;
  border: none;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #d0705a; }
.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--light); }

/* ===== Stage Guide ===== */
.stage-section { padding: 48px 0 40px; }
.section-title {
  font-size: 20px;
  font-weight: 700;
  color: #2c5f7a;
  margin-bottom: 20px;
  text-align: center;
}
.section-title span {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-sub);
  margin-top: 4px;
}

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

.stage-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.stage-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.stage-card .icon { font-size: 32px; margin-bottom: 10px; }
.stage-card h3 { font-size: 14px; font-weight: 700; color: #333; margin-bottom: 6px; }
.stage-card p { font-size: 12px; color: var(--text-sub); }

/* ===== Featured Clinics ===== */
.featured-section { padding: 0 0 48px; }

.clinic-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.clinic-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.clinic-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}

.card-head {
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--border);
}

.card-head h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }

.card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-sub);
}

.rating { color: #f5a623; font-weight: 700; }

.card-body { padding: 14px 18px; }

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.badge-insurance { background: #e8f4fb; color: #357a9e; }
.badge-advanced  { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; } /* 先進医療認定 = オレンジ */
.badge-jiyu      { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; } /* 自由診療のみ = 青 */
.badge-individual{ background: #fdf0e8; color: #9e6a35; }

.card-cost { font-size: 13px; color: #555; margin-bottom: 14px; }
.card-cost strong { color: var(--accent); }

.card-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* ===== Search Page Layout ===== */
.search-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  padding: 32px 0 48px;
  align-items: start;
}

/* ===== Sidebar Filter ===== */
.sidebar {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  position: sticky;
  top: 80px;
}

.filter-title {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.filter-group { margin-bottom: 20px; }
.filter-group h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 10px;
}

.filter-group select { margin-bottom: 8px; }

.checkbox-list { display: flex; flex-direction: column; gap: 8px; }
.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.checkbox-list input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.filter-divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ===== Results Area ===== */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.results-count { font-size: 14px; color: var(--text-sub); }
.results-count strong { color: #333; font-size: 18px; }

.sort-select { width: auto; }

/* ===== Clinic Detail ===== */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  padding: 32px 0 48px;
  align-items: start;
}

.detail-main { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

.detail-hero {
  background: linear-gradient(135deg, #e8f4fb, #f0e8f7);
  padding: 28px 28px 24px;
}

.detail-hero h1 { font-size: 22px; font-weight: 700; color: #2c5f7a; margin-bottom: 8px; }
.detail-hero .meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: #5a7a8a; }

.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  background: #fff;
}

.tab {
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .2s, border-color .2s;
}
.tab.active { color: var(--primary); border-color: var(--primary); }
.tab:hover { color: var(--primary); }

.tab-content { padding: 24px 28px; display: none; }
.tab-content.active { display: block; }

.info-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.info-table th, .info-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; }
.info-table th { width: 140px; color: var(--text-sub); font-weight: 600; background: #fafbfc; }

.treatment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.treatment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
}
.treatment-item.yes { background: #e8f4fb; color: #357a9e; }
.treatment-item.no  { background: #f5f5f5; color: #bbb; }

.cost-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cost-table th, .cost-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.cost-table th { background: #fafbfc; color: var(--text-sub); font-weight: 600; }
.cost-table td.price { font-weight: 700; color: var(--accent); }

/* ===== Detail Sidebar ===== */
.detail-sidebar { display: flex; flex-direction: column; gap: 16px; }

.sidebar-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.sidebar-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: #333; }

.stat-item { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.stat-item:last-child { border-bottom: none; }
.stat-item .label { color: var(--text-sub); }
.stat-item .value { font-weight: 700; color: #333; }

/* ===== Review ===== */
.review-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.review-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.review-stage { font-size: 12px; background: var(--light); color: var(--primary); padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.review-rating { color: #f5a623; font-weight: 700; font-size: 14px; }
.review-text { font-size: 13px; color: #555; }

/* ===== Footer ===== */
footer {
  background: #2c3e50;
  color: #aaa;
  padding: 32px 0;
  font-size: 13px;
  text-align: center;
}
footer a { color: #ccc; }
footer a:hover { color: #fff; }
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 12px; }

/* ===== Utilities ===== */
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; height: auto; padding: 12px 0; gap: 8px; }
  nav { gap: 16px; font-size: 13px; }
  .hero h1 { font-size: 20px; }
  .quick-search-row { flex-direction: column; }
  .search-layout { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .treatment-grid { grid-template-columns: 1fr 1fr; }
}
