/* =============================================================
 * medical.css — 의료소모품·의료기기 정보 EMR 전용 스타일
 * -------------------------------------------------------------
 * 기존 style.css 와 격리: 모든 클래스는 .ms- 접두어 사용.
 * 색상 톤은 기존 앱(네이비/블루)과 맞춤.
 * ============================================================= */

/* ---------- 색 변수 ---------- */
.ms-root {
  --ms-navy: #003366;
  --ms-blue: #2b579a;
  --ms-line: #d3dae5;
  --ms-bg: #f4f6f8;
  --ms-card: #ffffff;
  --ms-muted: #6b7a90;
}

/* ---------- 전체 컨테이너 ---------- */
.ms-root {
  font-family: inherit;
  color: #1a2533;
  font-size: 13px;
}
.ms-hidden { display: none !important; }

/* ---------- 상단 바 (제품명 + 액션) ---------- */
.ms-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--ms-card);
  border: 1px solid var(--ms-line); border-top: 3px solid var(--ms-blue);
  border-radius: 4px; margin-bottom: 12px; flex-wrap: wrap;
}
.ms-topbar .ms-title { font-size: 16px; font-weight: 800; color: var(--ms-navy); }
.ms-topbar .ms-spacer { flex: 1; }

/* ---------- 검색/목록 ---------- */
.ms-search { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.ms-input {
  padding: 7px 10px; border: 1px solid var(--ms-line); border-radius: 4px;
  font-size: 13px; font-family: inherit; background: #fafbfd; min-width: 200px;
}
.ms-input:focus { outline: none; border-color: var(--ms-blue); background: #fff; }

.ms-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.ms-card {
  background: var(--ms-card); border: 1px solid var(--ms-line);
  border-radius: 6px; padding: 12px 14px; cursor: pointer;
  transition: box-shadow .15s, transform .1s;
}
.ms-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.10); transform: translateY(-1px); border-color: var(--ms-blue); }
.ms-card .ms-card-name { font-size: 14px; font-weight: 700; color: var(--ms-navy); margin-bottom: 4px; }
.ms-card .ms-card-meta { font-size: 11px; color: var(--ms-muted); line-height: 1.5; }

