/**
 * 薬局一覧ページ用スタイル
 */

/* This template only: prevent page-level horizontal scrollbar */
/* overflow-x: clip (not hidden) でスクロールバーを隠しつつ、スクロールコンテナを作らない */
/* overflow-x: hidden はhtmlにスクロールコンテナを作らせ position: sticky を妨げるため使用不可 */
html,
body {
  overflow-x: clip;
}

/* Desktop (Figma: 1920px canvas) tuned values */
.pharmacy-page {
  font-family: 'Noto Sans JP', sans-serif;
}

.pharmacy-list-bleed {
  margin-right: 0;
}

.pharmacy-title {
  font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
  font-weight: 700;
  line-height: normal;
}

.filter-section-title {
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 700;
  line-height: normal;
}

.design-card-header.pharmacy-search-header {
  height: 60px;
  padding: 0;
  font-size: 30px;
  line-height: normal;
}

.pharmacy-keyword-input {
  height: 60px;
  font-size: 20px;
  font-weight: 700;
  line-height: normal;
  padding-left: 29px;
  padding-right: 24px;
}

.pharmacy-keyword-input::placeholder {
  color: #aaa;
  font-weight: 700;
  opacity: 1;
}

.pharmacy-results-card {
  padding: 32px 40px;
}

.pharmacy-results-text {
  font-size: 24px;
  font-weight: 400;
  color: #222;
  line-height: normal;
}

.pharmacy-results-text strong {
  font-weight: 700;
  color: #04786d;
}

.pharmacy-legend {
  gap: 15px;
}

.pharmacy-legend-item {
  height: 56px;
  border-radius: 5px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pharmacy-legend-item--home {
  width: 200px;
}

.pharmacy-legend-item--shinshu {
  width: 200px;
}

.pharmacy-legend-item--no-prescription {
  width: 265px;
}

.pharmacy-legend-label {
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 500;
  font-size: 18px;
  color: #222;
  line-height: normal;
  white-space: nowrap;
}

/* Table (Figma node 139:9) desktop specs */
@media (min-width: 641px) {

  /* override theme css/pharmacy-archive.css */
  .pharmacy-page table.pharmacy-table thead th {
    background-color: #04786d;
    color: #ffffff;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    font-weight: 700;
    font-size: 22px;
    height: 60px;
    line-height: normal;
    vertical-align: middle;
    text-align: center;
    padding: 0;
    border-bottom: none;
  }

  .pharmacy-page table.pharmacy-table thead th+th {
    border-left: 2px solid rgba(255, 255, 255, 1);
  }

  .pharmacy-page table.pharmacy-table thead th:first-child {
    border-top-left-radius: 10px;
  }

  .pharmacy-page table.pharmacy-table thead th:last-child {
    border-top-right-radius: 10px;
  }

  table.pharmacy-table {
    border-collapse: collapse;
  }

  table.pharmacy-table tbody td {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 24px;
    color: #222;
    vertical-align: top;
    padding-top: 40px;
    padding-bottom: 28px;
    padding-left: 0;
    padding-right: 0;
    text-align: left;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .pharmacy-page table.pharmacy-table tbody td:nth-child(1) {
    padding-left: 40px;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    font-weight: 700;
  }

  .pharmacy-page table.pharmacy-table tbody td:nth-child(2) {
    padding-left: 28px;
  }

  .pharmacy-page table.pharmacy-table tbody td:nth-child(3) {
    padding-left: 26px;
  }

  .pharmacy-page table.pharmacy-table tbody td:nth-child(4) {
    padding-left: 28px;
  }

  .pharmacy-page table.pharmacy-table tbody td:nth-child(5) {
    padding-left: 25px;
    padding-top: 31px;
  }

  .pharmacy-page table.pharmacy-table tbody td:nth-child(6) {
    text-align: center;
    padding-top: 41px;
  }

  .pharmacy-page table.pharmacy-table tbody td:nth-child(6) a {
    display: inline-flex;
    align-items: flex-start;
    justify-content: center;
  }

  .pharmacy-page table.pharmacy-table .pharmacy-functions {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 6px;
  }
}

/* Wide desktop: keep Figma fixed column widths */
@media (min-width: 1200px) {
  table.pharmacy-table {
    table-layout: fixed;
  }

  table.pharmacy-table col.col-name {
    width: 289px;
  }

  table.pharmacy-table col.col-address {
    width: 310px;
  }

  table.pharmacy-table col.col-tel {
    width: 195px;
  }

  table.pharmacy-table col.col-hours {
    width: 141px;
  }

  table.pharmacy-table col.col-functions {
    width: 148px;
  }

  table.pharmacy-table col.col-detail {
    width: 114px;
  }
}

/* Narrow desktop: fixed layout with proportional column widths (based on Figma ratios) */
@media (min-width: 641px) and (max-width: 1199px) {
  table.pharmacy-table {
    table-layout: fixed;
  }

  table.pharmacy-table col.col-name      { width: 21%; }
  table.pharmacy-table col.col-address   { width: 19%; }
  table.pharmacy-table col.col-tel       { width: 15%; }
  table.pharmacy-table col.col-hours     { width: 17%; }
  table.pharmacy-table col.col-functions { width: 18%; }
  table.pharmacy-table col.col-detail    { width: 10%; }

  .pharmacy-page table.pharmacy-table tbody td:nth-child(1),
  .pharmacy-page table.pharmacy-table tbody td:nth-child(2),
  .pharmacy-page table.pharmacy-table tbody td:nth-child(3),
  .pharmacy-page table.pharmacy-table tbody td:nth-child(4),
  .pharmacy-page table.pharmacy-table tbody td:nth-child(5) {
    padding-left: 16px;
  }
}

.badge-home,
.badge-shinshu,
.badge-no-prescription {
  height: 26px;
  font-size: 16px;
  font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
  font-weight: 700;
  line-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 2px;
  white-space: nowrap;
}

.badge-home,
.badge-shinshu {
  width: 50px;
}

.badge-no-prescription {
  width: 103px;
}

@media (min-width: 641px) {
  .pharmacy-title {
    font-size: 40px;
  }

  .filter-section-title {
    font-size: 24px;
  }
}

.search-cta {
  height: 70px;
  font-size: 26px;
  font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
  font-weight: 700;
}

.badge-home {
  background: #e57462;
  color: #ffffff;
  border-radius: 2px;
}

.badge-shinshu {
  background: #28a570;
  color: #ffffff;
  border-radius: 2px;
}

.badge-no-prescription {
  background: #4177c9;
  color: #ffffff;
  border-radius: 2px;
}

.filter-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  min-width: 24px;
  border: 1px solid #04786d;
  border-radius: 2px;
  background: #fff;
  cursor: pointer;
  position: relative;
}

.filter-checkbox:checked {
  background: #fff;
}

.filter-checkbox:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg width='10' height='8' viewBox='0 0 10 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8.76725 0.00878273C9.82085-0.123136 10.4225 1.26319 9.65069 2.00709L4.16317 7.6398C3.76132 8.04102 3.18173 8.11986 2.70241 7.81153C1.98912 6.96147 0.942357 6.17932 0.26857 5.3199C-0.575373 4.24425 0.73422 2.78143 1.92075 3.78058C2.39628 4.18102 2.82167 4.76256 3.28884 5.18642L3.37164 5.19344L8.20589 0.251545C8.34794 0.139141 8.59026 0.0314198 8.76725 0.00956332V0.00878273Z' fill='%23000000'/%3E%3C/svg%3E") no-repeat center;
}

