/* ================================================================
   ENERMADE APP UI — 모바일 앱형 UI 시스템
   목적: "Bootstrap 반응형 웹" 느낌을 제거하고 모바일 앱처럼 만들기
   전략: main.css의 디자인 토큰(--c-*, --r-*)을 그대로 재사용하면서
         앱 전용 레이아웃/컴포넌트를 추가한다.
   ================================================================ */

/* ──────────────────────────────────────────────
   1. 앱 기본 레이아웃
   상단 헤더 56px + 하단 탭바 64px를 고려한 구조
   ────────────────────────────────────────────── */

/* 페이지 배경 */
.app-wrap {
  background: var(--c-bg-2);
  min-height: 100vh;
  min-height: 100dvh; /* iOS Safari 동적 뷰포트 대응 */
}

/* 메인 콘텐츠 영역 — 상단 헤더 높이만큼 패딩 */
/* 하단은 페이지별로 .app-page-has-cta 클래스로 추가 */
.app-main {
  padding-top: 56px; /* 상단 헤더 */
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); /* 하단 탭바 */
  min-height: 100vh;
  min-height: 100dvh;
}

/* 상품 상세 / 장바구니처럼 하단 고정 CTA가 있는 페이지 */
.app-main.has-bottom-cta {
  /* 하단 탭바(64px) + 하단 CTA(약 76px) + safe area */
  padding-bottom: calc(140px + env(safe-area-inset-bottom, 0px));
}

/* ──────────────────────────────────────────────
   2. 앱 상단 헤더
   56px 고정, 네이비 배경
   ────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1040;
  height: 56px;
  background: var(--c-navy);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 6px;
  /* 안드로이드/iOS 상단 safe area */
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(56px + env(safe-area-inset-top, 0px));
}

/* 뒤로가기 버튼 — 내부 페이지에서 활성화 */
.app-header__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: rgba(255,255,255,.7);
  border-radius: var(--r);
  flex-shrink: 0;
  text-decoration: none;
  transition: background .15s;
  margin-right: 2px;
}
.app-header__back:hover,
.app-header__back:focus { background: rgba(255,255,255,.1); color: #fff; }

/* 브랜드 로고 */
.app-header__brand {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.app-header__brand-home,
.app-header__brand-shop {
  text-decoration: none;
  display: flex;
  align-items: center;
}
.app-header__brand-name {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.04em;
  white-space: nowrap;
}
.app-header__brand-tag {
  font-family: var(--font-head);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--c-accent);
  text-transform: uppercase;
}

/* 페이지 타이틀 — 브랜드 대신 표시 */
.app-header__title {
  flex: 1;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 헤더 우측 아이콘 버튼들 */
.app-header__tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.app-header__btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r);
  color: rgba(255,255,255,.7);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.app-header__btn:hover,
.app-header__btn.is-active { background: rgba(255,255,255,.1); color: #fff; }

/* 회사 홈페이지 이동 버튼 — 오른쪽에 구분선으로 분리 */
.app-header__btn--site {
  color: rgba(255,255,255,.5);
  margin-right: 4px;
  border-right: 1px solid rgba(255,255,255,.15);
  border-radius: 0;
  padding-right: 6px;
}
.app-header__btn--site:hover { background: none; color: #fff; }

/* 장바구니 배지 — 헤더용 */
.app-header-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  background: var(--c-accent);
  color: #fff;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  border: 1.5px solid var(--c-navy); /* 헤더 배경과 분리 */
}

/* ──────────────────────────────────────────────
   3. 하단 탭바 (Bottom Navigation)
   앱의 핵심 내비게이션. 항상 화면 하단에 고정.
   ────────────────────────────────────────────── */
.app-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1040;
  background: #fff;
  border-top: 1px solid var(--c-border);
  box-shadow: 0 -2px 16px rgba(0,0,0,.07);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  /* iOS 홈 인디케이터 safe area */
  padding-bottom: env(safe-area-inset-bottom, 0px);
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  align-items: start;
  padding-top: 8px;
}

/* 탭 아이템 */
.app-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 4px;
  text-decoration: none;
  color: var(--c-muted-2);
  transition: color .15s;
  /* 터치 영역 확보 */
  min-height: 48px;
  justify-content: center;
}
.app-tab:hover { color: var(--c-muted); }
.app-tab.is-active { color: var(--c-accent); }

