/* ============================================================
   KIEMSTA 2026 — 모바일 반응형 보강 (2026-06-04)
   content.css 등 이후에 덮어쓰는 교정용. 모바일 깨짐 방지.
   (단독 .css — .scss 소스 없음. 모바일 전용 override 모음)
   ============================================================ */

@media screen and (max-width: 768px) {
  /* ── 공통: 페이지 가로 넘침 차단 ─────────────────────── */
  html, body { overflow-x: clip !important; } /* 2026-06-07: hidden→clip — 가로스크롤 차단 유지하되 상단 임시저장/최종제출 sticky 바가 안 깨지게 */
  img { max-width: 100%; height: auto; }

  /* ── 상단 바 로그인/마이페이지/로그아웃 숨김 (모바일은 햄버거 드로어에만 노출) ─
     inline display:flex 보다 우선하도록 !important. 드로어(#ly_navPop .member)는 영향 없음. */
  header > .member { display: none !important; }

  /* ── 참가신청서: 폼 풀폭 + 넓은 표 가로 스크롤 ───────── */
  .infoBox,
  .infoBox .inputBox,
  .infoBox .tableBox,
  .infoBox fieldset { max-width: 100% !important; box-sizing: border-box !important; }

  .infoBox table.evaluation_table,
  .infoBox table.apply_banner,
  .infoBox table.box02 {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    max-width: 100% !important;
  }
  /* 2026-06-08: 셀 최소폭 — 표가 쪼그라들어 글자가 1자씩 세로로 터지는 것 방지(→ 가로스크롤 유도) */
  .infoBox table.box02 td, .infoBox table.box02 th { min-width: 84px; }
  .infoBox table.evaluation_table td, .infoBox table.evaluation_table th { min-width: 116px; white-space: normal; }
  .infoBox table.apply_banner td, .infoBox table.apply_banner th { min-width: 88px; }

  /* ── 커스텀 팝업(최종제출 안내 등) 화면 안에 맞춤 ─────── */
  .snm_overlay { padding: 14px !important; }
  .snm_box { max-width: calc(100vw - 28px) !important; padding: 26px 18px 20px !important; }
  .snm_title { font-size: 18px !important; }
  .snm_msg { font-size: 15px !important; }

  /* ── 단체 참관객 등록: 멤버 행 줄바꿈(화면 밖 이탈 방지) ─ */
  .form_section .group_member .row2 { flex-wrap: wrap !important; }
  .form_section .group_member .row2 input { flex: 1 1 100% !important; min-width: 0 !important; }
  .form_section .group_member .row2 .del_member_btn { flex: 0 0 auto !important; }
  .form_section .fld_grid { grid-template-columns: 1fr !important; }

  /* ── 마이페이지: 회사 정보 잘림 방지(풀폭/세로 정렬) ──── */
  .mmb_myinfo { display: block !important; }
  .mmb_myinfo .logo,
  .mmb_myinfo .info { width: 100% !important; max-width: 100% !important; box-sizing: border-box !important; float: none !important; }
  .mmb_myinfo .info ul li { word-break: break-all; }
  .mmb_myinfo .info ul li em { display: inline-block; min-width: 80px; }

  /* ── 양식 다운로드(form.php): 검색바 줄바꿈 + 표 컬럼 정리 ─ */
  .formdl_wrap { padding: 16px 12px !important; margin: 16px auto !important; }
  .formdl_search { flex-wrap: wrap !important; }
  .formdl_search .total { flex: 1 1 100% !important; }
  .formdl_search select { flex: 0 0 auto; }
  .formdl_search input[type=text] { flex: 1 1 auto; min-width: 0; }
  .formdl_table th:nth-child(5), .formdl_table td:nth-child(5) { display: none; } /* 조회 컬럼 숨김 */
  .formdl_table th, .formdl_table td { padding: 10px 8px !important; font-size: 13px !important; }

  /* ── 공통: 일반 콘텐츠 컨테이너/표 풀폭 보호 ───────────── */
  .container { box-sizing: border-box; max-width: 100%; }
}

@media screen and (max-width: 560px) {
  .formdl_table th:nth-child(4), .formdl_table td:nth-child(4) { display: none; } /* 등록일도 숨김 */
}

/* ── 부대행사(event.php): 일정 표 컬럼 정리 ───────────── */
@media screen and (max-width: 768px) {
  .event_wrap { padding: 16px 12px !important; margin: 16px auto !important; }
  .legend { flex-wrap: wrap !important; }
  .event_table th, .event_table td { padding: 10px 8px !important; font-size: 13px !important; }
  .event_table th:nth-child(2), .event_table td:nth-child(2) { display: none; } /* 분류 숨김(좌측 색띠로 구분) */
}
@media screen and (max-width: 560px) {
  .event_table th:nth-child(3), .event_table td:nth-child(3) { display: none; } /* 장소 숨김 */
}

/* ============================================================
   2026-06-08: 런칭 전 모바일 전수 감사 반영 (3개 그룹 병렬 점검 결과)
   ============================================================ */