.pharmacy-page .scrollbar-hide::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Force-hide horizontal scrollbars inside this page (keep vertical scrollbars as-is) */
.pharmacy-page *::-webkit-scrollbar {
  height: 0 !important;
}

.pharmacy-page .scrollbar-hide {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

/* Always clip & hide scrollbars for the pharmacy table scroller (Chrome safe) */
/* overflow: clip (not hidden) to avoid creating a scroll container, which would break position: sticky on thead th */
.pharmacy-page .pharmacy-table-scroll-clip {
  overflow: clip;
}

.pharmacy-page .pharmacy-table-scroll {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  padding-bottom: 16px;
  margin-bottom: -16px;
}

.pharmacy-page .pharmacy-table-scroll::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.pharmacy-page .pharmacy-table-scroll::-webkit-scrollbar-thumb {
  background: transparent !important;
}

.pharmacy-page .pharmacy-table-scroll::-webkit-scrollbar-track {
  background: transparent !important;
}

/* Mobile (SP) */
@media (max-width: 640px) {
  .pharmacy-page {
    overflow-x: clip;
  }

  /* Remove only the right page padding for the table section (Figma SP: no right margin) */
  .pharmacy-list-bleed {
    margin-right: -15px;
  }

  .pharmacy-title {
    font-size: 1.5rem;
  }

  .filter-section-title {
    font-size: 1.125rem;
  }

  .design-card-header.pharmacy-search-header {
    height: 50px;
    padding: 0;
    font-size: 18px;
    line-height: normal;
  }

  .pharmacy-keyword-input {
    height: 50px;
    font-size: 15px;
    font-weight: 700;
    padding: 0 20px;
  }

  .badge-home,
  .badge-shinshu,
  .badge-no-prescription {
    font-size: 14px;
    line-height: 20px;
    height: 20px;
    min-width: 0;
    padding: 0;
  }

  .badge-home,
  .badge-shinshu {
    width: 38px;
  }

  .badge-no-prescription {
    width: 83px;
  }

  .pharmacy-results-card {
    padding: 26px 15px 16px;
  }

  .pharmacy-results-text {
    font-size: 18px;
  }

  .pharmacy-legend-item,
  .pharmacy-legend-item--home,
  .pharmacy-legend-item--shinshu,
  .pharmacy-legend-item--no-prescription {
    height: 40px;
    padding: 10px 11px;
  }

  .pharmacy-legend {
    gap: 11px;
  }

  .pharmacy-legend-item {
    gap: 8px;
  }

  .pharmacy-legend-item--home,
  .pharmacy-legend-item--shinshu {
    width: 152px;
  }

  .pharmacy-legend-item--no-prescription {
    width: 208px;
  }

  .search-cta {
    height: 40px;
    font-size: 16px;
  }

  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }

  .design-card-header {
    font-size: 1.125rem;
  }

  /* Search card inner layout (Figma SP: 15px side padding, 25px top padding) */
  .pharmacy-search-body {
    padding: 25px 15px 20px;
  }

  /* Filter tiles spacing (Figma SP: 40px height, 10px gap) */
  #area-filter {
    gap: 10px;
  }

  .pharmacy-filter-item {
    height: 40px;
    padding: 8px 10px;
    border-radius: 5px;
  }

  .pharmacy-filter-text {
    font-size: 15px;
    font-weight: 700;
    font-family: 'Noto Sans JP', sans-serif;
    line-height: normal;
  }

  /* Keyword placeholder weight matches Figma */
  .pharmacy-keyword-input::placeholder {
    font-size: 15px;
    font-weight: 700;
  }

  /* Results text alignment (Figma SP centered) */
  .pharmacy-results-text {
    text-align: center;
  }

  /* Table (Figma SP: header 50px, th 16px Zen Maru, td 14px/24px Noto) */
  .pharmacy-page table.pharmacy-table thead,
  .pharmacy-page table.pharmacy-table thead th {
    background-color: #04786d;
    color: #ffffff;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    font-weight: 700;
    font-size: 16px;
    height: 50px;
    line-height: normal;
    vertical-align: middle;
    border-bottom: none;
  }

  .pharmacy-page table.pharmacy-table thead th:first-child {
    padding-left: 15px !important;
  }

  .pharmacy-page table.pharmacy-table thead th {
    text-align: left;
    white-space: nowrap;
  }

  .pharmacy-page table.pharmacy-table thead th+th {
    border-left: 2px solid rgba(255, 255, 255, 1);
  }

  .pharmacy-page table.pharmacy-table thead th:nth-child(n + 2) {
    padding-left: 21px !important;
  }

  .pharmacy-page table.pharmacy-table tbody td:nth-child(1),
  .pharmacy-page table.pharmacy-table tbody td.pharmacy-cell--name {
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif !important;
    font-weight: 700 !important;
  }

  .pharmacy-page table.pharmacy-table tbody td,
  .pharmacy-page table.pharmacy-table tbody td.pharmacy-cell {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 24px;
    color: #222;
    vertical-align: top;
    padding: 25px 0 11px 15px !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .pharmacy-table-card {
    padding-left: 0 !important;
    padding-right: 0 !important;
    /* overflow: clip でコンテンツをクリップしつつ、スクロールコンテナを作らない（position: sticky が機能するように） */
    overflow: clip;
  }

  .pharmacy-scroll-hint {
    font-size: 14px;
    line-height: 24px;
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
  }

  .pharmacy-legend-label {
    font-size: 14px;
    font-weight: 500;
  }
}

/* 開局時間：列幅に応じて自動折り返し（メディアクエリ不要） */
.hours-row {
  display: flex;
  flex-wrap: wrap;
}

.hours-label,
.hours-time {
  white-space: nowrap;
}

/* SP: テーブル角丸 */
@media (max-width: 639px) {
  .pharmacy-table-scroll {
    display: flex;
  }

  .pharmacy-table-scroll::after {
    content: none;
  }

  .pharmacy-table {
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
  }

  .pharmacy-table thead tr th:first-child {
    border-top-left-radius: 10px;
  }

  .pharmacy-table thead tr th:last-child {
    border-top-right-radius: 10px;
  }

  .pharmacy-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 10px;
  }

  .pharmacy-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 10px;
  }
}