/* 탭 아이콘 래퍼 */
.app-tab__icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* 탭 레이블 */
.app-tab__label {
  font-family: var(--font-head);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1;
}

/* 탭 뱃지 — 장바구니 수량 */
.app-tab-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  min-width: 14px;
  height: 14px;
  background: var(--c-accent);
  color: #fff;
  border-radius: 7px;
  font-size: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  /* 흰 배경에서 탭과 구분 */
  border: 1.5px solid #fff;
}

/* ──────────────────────────────────────────────
   4. 검색바
   ────────────────────────────────────────────── */
.app-searchbar {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-2xl);
  padding: 0 16px;
  gap: 10px;
  height: 46px;
  transition: border-color .18s, box-shadow .18s;
}
.app-searchbar:focus-within {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(234,88,12,.08);
}
.app-searchbar__icon { color: var(--c-muted-2); flex-shrink: 0; }
.app-searchbar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--c-text);
  background: transparent;
}
.app-searchbar input::placeholder { color: var(--c-muted-2); }
.app-searchbar__submit {
  background: none;
  border: none;
  color: var(--c-muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-head);
}
.app-searchbar__submit:hover { color: var(--c-accent); }

/* ──────────────────────────────────────────────
   5. 섹션 공통 여백
   ────────────────────────────────────────────── */
.app-section { padding: 20px 16px 0; }
.app-section--pad { padding: 20px 16px; }
.app-section--gap { margin-top: 8px; }

/* 섹션 헤더 (제목 + 전체보기) */
.app-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.app-sec-title {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -.02em;
}
.app-sec-sub {
  font-size: 12px;
  color: var(--c-muted);
  margin-top: 2px;
}
.app-sec-more {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 600;
  color: var(--c-accent);
  text-decoration: none;
  white-space: nowrap;
}
.app-sec-more:hover { color: var(--c-accent-2); }

/* ──────────────────────────────────────────────
   6. 카테고리 칩 — 가로 스크롤
   ────────────────────────────────────────────── */
.app-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  /* 스크롤바 숨기기 */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.app-chips::-webkit-scrollbar { display: none; }

.app-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: var(--r-2xl);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  border: 1.5px solid var(--c-border);
  color: var(--c-text-2);
  background: #fff;
  transition: all .15s;
  cursor: pointer;
  flex-shrink: 0;
  /* 터치 영역 */
  min-height: 36px;
}
.app-chip:hover { border-color: var(--c-accent); color: var(--c-accent); }
.app-chip.is-active {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: #fff;
}

/* ──────────────────────────────────────────────
   7. 상품 그리드 & 카드
   ────────────────────────────────────────────── */
.app-product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 540px) {
  .app-product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
  .app-product-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
}

/* 상품 카드 */
.app-product-card {
  background: #fff;
  border-radius: var(--r-xl);
  overflow: hidden;
  border: 1px solid transparent;
  box-shadow: var(--sh-xs);
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
  position: relative;
}
.app-product-card:hover {
  box-shadow: var(--sh-sm);
  transform: translateY(-2px);
}

/* 카드 썸네일 — 정사각형 비율 */
.app-product-card__thumb {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--c-bg-3);
  flex-shrink: 0;
}
.app-product-card__thumb a { display: block; width: 100%; height: 100%; }
.app-product-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}
.app-product-card:hover .app-product-card__thumb img { transform: scale(1.04); }

/* 이미지 없을 때 플레이스홀더 */
.app-product-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-muted-2);
}