@media screen and (max-width: 768px) {
  /* 공지/게시판 검색바 줄바꿈 (notice.php — .notice_search) */
  .notice_search { flex-wrap: wrap !important; }
  .notice_search .total { flex: 1 1 100% !important; margin-bottom: 6px; }
  .notice_search select { flex: 0 0 auto; }
  .notice_search input[type="text"] { flex: 1 1 auto !important; min-width: 0 !important; }

  /* 참가신청/수정 폼 — 주소 행: 우편번호+주소찾기 강제 1줄(nowrap) 해제 */
  .cnt_applicationInfo .address { flex-wrap: wrap !important; }
  .cnt_applicationInfo .address input[name="post1"] { flex: 1 1 100% !important; width: 100% !important; }
  .cnt_applicationInfo .address input[type="button"] { flex: 0 0 auto !important; }

  /* 참가신청/수정 폼 — 상단 임시저장/최종제출 sticky 바 줄바꿈(버튼 잘림 방지) */
  .cnt_applicationInfo .link { flex-wrap: wrap !important; gap: 6px !important; }
  .cnt_applicationInfo .link a { flex: 1 1 40% !important; width: auto !important; min-width: 0 !important; box-sizing: border-box; text-align: center; }

  /* 메인 공지 팝업 — left/width px 고정으로 화면 밖 이탈 → 양옆 4vw 고정(중앙 정렬) */
  .n_popup { left: 4vw !important; right: 4vw !important; width: auto !important; max-width: 92vw !important; top: 60px !important; }

  /* PDF 임베드(참가규정 rule / 조감도 showroom) 모바일 과도 세로길이 축소 */
  .cnt_rule .box, .cnt_showroom .box { height: 70vh !important; min-height: 380px !important; }
  iframe[src*=".pdf"] { height: 70vh !important; }
}

/* ============================================================
   2026-06-08: 참가신청/수정 폼 — 칸 많은 표를 모바일 '카드형'으로 (가로스크롤 대신 세로 적층)
   대상: 제품등록(pd_input_table) · 독점수입(exclusive_table) — 병합셀 없는 깨끗한 표.
   라벨은 컬럼 위치(nth-child) 기준 CSS 주입 → 폼 PHP 무수정. 신청·수정폼 동일 구조라 공용.
   (부스/전기/평가 배점표/현수막은 colspan/rowspan 병합셀 → 제외, 가로스크롤 유지)
   ============================================================ */
@media screen and (max-width: 768px) {
  .infoBox table.pd_input_table,
  .infoBox table.exclusive_table { display: block; width: 100% !important; min-width: 0 !important; }

  .pd_input_table thead, .exclusive_table thead { display: none; }

  /* 행 = 카드 (display 에 !important 금지 — 숨김행/JS inline display:none 우선 유지) */
  .pd_input_table tbody tr, .exclusive_table tbody tr {
    display: block;
    border: 1px solid #d1d5db; border-radius: 8px;
    margin: 0 0 12px; padding: 4px 12px 12px; background: #fff;
  }
  /* 칸 = 세로 블록 */
  .pd_input_table tbody td, .exclusive_table tbody td {
    display: block; width: 100% !important; box-sizing: border-box;
    border: 0 !important; padding: 7px 0 !important; text-align: left !important;
  }
  /* 라벨 공통 스타일 (content 지정된 칸만 렌더됨) */
  .pd_input_table tbody td::before, .exclusive_table tbody td::before {
    display: block; font-size: 12px; font-weight: 700; color: #16a34a; margin-bottom: 5px;
  }
  /* 컬럼 라벨 — 제품등록 */
  .pd_input_table tbody td:nth-child(2)::before { content: "제품 대분류"; }
  .pd_input_table tbody td:nth-child(3)::before { content: "제품 중분류"; }
  .pd_input_table tbody td:nth-child(4)::before { content: "모델명 (국문 / 영문)"; }
  .pd_input_table tbody td:nth-child(5)::before { content: "제품설명 (국문 / 영문)"; }
  .pd_input_table tbody td:nth-child(6)::before { content: "첨부파일 (제품 이미지)"; }
  /* 컬럼 라벨 — 독점수입 */
  .exclusive_table tbody td:nth-child(2)::before { content: "독점수입국가"; }
  .exclusive_table tbody td:nth-child(3)::before { content: "독점수입브랜드"; }
  .exclusive_table tbody td:nth-child(4)::before { content: "출품 대표기종"; }
  .exclusive_table tbody td:nth-child(5)::before { content: "수량"; }
  .exclusive_table tbody td:nth-child(6)::before { content: "비고"; }
  .exclusive_table tbody td:nth-child(7)::before { content: "증빙자료 (PDF/JPG/PNG, 3MB)"; }
  .exclusive_table tbody td:nth-child(8)::before { content: "참고자료 (PDF/JPG/PNG, 3MB)"; }
  /* 첫 칸(번호/메인 배지) = 카드 헤더 */
  .pd_input_table tbody td:first-child, .exclusive_table tbody td:first-child {
    font-weight: 700; color: #111; border-bottom: 1px dashed #e5e7eb !important;
    padding-bottom: 8px !important; margin-bottom: 4px;
  }
}

/* ============================================================
   2026-06-08: 모바일 상단 로고 확대 (≤600px). layout.css 는 @import 라 캐시버스팅 안 됨 →
   캐시버스팅되는 이 파일에서 override. PC(>600px)는 영향 없음.
   ============================================================ */
@media screen and (max-width: 600px) {
  header h1 a { width: 152px !important; height: 32px !important; }
  header h1 { top: calc(50% - 16px) !important; }
}
