/* =========================================================
   自贡 · 医疗单位  ——  门户公开查询
   原型图实现：深色导航 + 奶白底 + 卡片列表
   ========================================================= */

:root {
  --bg: #f5f5f4;
  --surface: #ffffff;
  --ink: #1c1917;
  --ink-2: #44403c;
  --ink-3: #78716c;
  --ink-4: #a8a29e;
  --line: #e7e5e4;
  --line-2: #d6d3d1;
  --accent: #b91c1c;
  --row-hov: #fafaf9;
  --err: #991b1b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #FCF0E8 0%, #FEFBF8 100%);
  background-attachment: fixed; /* 渐变在视口中固定，滚动时不变 */
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
a:hover {
  border-bottom-color: var(--line-2);
}
a.bare {
  border-bottom: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ---------- 主体 ---------- */
.page {
  max-width: 960px;
  margin: 0 auto;
  /* padding: 0 16px 64px; */
}

/* ---------- 标题 ---------- */
.title--hero {
  position: relative;
  height: 180px;
  width: 100vw;
  margin: 0 calc(50% - 50vw);   /* 上下无 margin，左右突破 .page 居中限制，铺满视口 */
  padding: 12px 16px;
  box-sizing: border-box;                   /* 无内边距，文字贴齐 banner 边缘 */
  background: url("/assets/images/banner.png") center / cover no-repeat;
  background-color: #6b46c1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
  border-radius: 0;
}

.title {
  margin: 0;
  /* padding: 0 16px; */
  line-height: 1;
  color: #ffffff;
}

.title .eyebrow {
  color: #CBB2AA;
  font-size: 16px;
}

.title .title {
  line-height: 1.2;
  color: #1C1136;
}

.title .sub{
  font-size: 12px;
  color: #7B8298;
}

/* ---------- 筛选 ---------- */
.filter {
  background: #fafaf9;
  border: none;
  border-radius: 12px;
  padding: 22px 22px 24px;
  margin: 12px;
  /* margin-top: -12px;  */
  /* margin-bottom: 18px; */
  position: relative;
  top: -20px;
  z-index: 2;                 /* 确保压住 banner 之上 */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

#filter-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr auto;
  gap: 16px;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field label {
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.02em;
  padding-left: 2px;
}

.field--btn {
  display: flex;
  gap: 8px;
  align-self: end;
  white-space: nowrap;
}

.field--btn .btn {
  min-width: 72px;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: #f5f5f4;
  color: var(--ink-2);
  transition: background 0.12s, color 0.12s, transform 0.05s;
  line-height: 1;
}
.btn:hover {
  background: #e7e5e4;
  color: var(--ink);
}
.btn:active {
  transform: scale(0.97);
}
.btn-solid {
  background: #FE7C65;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(185, 28, 28, 0.08);
}
.btn-solid:hover {
  background: #fca5a5;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(185, 28, 28, 0.15);
}
.btn-pill {
  border-radius: 999px;
  padding: 14px 36px;
  min-width: 120px;
  font-size: 15px;
}

/* ---------- 控件 ---------- */
.form-control {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: var(--surface);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
  outline: none;
  height: 42px;
  transition: border-color 0.12s, box-shadow 0.12s;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.form-control:hover:not(:disabled) {
  border-color: var(--ink-4);
}

.form-control:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(28, 25, 23, 0.08);
}

.form-control:disabled {
  background-color: #f5f5f4;
  color: var(--ink-4);
  cursor: not-allowed;
}

select.form-control {
  --caret: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%2344403c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/></svg>");
  background-image: var(--caret);
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px 6px;
  padding-right: 32px;
  cursor: pointer;
  color: var(--ink);
  transition: background-image 0.15s ease;
}

select.form-control:hover:not(:disabled) {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%231c1917' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/></svg>");
}

select.form-control:focus {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%23b91c1c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/></svg>");
}

/* ---------- 自定义下拉 ---------- */
.select {
  position: relative;
  display: block;
}

.select > select {
  position: absolute !important;
  inset: 0 !important;
  width: 100%;
  height: 100%;
  opacity: 0 !important;
  pointer-events: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

#result-section{
  padding: 0 12px;
  box-sizing: border-box;
}

.select-trigger {
  width: 100%;
  height: 36px;
  padding: 0 14px 0 36px;  /* 左侧 36px 为图标预留空间，右侧仅留 14px 给箭头 */
  border: none;
  border-radius: 10px;
  background-color: #f5f5f4;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
  text-align: left; /* 文字从图标右侧开始向左排列 */
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
  transition: box-shadow 0.12s ease;
}
/* 筛选框左侧占位图标 —— 按字段类型替换为对应 SVG */
.field--map .select-trigger::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  background: url("/assets/images/icons/icon-building.svg") no-repeat center / contain;
  pointer-events: none;
}
.field--district .select-trigger::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  background: url("/assets/images/icons/icon-pin.svg") no-repeat center / contain;
  pointer-events: none;
}
.select-trigger::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 10px;
  height: 6px;
  transform: translateY(-50%);
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%2344403c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/></svg>")
    no-repeat center / contain;
  transition: transform 0.18s ease;
  pointer-events: none;
}
.select-trigger:hover:not(:disabled) {
  /* 去掉 hover 时的描边，仅在 focus/打开时有 */
}
.select-trigger:hover::after {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%231c1917' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/></svg>");
}
.select-trigger:focus-visible,
.select.is-open .select-trigger {
  border: 1px solid #ee8989;
  box-shadow: none;
}
.form-control:focus-visible {
  border: 1px solid #ee8989;
  box-shadow: none;
  outline: none;
}
.select.is-open .select-trigger::after {
  transform: translateY(-50%) rotate(180deg);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%23b91c1c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/></svg>");
}