/* 카드 본문 */
.app-product-card__body {
  padding: 12px 12px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.app-product-card__cat {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-accent);
}
.app-product-card__name {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.35;
  /* 2줄 클램프 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.app-product-card__spec {
  font-size: 11px;
  color: var(--c-muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.app-product-card__price {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 800;
  color: var(--c-navy);
  margin-top: auto;
  padding-top: 6px;
}
.app-product-card__price span {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-muted);
}

/* 카드 하단 액션 — 담기 버튼 */
.app-product-card__action {
  padding: 8px 12px 12px;
  display: flex;
  gap: 6px;
}

/* ──────────────────────────────────────────────
   8. 버튼 시스템
   Bootstrap btn 클래스 의존 최소화
   ────────────────────────────────────────────── */
.app-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 20px;
  height: 48px;
  border-radius: var(--r-lg);
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background .15s, color .15s, transform .1s;
  white-space: nowrap;
  /* 터치 영역 최소 48px */
  min-width: 48px;
}
.app-btn:active { transform: scale(.97); }

/* 주요 CTA */
.app-btn--primary { background: var(--c-accent); color: #fff; }
.app-btn--primary:hover { background: var(--c-accent-2); color: #fff; }
.app-btn--primary:disabled { background: var(--c-border-2); color: var(--c-muted); cursor: not-allowed; transform: none; }

/* 어두운 버튼 */
.app-btn--dark { background: var(--c-navy); color: #fff; }
.app-btn--dark:hover { background: var(--c-navy-2); color: #fff; }

/* 아웃라인 버튼 */
.app-btn--outline {
  background: transparent;
  color: var(--c-text-2);
  border: 1.5px solid var(--c-border-2);
}
.app-btn--outline:hover { border-color: var(--c-text-2); color: var(--c-text); background: var(--c-bg-2); }

/* 소형 버튼 */
.app-btn--sm { height: 36px; padding: 0 14px; font-size: 12px; border-radius: var(--r); }

/* 전체 너비 */
.app-btn--full { width: 100%; }

/* ──────────────────────────────────────────────
   9. 빈 상태 (Empty State)
   ────────────────────────────────────────────── */
.app-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 24px;
  text-align: center;
  background: #fff;
  border-radius: var(--r-xl);
  margin: 0 16px;
}
.app-empty__icon { color: var(--c-muted-2); }
.app-empty__title {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text);
  margin: 0;
}
.app-empty__desc { font-size: 13px; color: var(--c-muted); margin: 0; }

/* ──────────────────────────────────────────────
   10. 툴바 (정렬/필터 버튼)
   ────────────────────────────────────────────── */
.app-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.app-toolbar__count {
  flex: 1;
  font-size: 13px;
  color: var(--c-muted);
}
.app-toolbar__count strong { color: var(--c-text); font-weight: 700; }

/* 필터/정렬 버튼 */
.app-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-lg);
  border: 1.5px solid var(--c-border);
  background: #fff;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-2);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.app-filter-btn:hover,
.app-filter-btn:focus { border-color: var(--c-accent); color: var(--c-accent); outline: none; }
/* 필터 적용 중 상태 */
.app-filter-btn.has-filter {
  border-color: var(--c-accent);
  color: var(--c-accent);
  background: var(--c-orange-lt);
}

/* ──────────────────────────────────────────────
   11. 바텀시트 (Bottom Sheet)
   필터, 옵션 선택에 사용
   ────────────────────────────────────────────── */
.app-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(0,0,0,.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.app-sheet-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.app-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1060;
  background: #fff;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  transform: translateY(105%); /* 완전히 숨김 */
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  max-height: 80vh;
  overflow-y: auto;
  /* iOS safe area */
  padding-bottom: env(safe-area-inset-bottom, 20px);
}
.app-sheet.is-open { transform: translateY(0); }

/* 바텀시트 핸들 (드래그 인디케이터) */
.app-sheet__handle {
  width: 40px;
  height: 4px;
  background: var(--c-border);
  border-radius: 2px;
  margin: 12px auto 0;
  flex-shrink: 0;
}

/* 바텀시트 헤더 */
.app-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.app-sheet__title {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text);
}
.app-sheet__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--c-bg-3);
  color: var(--c-muted);
  cursor: pointer;
  transition: background .15s;
}
.app-sheet__close:hover { background: var(--c-border); }

