/* ============================================================
   themes/dodon/style/product-detail.css
   상품 상세 (product/detail.php) 전용
   로드: product_controller::detail() 의 $additionalCss
   ------------------------------------------------------------
   목업 product.css 1880줄 → 필요분만 남김.

   뺀 것
     헤더·푸터·.container·.btn   → layout-*.css / _base.css 에 있음
     .page-top / .breadcrumb     → _base.css 로 올림
     .detail-label-*  (약 500줄) → 라벨 빠른찾기, 기능 미구현
     .detail-category-panel      → 헤더 2행 대분류바와 중복
     html.is-label-product 23곳  → 색은 body.cat-2 가 이미 처리
     .detail-media-stack         → description(longtext) 출력으로 대체
     .common-guide 4카드 내용    → 배송/결제 공통 안내로 교체

   변수 치환
     목업 --accent-soft → --soft        (전역 변수명 통일)
     목업 --hero-tint   → color-mix(--accent)
       이유: --hero-tint 는 :root 에만 있어 청록 고정이다. 그대로 쓰면
             라벨(cat-2 테라코타) 상세에서 이미지 배경만 청록으로 뜬다.
             --accent 에서 만들면 카테고리 색을 자동으로 따라간다.
   ============================================================ */


/* ------------------------------------------------------------
   페이지 래퍼
   회색 바탕. 안쪽 .product-detail 만 흰색이라 블록 경계가 보인다.
   body 에 칠하면 홈·랜딩·리스트까지 영향 → 이 페이지만 감싼다.
   ------------------------------------------------------------ */
.detail-page{ background:var(--background); }


/* ============================================================
   1. 상품 영역 — 2단 레이아웃
   ============================================================ */
.product-detail{
  padding:34px 0 20px;
  background:#fff;
}
.product-layout{
  display:grid;
  grid-template-columns:minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap:34px;
  align-items:start;
}


/* ============================================================
   2. 갤러리 (왼쪽)
   ============================================================ */
.product-gallery{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:18px;
}

.gallery-main-wrap{ position:relative; }

.gallery-main{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:640px;
  padding:34px;
  border:1px solid var(--line);
  background:
    radial-gradient(170px 120px at 100% 0%,
      color-mix(in srgb, var(--accent) 14%, transparent), rgba(255,255,255,0) 72%),
    linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.98));
}
.gallery-main img{
  max-height:560px;
  object-fit:contain;
  transition:opacity .2s ease;
}