.ms-empty { text-align: center; padding: 48px 16px; color: #8a94a6; font-size: 13px; }

/* ---------- 버튼 ---------- */
.ms-btn {
  padding: 7px 14px; border: 1px solid var(--ms-line); border-radius: 4px;
  background: #fff; font-size: 13px; font-family: inherit; cursor: pointer;
  color: #2a3b50; white-space: nowrap;
}
.ms-btn:hover { background: #f0f3f8; }
.ms-btn-blue  { background: var(--ms-blue); border-color: var(--ms-blue); color: #fff; }
.ms-btn-blue:hover  { background: #224a85; }
.ms-btn-green { background: #2e8b57; border-color: #2e8b57; color: #fff; }
.ms-btn-green:hover { background: #266f46; }
.ms-btn-red   { background: #fff; border-color: #d9534f; color: #d9534f; }
.ms-btn-red:hover   { background: #fdf0f0; }
.ms-btn-sm { padding: 4px 9px; font-size: 12px; }

/* ---------- 탭 바 ---------- */
.ms-tabbar { display: flex; gap: 2px; border-bottom: 2px solid var(--ms-blue); margin-bottom: 14px; flex-wrap: wrap; }
.ms-tab {
  padding: 8px 14px; border: 1px solid var(--ms-line); border-bottom: none;
  border-radius: 6px 6px 0 0; background: #eef2f7; cursor: pointer;
  font-size: 12.5px; color: #3a4a60; font-weight: 600;
}
.ms-tab:hover { background: #e2e9f2; }
.ms-tab.ms-tab-active { background: var(--ms-blue); color: #fff; border-color: var(--ms-blue); }

/* ---------- 탭 내용 패널 ---------- */
.ms-panel { background: var(--ms-card); border: 1px solid var(--ms-line); border-radius: 4px; padding: 16px 18px; }
.ms-section-title { font-size: 13px; font-weight: 800; color: var(--ms-navy); margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid #e6ecf5; }
.ms-row { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.ms-field { flex: 1; min-width: 180px; }
.ms-field > label { display: block; font-size: 11px; color: var(--ms-muted); font-weight: 600; letter-spacing: .3px; margin-bottom: 3px; }
.ms-field textarea { resize: vertical; line-height: 1.55; }

/* ---------- 신뢰도 뱃지 ---------- */
.ms-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 10px;
  border: 1px solid transparent; vertical-align: middle;
}
.ms-badge-official   { background: #e6f4ea; color: #1b7a3d; border-color: #b6e0c4; }
.ms-badge-reference  { background: #fff7e0; color: #946200; border-color: #e8d18a; }
.ms-badge-manual     { background: #eef1f5; color: #5a6b80; border-color: #d3dae5; }
.ms-badge-unverified { background: #fdeceb; color: #b02a25; border-color: #f0c0bd; }

/* ---------- 테이블 ---------- */
.ms-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ms-tbl th, .ms-tbl td { border: 1px solid #dce3ec; padding: 6px 9px; text-align: left; }
.ms-tbl th { background: #eef2f7; color: var(--ms-navy); font-weight: 700; }
.ms-tbl tbody tr:nth-child(even) { background: #f9fbfd; }

/* ---------- 경쟁제품 카드(4열) ---------- */
.ms-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.ms-compare-card { border: 1px solid var(--ms-line); border-radius: 6px; padding: 12px; background: #fafbfd; }
.ms-compare-card .ms-cc-name { font-weight: 800; color: var(--ms-navy); margin-bottom: 6px; }
.ms-compare-card .ms-cc-price { font-size: 15px; font-weight: 800; color: var(--ms-blue); margin-bottom: 8px; }

/* ---------- 수익 시뮬레이터 ---------- */
.ms-sim-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 16px; }
.ms-sim-ctrl label { display: block; font-size: 12px; font-weight: 700; color: #2a3b50; margin-bottom: 4px; }
.ms-sim-ctrl .ms-sim-val { color: var(--ms-blue); font-weight: 800; }
.ms-sim-ctrl input[type=range] { width: 100%; }
.ms-sim-result { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.ms-sim-kpi { background: #f4f7fb; border: 1px solid #dbe3ee; border-radius: 6px; padding: 12px; text-align: center; }
.ms-sim-kpi .ms-kpi-label { font-size: 11px; color: var(--ms-muted); margin-bottom: 4px; }
.ms-sim-kpi .ms-kpi-num { font-size: 18px; font-weight: 800; color: var(--ms-navy); }

/* ---------- 모달 (의료정보 전용, 기존 modal 과 분리) ---------- */
.ms-modal-bg {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 9000; align-items: center; justify-content: center;
}
.ms-modal-bg.ms-open { display: flex; }
.ms-modal {
  background: #fff; border-radius: 8px; width: 92vw; max-width: 980px;
  max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.ms-modal-hd { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--ms-line); }
.ms-modal-hd .ms-modal-x { background: none; border: none; font-size: 22px; cursor: pointer; color: #888; line-height: 1; }
.ms-modal-bd { padding: 14px 16px; overflow: auto; }
.ms-modal-ft { display: flex; justify-content: flex-end; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--ms-line); }

/* ---------- 자동수집 진행 ---------- */
.ms-collect-step { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 4px 0; }
.ms-collect-step .ms-step-icon { width: 18px; text-align: center; }

/* ---------- 제품 개요 2단 (왼쪽 사진 / 오른쪽 상세) ---------- */
.ms-ov-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .ms-ov-split { grid-template-columns: 1fr; } }
.ms-ov-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.ms-ov-thumb { position: relative; border: 1px solid var(--ms-line); border-radius: 6px; overflow: hidden; background: #f4f6f8; aspect-ratio: 1 / 1; }
.ms-ov-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.ms-ov-thumb-x { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; font-size: 13px; line-height: 1; padding: 0; }
.ms-ov-thumb-x:hover { background: rgba(200,30,30,.85); }
.ms-ov-links { display: flex; flex-direction: column; gap: 5px; }
.ms-ov-link { font-size: 12.5px; display: flex; align-items: center; }
.ms-ov-link a { color: var(--ms-blue); text-decoration: none; word-break: break-all; }
.ms-ov-link a:hover { text-decoration: underline; }
.ms-ov-right .ms-field { margin-bottom: 9px; }