.app-sheet__body { padding: 20px; }

.app-sheet__sec-label {
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin-bottom: 12px;
}

/* 바텀시트 하단 버튼 */
.app-sheet__footer {
  padding: 14px 20px;
  border-top: 1px solid var(--c-border);
  display: flex;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: #fff;
}

/* ──────────────────────────────────────────────
   12. 상품 상세 페이지
   ────────────────────────────────────────────── */
/* 상품 이미지 — 정사각형 풀블리드 */
.app-detail-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--c-bg-3);
}
.app-detail-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.app-detail-img__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-muted-2);
}

/* 상세 본문 */
.app-detail-body { padding: 20px 16px 0; }

.app-detail-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--r-2xl);
  background: var(--c-orange-lt);
  color: var(--c-accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  margin-bottom: 10px;
}
.app-detail-name {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 800;
  color: var(--c-text);
  line-height: 1.25;
  letter-spacing: -.03em;
  margin-bottom: 10px;
}
.app-detail-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.app-detail-code {
  font-size: 12px;
  color: var(--c-muted);
  font-family: var(--font-head);
}
.app-detail-rating {
  display: flex;
  align-items: center;
  gap: 5px;
}
.app-detail-stars { font-size: 13px; color: var(--c-warning); }
.app-detail-rating-text { font-size: 12px; color: var(--c-muted); }

.app-detail-price {
  font-family: var(--font-head);
  font-size: 30px;
  font-weight: 800;
  color: var(--c-navy);
  letter-spacing: -.04em;
  margin-bottom: 16px;
}
.app-detail-price small {
  font-size: 17px;
  font-weight: 600;
  color: var(--c-muted);
  margin-left: 2px;
}

/* 규격/스펙 박스 */
.app-spec-box {
  background: var(--c-bg-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.app-spec-box__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin-bottom: 6px;
}
.app-spec-box__value {
  font-size: 14px;
  color: var(--c-text);
  font-weight: 500;
  line-height: 1.5;
}

/* 섹션 구분선 */
.app-divider {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 20px 16px;
}

/* 설명 텍스트 */
.app-detail-desc {
  padding: 0 16px;
  font-size: 14px;
  color: var(--c-text-2);
  line-height: 1.75;
  margin-bottom: 8px;
}

/* ── 하단 고정 구매 CTA ── */
/* 탭바 바로 위에 붙음 */
.app-bottom-cta {
  position: fixed;
  bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  z-index: 1030;
  background: #fff;
  border-top: 1px solid var(--c-border);
  padding: 12px 16px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}
.app-bottom-cta__inner {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 680px;
  margin: 0 auto;
}

/* 수량 조절 컨트롤 */
.app-qty {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r);
  overflow: hidden;
  flex-shrink: 0;
}
.app-qty__btn {
  width: 36px;
  height: 46px;
  border: none;
  background: var(--c-bg-2);
  color: var(--c-text);
  font-size: 20px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background .15s;
  flex-shrink: 0;
}
.app-qty__btn:hover { background: var(--c-bg-3); }
.app-qty__input {
  width: 46px;
  height: 46px;
  text-align: center;
  border: none;
  border-left: 1.5px solid var(--c-border);
  border-right: 1.5px solid var(--c-border);
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
  background: #fff;
  outline: none;
  -moz-appearance: textfield;
}
.app-qty__input::-webkit-inner-spin-button,
.app-qty__input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ──────────────────────────────────────────────
   13. 리뷰 섹션
   ────────────────────────────────────────────── */
.app-reviews { padding: 0 16px 20px; }