.select-trigger.is-placeholder {
  color: var(--ink-4);
  font-size: 13px;   /* 与 input 的 .form-control::placeholder 字号一致 */
}

.select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 50;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  max-height: 280px;
  overflow-y: auto;
  font-size: 13px;
  color: var(--ink);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.select.is-open .select-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.select-option {
  position: relative;
  padding: 8px 12px;
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
  color: var(--ink);
  border-radius: 6px;
  margin: 1px 0;
  transition: background-color 0.1s ease;
}
.select-option:first-child { margin-top: 0; }
.select-option:last-child { margin-bottom: 0; }
.select-option:hover:not(.is-selected) {
  background-color: var(--row-hov);
}
.select-option.is-active {
  background-color: #faf5f5;
}
.select-option.is-selected {
  font-weight: 500;
  color: var(--accent);
}
.select-option.is-placeholder {
  color: var(--ink-3);
}
.select-menu::-webkit-scrollbar {
  width: 6px;
}
.select-menu::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 3px;
}
.select-menu::-webkit-scrollbar-track {
  background: transparent;
}

.input-wrapper {
  position: relative;
}
.input-wrapper .form-control {
  padding-right: 36px;
  padding-left: 36px;  /* 左侧 36px 留给搜索图标，文字自然从图标右侧开始 */
  border: none;
  background-color: #f5f5f4;
  height: 36px;
  font-size: 13px;
}
/* 输入框左侧占位图标 —— 替换为真实搜索图标
   注：<input> 不支持 ::before 伪元素，所以挂在包裹层 .input-wrapper 上 */
.field--kw .input-wrapper::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  background: url("/assets/images/icons/icon-search.svg") no-repeat center / contain;
  pointer-events: none;
  z-index: 1;
}
.input-wrapper .trailing {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  border-radius: 50%;
}
.input-wrapper .trailing:hover {
  background: var(--bg);
  color: var(--ink);
}

.form-control::placeholder {
  color: var(--ink-4);
}

/* ---------- 结果摘要 ---------- */
.summary {
  font-size: 13px;
  color: var(--ink-3);
  margin: 4px 0 12px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.summary strong {
  font-weight: 600;
  color: var(--ink);
  font-feature-settings: "tnum";
}
.summary .sep {
  color: var(--ink-4);
}

/* ---------- 卡片列表 ---------- */
.rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.card {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: #fafaf9;
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.12s;
  position: relative; /* 为 .card__badge 右上角绝对定位提供锚点 */
}
.card:hover {
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.08);
}

.card__media {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 4px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card__media img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card__head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card__name {
  margin: 0;
  font-size: 16px;             /* 由 15px 调大到 16px */
  font-weight: 600;            /* 由 500 加粗到 600 (semibold) */
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Source Han Sans CN", "Noto Sans CJK SC", "Heiti SC", sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__badge {
  position: absolute;       /* 脱离 flex 流，绝对定位到卡片右上角 */
  top: 10px;
  right: 10px;
  flex-shrink: 0;
  font-size: 11px;
  color: #FE7C65;            /* 主题色文字 */
  background: #FEE6E3;       /* 主题色淡背景 */
  border: 1px solid #FE7C65; /* 主题色描边 */
  padding: 2px 6px;
  border-radius: 3px;
  z-index: 1;                /* 盖在卡片其它内容之上 */
}

.card__meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card__meta-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-2);
}
.card__meta-row img {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin-top: 2px;
  opacity: 0.5;
}
.card__meta-row span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__phone {
  color: #2563eb;
  font-weight: 500;
  border-bottom: none;
}
.card__phone:hover {
  color: #1d4ed8;
  border-bottom: none;
}

/* ---------- 状态块 ---------- */
.state {
  padding: 24px 16px;
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
  border: 1px dashed var(--line-2);
  border-radius: 6px;
  background: var(--surface);
}
.state.is-error {
  color: var(--err);
  border-color: #fecaca;
  background: #fef2f2;
}
.state.is-hidden {
  display: none;
}

/* ---------- 列表底部"暂无更多…"提示 ---------- */
.list-end {
  padding: 16px 0 12px;
  font-size: 12px;
  color: var(--ink-4);
  text-align: center;
  letter-spacing: 0.3px;
}
.list-end.is-hidden {
  display: none;
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  #filter-form {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "map district"
      "kw kw"
      "btn btn";
    gap: 12px;
  }
  .field--map {
    grid-area: map;
  }
  .field--district {
    grid-area: district;
  }
  .field--kw {
    grid-area: kw;
  }
  .field--btn {
    grid-area: btn;
  }
}

@media (max-width: 480px) {
  .page {
    /* padding: 12px 12px 48px; */
  }
  .filter {
    padding: 14px;
  }
  #filter-form {
    grid-template-columns: 1fr;
    grid-template-areas:
      "map"
      "district"
      "kw"
      "btn";
  }
  .field--btn .btn {
    flex: 1;
  }
  .form-control {
    font-size: 16px;
  }
  .select-trigger {
    font-size: 16px;
  }
  .select-menu {
    font-size: 16px;
  }
  .card {
    padding: 12px;
    gap: 12px;
  }
  .card__media {
    width: 56px;
    height: 56px;
  }
  .card__name {
    font-size: 15px;
    font-weight: 600;            /* 小屏也保持加粗 */
  }
}