/* 좌우 화살표 — 이미지가 2장 이상일 때만 뷰가 출력한다 */
.gallery-arrow{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  display:flex;
  align-items:center;
  justify-content:center;
  width:42px;
  height:42px;
  border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.92);
  cursor:pointer;
}
.gallery-arrow:hover{ background:#fff; border-color:var(--accent); color:var(--accent); }
.gallery-arrow svg{ width:18px; height:18px; }
.gallery-arrow-prev{ left:14px; }
.gallery-arrow-next{ right:14px; }

/* 썸네일 줄 — 한 화면에 5개, 넘치면 좌우 버튼으로 민다 */
.thumbs-wrap{
  display:grid;
  grid-template-columns:44px 1fr 44px;
  gap:10px;
  align-items:center;
}
.thumb-nav{
  display:flex;
  align-items:center;
  justify-content:center;
  width:44px;
  height:44px;
  border:1px solid var(--line);
  background:#fff;
  cursor:pointer;
}
.thumb-nav:hover{ border-color:var(--accent); color:var(--accent); }
.thumb-nav svg{ width:18px; height:18px; }

.thumbs-viewport{ overflow:hidden; }
.gallery-thumbs{
  display:flex;
  gap:12px;
  transition:transform .25s ease;
  will-change:transform;
}
.thumb-btn{
  flex:0 0 calc((100% - 48px) / 5);
  padding:8px;
  border:1px solid var(--line);
  background:#fff;
  cursor:pointer;
  transition:border-color .15s ease;
}
.thumb-btn.is-active,
.thumb-btn:hover{
  border-color:color-mix(in srgb, var(--accent) 42%, var(--line));
}
.thumb-btn.is-active{ box-shadow:inset 0 0 0 1px var(--accent); }
.thumb-btn img{
  width:100%;
  aspect-ratio:1 / 1;
  object-fit:contain;
}

/* 모바일 dot — 썸네일 대신. 뷰는 둘 다 출력하고 CSS 가 골라 보인다 */
.gallery-dots{
  display:none;
  justify-content:center;
  align-items:center;
  gap:6px;
  min-height:20px;
}
.gallery-dot{
  width:7px;
  height:7px;
  border:0;
  padding:0;
  border-radius:999px;
  background:var(--line);
  cursor:pointer;
  transition:width .25s ease, background .25s ease;
}
.gallery-dot.is-active{
  width:22px;
  background:var(--accent);
}


/* ============================================================
   3. 요약 / 주문 박스 (오른쪽)
   ============================================================ */
.product-summary{
  min-width:0;
  position:sticky;
  top:106px;   /* 헤더 2줄 높이 */
}
.summary-box{
  width:100%;
  padding:28px;
  border:1px solid var(--line);
  background:#fff;
  box-shadow:0 12px 28px rgba(36,50,71,.06);
}

/* ── 상태 뱃지 (할인율 / 품절 / 비활성) ── */
.product-badges{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-bottom:12px;
}
.product-badge{
  display:inline-flex;
  align-items:center;
  padding:5px 10px;
  font-size:12px;
  font-weight:900;
  letter-spacing:-.2px;
}
.product-badge--sale{    background:#C0392B; color:#fff; }
.product-badge--soldout{ background:#94A3B8; color:#fff; }
.product-badge--inactive{
  background:#fff;
  border:1px solid #C0392B;
  color:#C0392B;
}

.product-title{
  margin:0 0 6px;
  font-size:30px;
  line-height:1.25;
  letter-spacing:-.7px;
}
/* 라벨류 식별값(K/P/PA+규격). 상품명 뒤에 붙되 덜 튀게 */
.product-title .label-code{
  margin-left:6px;
  color:var(--muted);
  font-size:20px;
  font-weight:700;
}

/* ── 가격 ── */
.price-row{
  margin:18px 0 20px;
  padding-bottom:18px;
  border-bottom:1px solid var(--line);
}
.price-label{
  margin:0 0 4px;
  color:var(--muted);
  font-size:12px;
  font-weight:800;
}
.price-was{
  margin:0;
  color:var(--muted);
  font-size:14px;
  font-weight:700;
  text-decoration:line-through;
}
.price{
  margin:0;
  font-size:30px;
  font-weight:900;
  line-height:1.15;
  color:var(--price_red);
}
.price.is-sale{ color:#C0392B; }
.price .won{
  margin-left:2px;
  font-size:19px;
  font-weight:800;
  color:var(--ink);
}
/* 가격문의 / 품절은 금액 대신 문구 한 줄 */
.price-text{
  margin:0;
  font-size:24px;
  font-weight:900;
}
.price-text.is-quote{   color:var(--quote_green); }
.price-text.is-soldout{ color:var(--muted); }
.price-note{
  margin-top:6px;
  color:var(--muted);
  font-size:13px;
  font-weight:700;
}

/* ── 스펙 — 값 있는 항목만 뷰가 출력한다 ── */
.spec-summary{
  display:grid;
  gap:9px;
  margin-bottom:20px;
}
.spec-row{
  display:grid;
  grid-template-columns:92px minmax(0, 1fr);
  gap:10px;
  align-items:start;
  font-size:14px;
}
.spec-row > span{
  color:var(--muted);
  font-weight:700;
}
.spec-row > strong{
  color:var(--ink);
  font-weight:800;
  word-break:break-all;
}

/* ── 특별 조합가 안내 (읽기 전용. 계산은 JS 가 아니라 관리자 등록값) ── */
.combo-box{
  margin-bottom:18px;
  padding:12px 14px;
  border:1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  background:color-mix(in srgb, var(--soft) 62%, white);
}
.combo-title{
  display:flex;
  align-items:center;
  gap:5px;
  margin:0 0 8px;
  color:var(--accent2);
  font-size:12px;
  font-weight:900;
}
.combo-title svg{ width:14px; height:14px; }
.combo-list{
  margin:0;
  padding:0;
  list-style:none;
  display:grid;
  gap:6px;
}
.combo-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  font-size:12px;
}
.combo-item > span{ color:#4E5C69; font-weight:600; }
.combo-item > strong{ color:#C0392B; font-weight:900; white-space:nowrap; }


/* ============================================================
   4. 옵션 선택
   목업엔 select 만 있었다. dox3 는 [선택 추가]로 줄을 쌓아
   "규격A 5개 + 규격B 3개"를 한 번에 담는 구조라 그 로직을 유지한다.
   (장바구니가 items 배열을 받으므로 목업대로 만들면 깨진다)
   ============================================================ */
.opt-box{
  margin-bottom:16px;
  padding:16px;
  border:1px solid var(--line);
  background:#FAFBFA;
}
.option-group{ margin-bottom:12px; }
.option-group:last-of-type{ margin-bottom:0; }
.option-group label{
  display:block;
  margin-bottom:6px;
  font-size:13px;
  font-weight:800;
  color:#4E5C69;
}
.option-group .req{ margin-left:2px; color:#C0392B; }
.option-group select,
.option-group input[type="text"]{
  width:100%;
  height:44px;
  padding:0 12px;
  border:1px solid var(--line);
  background:#fff;
  outline:none;
}
.option-group select:focus,
.option-group input[type="text"]:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

/* 선택 추가 — 목업에 없는 신규. 이 버튼이 아래 목록에 줄을 만든다 */
.opt-add{
  width:100%;
  height:42px;
  margin-top:12px;
  border:1px solid var(--accent2);
  background:var(--accent2);
  color:#fff;
  font-size:14px;
  font-weight:900;
  cursor:pointer;
  transition:background .15s ease;
}
.opt-add:hover{ background:color-mix(in srgb, var(--accent2) 84%, #000); }

/* 옵션 없는 상품 — 수량만 */
.qty-row{
  display:flex;
  align-items:center;
  gap:14px;
  margin-bottom:16px;
  padding:14px 16px;
  border:1px solid var(--line);
  background:#FAFBFA;
}
.qty-row > label{
  flex:0 0 auto;
  font-size:14px;
  font-weight:800;
}

/* ============================================================
   5. 선택된 항목 목록 (JS 가 채운다)
   ============================================================ */
/* after */
.selected-list{
  display:flex;            /* grid 는 트랙이 내용 폭까지 늘어나 박스를 뚫는다 */
  flex-direction:column;
  gap:8px;
  margin-bottom:16px;
}

/* 2단 배치 — 옵션이 3~4개면 한 줄에 다 안 들어간다.
   윗줄에 옵션 전체를 펴고, 아랫줄에 수량·금액을 둔다.
   grid-area 로 자리를 잡으므로 JS 가 붙이는 순서는 상관없다. */
.selected-item{
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  grid-template-areas:
    "info  del"
    "qty   price";
  align-items:center;
  gap:8px 10px;
  min-width:0;
  padding:12px;
  border:1px solid var(--line);
  background:#fff;
}
.selected-item-info{ grid-area:info; min-width:0; }
.selected-item-name{
  margin:0;
  font-size:13px;
  font-weight:800;
  line-height:1.5;
  color:var(--ink);
  word-break:break-all;    /* 긴 기관명·바코드번호가 칸을 밀지 않게 */
}
.selected-item-unit{
  margin:3px 0 0;
  font-size:11px;
  font-weight:700;
  color:var(--muted);
}
.qty-control--sm{ grid-area:qty; justify-self:start; }
.selected-item-price{
  grid-area:price;
  justify-self:end;
  font-size:15px;
  font-weight:900;
}
.selected-item-del{
  grid-area:del;
  align-self:start;
  display:flex;
  align-items:center;
  justify-content:center;
  width:26px;
  height:26px;
  border:0;
  background:transparent;
  color:#C7CDC7;
  cursor:pointer;
}


/* ============================================================
   6. 합계 / 장바구니
   ============================================================ */
.total-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:16px 0;
  margin-bottom:16px;
  border-top:1px solid var(--line);
  border-bottom:1px solid var(--line);
}
.total-row > span{ font-size:15px; font-weight:800; }
.total-row > strong{ font-size:24px; font-weight:900; }

/* 가격문의 — 금액 자리에 문구가 들어가 크기가 안 맞는다 */
.total-row--quote > strong{ font-size:18px; color:var(--quote_green); }

.cart-submit{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  width:100%;
  height:54px;
  border:1px solid var(--accent);
  background:var(--accent);
  color:#fff;
  font-size:16px;
  font-weight:900;
  cursor:pointer;
  transition:background .15s ease, border-color .15s ease;
}
.cart-submit:hover{ background:var(--accent2); border-color:var(--accent2); }
.cart-submit svg{ width:20px; height:20px; }

/* 가격문의 → 문의 게시판으로 */
.cart-submit--quote{
  background:var(--quote_green);
  border-color:var(--quote_green);
}
.cart-submit--quote:hover{
  background:color-mix(in srgb, var(--quote_green) 82%, #000);
  border-color:color-mix(in srgb, var(--quote_green) 82%, #000);
}

/* 가격문의 — 버튼 2개를 반씩 나눠 쓴다 */
.submit-pair{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}
.submit-pair .cart-submit{ font-size:15px; }
.submit-pair .cart-submit svg{ width:18px; height:18px; }

.submit-hint{
  margin:10px 0 0;
  color:var(--muted);
  font-size:12px;
  font-weight:700;
  line-height:1.5;
  text-align:center;
}

@media (max-width:400px){
  .submit-pair{ grid-template-columns:1fr; }
}

/* 품절 */
.cart-submit:disabled,
.cart-submit--off{
  background:#E2E8F0;
  border-color:#CBD5E1;
  color:#64748B;
  cursor:not-allowed;
}


/* ============================================================
   7. 장바구니 담기 완료 팝업
   ============================================================ */
.cart-popup{
  position:fixed;
  inset:0;
  z-index:500;
  display:flex;
  align-items:center;
  justify-content:center;
}
.cart-popup[hidden]{ display:none; }
.cart-popup-dim{
  position:absolute;
  inset:0;
  background:rgba(31,43,58,.45);
}
.cart-popup-box{
  position:relative;
  width:min(340px, calc(100% - 40px));
  padding:32px 28px 28px;
  background:#fff;
  border:1px solid var(--line);
  box-shadow:0 24px 60px rgba(36,50,71,.24);
  text-align:center;
}
.cart-popup-icon{
  display:flex;
  align-items:center;
  justify-content:center;
  width:58px;
  height:58px;
  margin:0 auto 16px;
  border-radius:999px;
  background:var(--soft);
  color:var(--accent2);
}
.cart-popup-icon svg{ width:28px; height:28px; }
.cart-popup-box h3{
  margin:0 0 6px;
  font-size:18px;
  font-weight:900;
}
.cart-popup-box p{
  margin:0 0 22px;
  color:var(--muted);
  font-size:13px;
  font-weight:700;
}
.cart-popup-actions{
  display:grid;
  gap:8px;
}
.cart-popup-actions a,
.cart-popup-actions button{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  height:46px;
  border:1px solid var(--accent);
  background:var(--accent);
  color:#fff;
  font-size:14px;
  font-weight:900;
  cursor:pointer;
}
.cart-popup-actions a:hover{ background:var(--accent2); border-color:var(--accent2); }
.cart-popup-actions button{
  border-color:var(--line);
  background:#fff;
  color:var(--ink);
}
.cart-popup-actions button:hover{ background:#F4F5F1; }


/* ============================================================
   8. 상품 상세 정보 (description — 관리자가 넣은 HTML)
   ============================================================ */
.detail-support-section{ padding:24px 0 8px; }

.section-kicker{
  display:inline-flex;
  align-items:center;
  margin-bottom:12px;
  padding:6px 10px;
  background:color-mix(in srgb, var(--soft) 72%, white);
  color:var(--accent2);
  font-size:11px;
  font-weight:900;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.detail-support-head{ margin-bottom:18px; }
.detail-support-head h2{
  margin:0;
  font-size:28px;
  line-height:1.2;
  letter-spacing:-.7px;
}

/* 관리자가 붙여넣은 HTML 이 들어온다. 넘치는 표·이미지만 가둔다 */
.product-description{
  padding:24px;
  border:1px solid var(--line);
  background:#fff;
  color:#4E5C69;
  font-weight:500;
  line-height:1.75;
  overflow-x:auto;
}
.product-description img{ max-width:100%; height:auto; margin:0 auto; }
.product-description table{ max-width:100%; }
.product-description :where(h1,h2,h3,h4){ color:var(--ink); }

.detail-empty{
  padding:48px 20px;
  border:1px dashed color-mix(in srgb, var(--line) 72%, var(--accent));
  background:rgba(255,255,255,.72);
  text-align:center;
  color:var(--muted);
  font-weight:700;
}


/* ============================================================
   9. 배송 및 결제 공통 안내
   상품마다 반복하지 않고 여기서 한 번만. (dox3 와 같은 내용)
   ============================================================ */
.common-guide-section{ padding:20px 0 26px; }

.common-guide-box{
  width:100%;
  padding:24px;
  border:1px solid var(--line);
  background:
    radial-gradient(220px 150px at 0% 100%,
      color-mix(in srgb, var(--accent) 12%, transparent), rgba(255,255,255,0) 72%),
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.98));
}
.common-guide-head{
  max-width:760px;
  margin-bottom:18px;
}
.common-guide-head h2{
  margin:0 0 8px;
  font-size:26px;
  line-height:1.2;
  letter-spacing:-.6px;
}
.common-guide-head p{
  margin:0;
  color:#475569;
  font-weight:600;
  font-size:14px;
}

/* 목업은 4열이었지만 내용이 4항목짜리 목록이라 2열로 편다.
   4열이면 줄바꿈이 심해서 읽기가 어렵다. */
.common-guide-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:16px;
}
.common-guide-card{
  padding:20px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.92);
}
.common-guide-card h3{
  display:flex;
  align-items:center;
  gap:7px;
  margin:0 0 12px;
  font-size:16px;
  font-weight:900;
  color:var(--accent2);
}
.common-guide-card h3 svg{ width:18px; height:18px; flex:0 0 auto; }
.common-guide-card ul{
  margin:0;
  padding-left:17px;
  display:grid;
  gap:7px;
  color:#4E5C6D;
  font-size:13px;
  font-weight:600;
  line-height:1.6;
}


/* ============================================================
   10. 반응형
   ============================================================ */
@media (max-width:1100px){
  .product-layout{ grid-template-columns:1fr; }
  .product-summary{ position:static; }
  .gallery-main{ min-height:520px; }
  .gallery-main img{ max-height:460px; }
}

@media (max-width:820px){
  .common-guide-grid{ grid-template-columns:1fr; }
}

@media (max-width:680px){
  .product-detail{ padding:20px 0 16px; }
  .product-layout{ gap:22px; }

  .gallery-main{ min-height:380px; padding:20px; }
  .gallery-main img{ max-height:320px; }

  /* 모바일은 썸네일 대신 dot */
  .thumbs-wrap{ display:none; }
  .gallery-dots{ display:flex; }

  .summary-box{ padding:20px; }
  .product-title{ font-size:23px; }
  .product-title .label-code{ font-size:16px; }
  .price{ font-size:26px; }

  .spec-row{ grid-template-columns:78px minmax(0, 1fr); font-size:13px; }

  .selected-item-price{ font-size:14px; }

  .detail-support-head h2,
  .common-guide-head h2{ font-size:21px; }

  .product-description{ padding:16px; }
  .common-guide-box{ padding:16px; }
  .common-guide-card{ padding:16px; }
}

@media (max-width:400px){
  .qty-row{ flex-direction:column; align-items:flex-start; gap:8px; }
}