.app-review-write {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: 16px;
  margin-bottom: 16px;
}
.app-review-write__title {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 12px;
}
.app-review-write__row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.app-review-write select,
.app-review-write input {
  height: 40px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-lg);
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--c-text);
  background: #fff;
  padding: 0 12px;
  outline: none;
  transition: border-color .18s;
}
.app-review-write select:focus,
.app-review-write input:focus { border-color: var(--c-accent); }
.app-review-write select { width: 90px; flex-shrink: 0; }
.app-review-write input { flex: 1; }

.app-review-card {
  background: var(--c-bg-2);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.app-review-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.app-review-card__name {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text);
}
.app-review-card__rating {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-warning);
  font-family: var(--font-head);
}
.app-review-card__date {
  font-size: 11px;
  color: var(--c-muted-2);
  margin-bottom: 6px;
}
.app-review-card__content {
  font-size: 13px;
  color: var(--c-text-2);
  line-height: 1.6;
}

/* ──────────────────────────────────────────────
   14. 연관 상품 (가로 스크롤)
   ────────────────────────────────────────────── */
.app-related {
  padding: 0 16px 20px;
}
.app-related-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 4px;
}
.app-related-scroll::-webkit-scrollbar { display: none; }

.app-related-card {
  flex-shrink: 0;
  width: 140px;
  background: #fff;
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--sh-xs);
  text-decoration: none;
  display: block;
  transition: box-shadow .2s;
}
.app-related-card:hover { box-shadow: var(--sh-sm); }
.app-related-card__thumb {
  width: 140px;
  height: 140px;
  overflow: hidden;
  background: var(--c-bg-3);
}
.app-related-card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.app-related-card__body { padding: 10px 10px 12px; }
.app-related-card__name {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}
.app-related-card__price {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 800;
  color: var(--c-navy);
}

/* ──────────────────────────────────────────────
   15. 장바구니 페이지
   ────────────────────────────────────────────── */
.app-cart-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 16px 0;
}

.app-cart-item {
  background: #fff;
  border-radius: var(--r-xl);
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.app-cart-item__thumb {
  width: 80px;
  height: 80px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--c-bg-3);
  flex-shrink: 0;
}
.app-cart-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.app-cart-item__thumb--placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-muted-2);
}

.app-cart-item__info { flex: 1; min-width: 0; }
.app-cart-item__name {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 3px;
  line-height: 1.3;
  /* 2줄로 제한 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.app-cart-item__unit {
  font-size: 12px;
  color: var(--c-muted);
  margin-bottom: 10px;
}

.app-cart-item__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.app-cart-item__price {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 800;
  color: var(--c-navy);
}

/* 장바구니 수량 조절 — 인라인 소형 */
.app-cart-qty {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r);
  overflow: hidden;
}
.app-cart-qty__btn {
  width: 30px;
  height: 30px;
  border: none;
  background: var(--c-bg-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--c-text-2);
  line-height: 1;
  transition: background .15s;
  flex-shrink: 0;
}
.app-cart-qty__btn:hover { background: var(--c-bg-3); }
.app-cart-qty__num {
  width: 38px;
  height: 30px;
  text-align: center;
  border: none;
  border-left: 1.5px solid var(--c-border);
  border-right: 1.5px solid var(--c-border);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text);
  background: #fff;
  outline: none;
  -moz-appearance: textfield;
}
.app-cart-qty__num::-webkit-inner-spin-button,
.app-cart-qty__num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* 삭제 버튼 */
.app-cart-remove {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--c-bg-3);
  color: var(--c-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.app-cart-remove:hover { background: #fee2e2; color: var(--c-danger); }

/* 주문 요약 박스 */
.app-order-summary {
  margin: 12px 16px 0;
  background: #fff;
  border-radius: var(--r-xl);
  padding: 20px;
}
.app-order-summary__title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 16px;
}
.app-order-summary__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--c-text-2);
}
.app-order-summary__row--total {
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1.5px solid var(--c-border);
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 800;
  color: var(--c-text);
  margin-bottom: 0;
}

