/* 06 result-table-images — 약 정보 표 (Medbot.ui.result). 색 변수는 style.css 의 것을 쓰고, 배지 색만 여기서 */
.result-block {
  --taboo: #c93c3c;        /* 금기 배지 (빨강) */
  --taboo-soft: #fde8e8;
  --caution: #d67d14;      /* 주의 배지 (주황) */
  --caution-soft: #fff1dd;
  align-self: stretch;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .result-block { --taboo-soft: #4a2323; --caution-soft: #4a3516; }
}
:root[data-theme="dark"] .result-block { --taboo-soft: #4a2323; --caution-soft: #4a3516; }

/* ───── 표 ───── */
.result-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.result-caption {
  caption-side: top;
  text-align: left;
  padding: 0 0 6px;
  font-weight: 700;
  color: var(--text);
}
.result-table th,
.result-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
  word-break: break-word;
  line-height: 1.45;
}
.result-table th {
  background: var(--gray-soft);
  color: var(--gray);
  font-size: 12px;
  font-weight: 600;
}
/* 열 너비 (합 100%) */
.result-th-photo { width: 15%; }
.result-th-name  { width: 20%; }
.result-th-ingr  { width: 16%; }
.result-th-efcy  { width: 17%; }
.result-th-use   { width: 17%; }
.result-th-warn  { width: 15%; }

.result-row { cursor: pointer; }
.result-row:hover,
.result-row:focus-visible { background: var(--mint-soft); outline: none; }
.result-row.is-open { background: var(--mint-soft); }
.result-row.is-open td { border-bottom-color: transparent; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .result-row:hover,
  :root:not([data-theme="light"]) .result-row:focus-visible,
  :root:not([data-theme="light"]) .result-row.is-open { background: var(--ink-card); }
}
:root[data-theme="dark"] .result-row:hover,
:root[data-theme="dark"] .result-row:focus-visible,
:root[data-theme="dark"] .result-row.is-open { background: var(--ink-card); }

/* 사진: 제품·알약 썸네일 2장 (64px), 없으면 아이콘 */
.result-cell-photo { display: flex; flex-wrap: wrap; gap: 6px; }
.result-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: var(--gray-soft);
  border: 1px solid var(--line);
  overflow: hidden;
}
.result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: zoom-in;
  background: #fff;
}
.result-thumb.is-empty { color: var(--gray); }
.result-thumb-icon { font-size: 24px; line-height: 1; opacity: 0.7; }

/* 제품명·업체 */
.result-cell-name { display: flex; flex-direction: column; gap: 2px; }
.result-name { font-size: 14px; }
.result-company,
.result-category { font-size: 12px; color: var(--gray); }
.result-category::before { content: "분류 · "; }

/* 주성분 */
.result-ingredients { margin: 0; padding-left: 14px; }
.result-ingredients li { margin: 0 0 2px; }
.result-muted { color: var(--gray); font-size: 12px; }

/* 주의 배지: 금기 = 빨강, 주의 = 주황 */
.result-warning { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.result-warning:last-child { margin-bottom: 0; }
.result-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}
.result-badge.is-taboo   { color: var(--taboo);   background: var(--taboo-soft);   border-color: var(--taboo); }
.result-badge.is-caution { color: var(--caution); background: var(--caution-soft); border-color: var(--caution); }
.result-warning-text {
  font-size: 12px;
  color: var(--gray);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ───── 행 펼침 상세 ───── */
.result-detail-cell { background: var(--gray-soft); padding: 10px 12px 14px; }
.result-detail-body { display: flex; flex-direction: column; gap: 10px; }
.result-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.result-section h4 { margin: 0 0 3px; font-size: 12px; color: var(--mint); }
.result-section p { margin: 0; white-space: pre-wrap; line-height: 1.5; }
.result-fold-btn {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.result-fold-btn:hover { border-color: var(--mint); }

/* ───── 표 아래 ───── */
.result-empty { margin: 0; color: var(--gray); }
.result-source { margin: 0; font-size: 12px; color: var(--gray); }
.result-pharmacy-btn {
  align-self: flex-start;
  border: 1px solid var(--mint);
  background: var(--mint);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.result-pharmacy-btn:hover:not(:disabled) { opacity: 0.9; }
.result-pharmacy-btn:disabled { opacity: 0.5; cursor: default; }
.result-map { width: 100%; min-height: 40px; }
.result-options { display: flex; flex-wrap: wrap; gap: 8px; }
.result-options .option-btn:disabled { opacity: 0.5; cursor: default; }

/* ───── 사진 크게 보기 ───── */
.result-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 16px;
  background: rgba(20, 26, 38, 0.85);
  cursor: zoom-out;
}
.result-lightbox img {
  max-width: min(92vw, 720px);
  max-height: 80vh;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
}
.result-lightbox-caption { color: #fff; font-size: 13px; text-align: center; }

/* ───── 600px 이하: 행을 카드로 ───── */
@media (max-width: 600px) {
  .result-table,
  .result-table tbody,
  .result-table tr,
  .result-table td { display: block; width: 100%; }
  .result-table { border: 0; background: transparent; }
  .result-table thead { display: none; }
  .result-row {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--mint);
    border-radius: 10px;
    background: var(--bg);
    overflow: hidden;
  }
  .result-row.is-open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; margin-bottom: 0; }
  .result-table td {
    display: flex;
    gap: 10px;
    padding: 7px 10px;
    border-bottom: 1px solid var(--line);
  }
  .result-table td:last-child { border-bottom: 0; }
  .result-table td::before {
    content: attr(data-label);
    flex: 0 0 72px;
    font-size: 12px;
    color: var(--gray);
  }
  .result-cell-photo { flex-wrap: nowrap; }
  .result-cell-name { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 8px; }
  .result-cell-name .result-name { width: 100%; }
  .result-detail {
    display: block;
    margin: 0 0 10px;
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
  }
  .result-detail-cell { display: block; }
  .result-detail-cell::before { display: none; }
}
