/* ============================================================
   ktradehub /tools/* 모바일 전용 CSS
   적용: viewport ≤ 768px
   목적: PC 레이아웃은 그대로, 모바일에서만 최적화
   ============================================================ */

@media (max-width: 768px) {

  /* ─────────────────────────────────────────
     1. 공통 레이아웃
     ───────────────────────────────────────── */
  .tools-layout {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
    padding: calc(var(--header-height, 60px) + 16px) 12px 32px !important;
  }
  .tools-main {
    padding: 0 !important;
  }
  /* 모바일에서 도구 사이드바는 메인 햄버거의 도구모음 아코디언으로 대체 */
  .tools-sidebar { display: none !important; }

  /* ─────────────────────────────────────────
     2. 페이지 헤더 (h1 + 설명)
     ───────────────────────────────────────── */
  .tools-main > div:first-child h1,
  .tools-main h1 {
    font-size: 1.2rem !important;
    line-height: 1.35 !important;
    margin: 0 0 6px !important;
  }
  .tools-main h1 + p {
    font-size: 0.85rem !important;
    line-height: 1.55 !important;
  }

  /* ─────────────────────────────────────────
     3. 공통 패널 / ic-* 시스템
     ───────────────────────────────────────── */
  .ic-panel {
    padding: 16px 14px !important;
  }
  .ic-section-title {
    font-size: 0.92rem !important;
    margin: 18px 0 10px !important;
  }
  .ic-section-title:first-child {
    margin-top: 0 !important;
  }
  .ic-row {
    margin-bottom: 11px !important;
  }
  .ic-row label {
    font-size: 0.83rem !important;
    margin-bottom: 5px !important;
    font-weight: 600;
  }
  /* 2열 / 3열 그리드 → 모두 1열로 */
  .ic-row-2,
  .ic-row-3 {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  /* 모든 입력 — 16px 폰트로 iOS 포커스 자동 줌 방지 */
  .ic-input,
  input[type="text"],
  input[type="url"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="date"],
  textarea,
  select {
    font-size: 16px !important;
    padding: 11px 12px !important;
    min-height: 44px;
    box-sizing: border-box;
  }
  /* 컬러 픽커 */
  input[type="color"].ic-input,
  input[type="color"].qr-color {
    height: 44px !important;
    min-height: 44px;
  }
  /* 텍스트영역은 자동 줄바꿈 허용 */
  textarea.ic-input {
    min-height: 80px;
  }

  /* ─────────────────────────────────────────
     4. 버튼 — 터치 타겟 44px 이상
     ───────────────────────────────────────── */
  button,
  .ic-calc-btn,
  .qr-btn-secondary,
  .pm-btn,
  .cp-btn {
    min-height: 44px !important;
    font-size: 0.92rem !important;
  }
  .ic-calc-btn {
    padding: 13px !important;
    font-weight: 700;
  }

  /* ─────────────────────────────────────────
     5. 도구 인덱스 (/tools/) — 카드 1열
     ───────────────────────────────────────── */
  .tool-card {
    padding: 18px 16px !important;
  }
  .tool-card__title {
    font-size: 1rem !important;
  }
  .tool-card__desc {
    font-size: 0.85rem !important;
    line-height: 1.55 !important;
  }
  .tools-main > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* ─────────────────────────────────────────
     6. QR 생성기
     ───────────────────────────────────────── */
  .qr-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .qr-type-tabs {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
  }
  .qr-type-tab {
    padding: 12px 6px !important;
    font-size: 0.8rem !important;
    min-height: 48px;
    flex-direction: column;
    gap: 4px !important;
  }
  .qr-type-tab svg {
    width: 18px !important;
    height: 18px !important;
  }
  .qr-preview {
    position: static !important;
  }
  .qr-color-pair {
    gap: 8px !important;
  }
  .qr-form .qr-color {
    flex: 0 0 56px !important;
    min-width: 56px !important;
    height: 44px !important;
  }
  .qr-tips {
    padding: 12px 14px !important;
  }
  .qr-tips li {
    font-size: 0.85rem !important;
  }
  .qr-logo-drop {
    padding: 16px 14px !important;
  }
  .qr-logo-drop-inner {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  /* ─────────────────────────────────────────
     7. 바코드 스캐너
     ───────────────────────────────────────── */
  .bs-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .bs-mode-tab {
    padding: 14px 8px !important;
    font-size: 0.88rem !important;
    min-height: 56px;
  }
  .bs-mode-tab svg {
    width: 18px !important;
    height: 18px !important;
  }
  .bs-drop {
    padding: 24px 14px !important;
  }
  .bs-drop-inner {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
  .bs-drop-text {
    text-align: center !important;
  }
  .bs-camera-actions {
    flex-direction: column;
  }
  .bs-camera-actions > * {
    width: 100%;
  }
  .bs-result-actions {
    flex-direction: column;
  }
  .bs-result-data {
    font-size: 1rem !important;
  }
  .bs-tips li {
    font-size: 0.85rem !important;
  }

  /* ─────────────────────────────────────────
     8. 쿠팡 팔레트 적재리스트 — A4 미리보기 가로 스크롤
     ───────────────────────────────────────── */
  .cp-panel,
  .cp-common-panel {
    padding: 14px 12px !important;
  }
  .cp-panel-row,
  .cp-common-controls {
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px !important;
  }
  .cp-panel-row .cp-label {
    width: auto !important;
    margin-bottom: 2px;
  }
  .cp-input,
  .cp-select {
    min-height: 44px !important;
  }
  .cp-tabs-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cp-tab {
    padding: 10px 14px !important;
    font-size: 0.8rem !important;
    min-height: 40px;
  }
  .cp-pallet-actions {
    flex-direction: column;
  }
  .cp-pallet-actions .cp-btn {
    width: 100%;
  }
  .cp-toolbar {
    flex-direction: column;
  }
  .cp-toolbar .cp-btn {
    width: 100%;
  }
  /* A4 페이지 가로 스크롤 + 작게 표시 */
  .cp-page-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 !important;
  }
  .cp-page {
    /* 화면 폭에 맞게 축소 표시 (인쇄/PDF는 영향 없음) */
    transform: scale(0.5);
    transform-origin: top left;
    margin-bottom: calc(-297mm * 0.5 + 14px);
  }

  /* ─────────────────────────────────────────
     9. PDF 병합 / 압축
     ───────────────────────────────────────── */
  .pm-toolbar {
    flex-wrap: wrap;
    gap: 6px !important;
  }
  .pm-toolbar > .pm-btn,
  .pm-toolbar > .pm-select {
    flex: 1 1 calc(50% - 3px);
    min-height: 44px;
  }
  .pm-toolbar > #pmMergeBtn {
    flex: 1 1 100%;
    margin-left: 0 !important;
  }
  .pm-toolbar > .pm-count {
    flex: 1 1 100%;
    text-align: center;
  }
  .pm-pages {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
    gap: 10px !important;
  }
  .pm-dropzone {
    padding: 28px 16px !important;
  }
  .pm-dropzone-icon {
    font-size: 2rem !important;
  }

  /* ─────────────────────────────────────────
     10. 인보이스 / 패킹리스트 (inv-*)
     ───────────────────────────────────────── */
  .inv-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .inv-preview-wrap {
    position: static !important;
  }
  .meas-group input {
    min-height: 44px;
  }

  /* ─────────────────────────────────────────
     11. 푸터 / 활용 팁 박스
     ───────────────────────────────────────── */
  .qr-tips,
  .bs-tips,
  .pm-help,
  .pm-tier-notice {
    padding: 12px 14px !important;
    font-size: 0.85rem !important;
  }
  .qr-tips ul li,
  .bs-tips ul li,
  .pm-help ul li {
    font-size: 0.85rem !important;
    line-height: 1.6 !important;
  }
}