/* 비회원 주문 정보 폼 */
.app-guest-form {
  margin: 12px 16px 0;
  background: #fff;
  border-radius: var(--r-xl);
  padding: 20px;
}
.app-guest-form__title {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 14px;
}

/* 폼 필드 공통 */
.app-field { margin-bottom: 12px; }
.app-field:last-child { margin-bottom: 0; }
.app-field__label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin-bottom: 5px;
}
.app-field__input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-lg);
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--c-text);
  background: #fff;
  transition: border-color .18s, box-shadow .18s;
  outline: none;
}
.app-field__input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(234,88,12,.08);
}

/* 결제 CTA — 장바구니 하단 고정 */
.app-cart-cta {
  position: fixed;
  bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  z-index: 1030;
  background: #fff;
  border-top: 1px solid var(--c-border);
  padding: 12px 16px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}
.app-cart-cta__inner {
  max-width: 680px;
  margin: 0 auto;
}
.app-cart-cta__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.app-cart-cta__label { font-size: 13px; color: var(--c-muted); }
.app-cart-cta__amount {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 800;
  color: var(--c-navy);
}

/* ──────────────────────────────────────────────
   16. 알림 메시지
   ────────────────────────────────────────────── */
.app-alert {
  padding: 12px 16px;
  border-radius: var(--r-lg);
  font-size: 13px;
  line-height: 1.55;
  margin: 0 16px 12px;
}
.app-alert--info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.app-alert--warn    { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.app-alert--success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.app-alert--danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ──────────────────────────────────────────────
   17. 히어로 배너
   ────────────────────────────────────────────── */
.app-hero {
  background: linear-gradient(135deg, var(--c-navy) 0%, #1e3a5f 100%);
  padding: 32px 20px 36px;
  position: relative;
  overflow: hidden;
}
/* 배경 장식 원 */
.app-hero::before {
  content: '';
  position: absolute;
  right: -60px;
  top: -60px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(234,88,12,.2) 0%, transparent 65%);
  border-radius: 50%;
}
.app-hero::after {
  content: '';
  position: absolute;
  left: -20px;
  bottom: -40px;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(255,255,255,.04) 0%, transparent 70%);
  border-radius: 50%;
}
.app-hero__eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: 8px;
  position: relative;
}
.app-hero__title {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  letter-spacing: -.04em;
  margin-bottom: 10px;
  position: relative;
}
.app-hero__sub {
  font-size: 13px;
  color: rgba(255,255,255,.65);
  margin-bottom: 24px;
  line-height: 1.65;
  position: relative;
}
.app-hero__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
}

/* ──────────────────────────────────────────────
   18. 마이페이지
   ────────────────────────────────────────────── */
/* 프로필 카드 */
.app-profile-card {
  margin: 16px 16px 0;
  background: var(--c-navy);
  border-radius: var(--r-xl);
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.app-profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--c-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.app-profile-info__name {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 3px;
}
.app-profile-info__email { font-size: 12px; color: rgba(255,255,255,.55); }
.app-profile-badge {
  margin-left: auto;
  padding: 4px 10px;
  background: var(--c-accent);
  color: #fff;
  border-radius: var(--r-2xl);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

/* 메뉴 리스트 */
.app-menu-group { margin: 12px 16px 0; }
.app-menu-group__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-muted);
  padding: 0 4px 8px;
}
.app-menu-list {
  background: #fff;
  border-radius: var(--r-xl);
  overflow: hidden;
}
.app-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--c-border);
  text-decoration: none;
  color: var(--c-text);
  transition: background .15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  border-bottom: 1px solid var(--c-border);
}
.app-menu-item:last-child { border-bottom: none; }
.app-menu-item:hover { background: var(--c-bg-2); }
.app-menu-item--danger { color: var(--c-danger); }

.app-menu-item__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-lg);
  background: var(--c-bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-2);
  flex-shrink: 0;
}
.app-menu-item--danger .app-menu-item__icon { background: #fef2f2; color: var(--c-danger); }
.app-menu-item__admin .app-menu-item__icon { background: #fff7ed; color: var(--c-accent); }

.app-menu-item__text {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-head);
}
.app-menu-item__arrow { color: var(--c-muted-2); }

/* ──────────────────────────────────────────────
   19. 데스크탑 대응
   ────────────────────────────────────────────── */
@media (min-width: 768px) {
  /* 헤더 좌우 패딩 늘리기 */
  .app-header { padding: 0 24px; gap: 12px; }

  /* 콘텐츠 최대 너비 제한 + 중앙 정렬 */
  .app-section,
  .app-section--pad { padding-left: 24px; padding-right: 24px; }

  /* 장바구니 최대 너비 */
  .app-cart-list,
  .app-order-summary,
  .app-guest-form {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
  }
  .app-cart-list { padding-left: 0; padding-right: 0; }

  /* 섹션 콘텐츠 최대 너비 */
  .app-section > * { max-width: 1200px; margin-left: auto; margin-right: auto; }

  /* 히어로 패딩 */
  .app-hero { padding: 48px 32px; }
  .app-hero__title { font-size: 34px; }
}

@media (min-width: 1024px) {
  /* 상품 그리드 4열 */
  .app-product-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; }

  /* 상품 상세 - 2열 레이아웃으로 전환 */
  .app-detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
  }
  .app-detail-img { aspect-ratio: auto; height: 480px; border-radius: var(--r-xl); }
  .app-detail-body { padding: 0; }

  /* 데스크탑에서 하단 CTA를 inline으로 */
  .app-bottom-cta {
    position: static;
    box-shadow: none;
    border-top: none;
    padding: 0;
    margin-top: 20px;
  }
  .app-main.has-bottom-cta {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  .app-cart-cta {
    position: static;
    box-shadow: none;
    border-top: none;
    padding: 0;
  }
  .app-main.has-cart-cta {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
}

/* ──────────────────────────────────────────────
   20. 유틸리티
   ────────────────────────────────────────────── */
/* 시각적 숨김 */
.app-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
/* 밑줄 없는 링크 */
.app-link {
  color: var(--c-accent);
  text-decoration: none;
  font-weight: 600;
}
.app-link:hover { color: var(--c-accent-2); }

/* 구분선 텍스트 */
.app-or {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--c-muted-2);
  margin: 12px 0;
}
.app-or::before, .app-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--c-border);
}

/* ── 다크모드 버튼: shop 탭바(64px) 위로 올리기 ── */
/* .app-wrap = shop-top.ejs의 body 클래스 */
.app-wrap .dark-widget {
  bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 12px);
}

/* ── 다크모드: shop 앱 UI 요소 ── */
[data-theme="dark"] .app-header {
  background: #18181b !important;
  border-bottom-color: #3f3f46 !important;
}
[data-theme="dark"] .app-header__brand-name,
[data-theme="dark"] .app-header__title { color: #fafafa !important; }
[data-theme="dark"] .app-header__btn { color: rgba(255,255,255,.7) !important; }
[data-theme="dark"] .app-bottom-nav { background: #18181b !important; border-top-color: #3f3f46 !important; }
[data-theme="dark"] .app-tab { color: var(--c-muted) !important; }
[data-theme="dark"] .app-tab.is-active { color: var(--c-accent) !important; }
[data-theme="dark"] .app-card { background: var(--c-bg-2) !important; border-color: var(--c-border) !important; }
[data-theme="dark"] .app-section { background: var(--c-bg-2) !important; }
[data-theme="dark"] .app-field__input { background: var(--c-bg-3) !important; border-color: var(--c-border) !important; color: var(--c-text) !important; }
[data-theme="dark"] .app-field__label { color: var(--c-muted) !important; }
[data-theme="dark"] .app-bottom-cta,
[data-theme="dark"] .app-cart-cta { background: var(--c-bg-2) !important; border-top-color: #3f3f46 !important; }
[data-theme="dark"] .app-sheet { background: var(--c-bg-2) !important; }
[data-theme="dark"] .app-sheet__head { border-bottom-color: #3f3f46 !important; }
[data-theme="dark"] .app-wrap { background: var(--c-bg) !important; }

/* 검색바 */
[data-theme="dark"] .app-searchbar { background: var(--c-bg-2) !important; border-color: var(--c-border) !important; }
[data-theme="dark"] .app-searchbar input { background: transparent !important; color: var(--c-text) !important; }
[data-theme="dark"] .app-searchbar input::placeholder { color: var(--c-muted) !important; }

/* 카테고리 칩 */
[data-theme="dark"] .app-chip { background: var(--c-bg-2) !important; border-color: var(--c-border) !important; color: var(--c-text-2) !important; }

/* 상품 카드 */
[data-theme="dark"] .app-product-card { background: var(--c-bg-2) !important; }
[data-theme="dark"] .app-related-card { background: var(--c-bg-2) !important; }

/* 빈 상태 */
[data-theme="dark"] .app-empty { background: var(--c-bg-2) !important; }

/* 필터 버튼 */
[data-theme="dark"] .app-filter-btn { background: var(--c-bg-2) !important; border-color: var(--c-border) !important; color: var(--c-text-2) !important; }

/* 바텀시트 - sticky header/footer 포함 */
[data-theme="dark"] .app-sheet__head { background: var(--c-bg-2) !important; border-bottom-color: var(--c-border) !important; }
[data-theme="dark"] .app-sheet__footer { background: var(--c-bg-2) !important; border-top-color: var(--c-border) !important; }

/* 수량 입력 */
[data-theme="dark"] .app-qty__input { background: var(--c-bg-2) !important; color: var(--c-text) !important; }
[data-theme="dark"] .app-cart-qty__num { background: var(--c-bg-2) !important; color: var(--c-text) !important; }

/* 리뷰 */
[data-theme="dark"] .app-review-write { background: var(--c-bg-2) !important; border-color: var(--c-border) !important; }
[data-theme="dark"] .app-review-write select,
[data-theme="dark"] .app-review-write input { background: var(--c-bg-3) !important; border-color: var(--c-border) !important; color: var(--c-text) !important; }

/* 장바구니 */
[data-theme="dark"] .app-cart-item { background: var(--c-bg-2) !important; }
[data-theme="dark"] .app-order-summary { background: var(--c-bg-2) !important; }
[data-theme="dark"] .app-guest-form { background: var(--c-bg-2) !important; }

/* 마이페이지 메뉴 */
[data-theme="dark"] .app-menu-list { background: var(--c-bg-2) !important; }
[data-theme="dark"] .app-menu-item { color: var(--c-text) !important; border-bottom-color: var(--c-border) !important; }
[data-theme="dark"] .app-menu-item:hover { background: var(--c-bg-3) !important; }

/* 탭 뱃지 테두리 */
[data-theme="dark"] .app-tab-badge { border-color: var(--c-bg) !important; }
[data-theme="dark"] .app-header-badge { border-color: var(--c-bg) !important; }

/* 알림 배너 - 다크모드에서 채도 낮춤 */
[data-theme="dark"] .app-alert--info    { background: rgba(29,78,216,.15) !important; color: #93c5fd !important; border-color: rgba(29,78,216,.3) !important; }
[data-theme="dark"] .app-alert--warn    { background: rgba(146,64,14,.2)  !important; color: #fcd34d !important; border-color: rgba(146,64,14,.4)  !important; }
[data-theme="dark"] .app-alert--success { background: rgba(22,101,52,.2)  !important; color: #86efac !important; border-color: rgba(22,101,52,.4)  !important; }
[data-theme="dark"] .app-alert--danger  { background: rgba(153,27,27,.2)  !important; color: #fca5a5 !important; border-color: rgba(153,27,27,.4)  !important; }
