/* ============================================================
   AMS IBP 공통 프린트 스타일
   모든 팀에서 공유하는 기본 인쇄 규칙
   ============================================================ */

@media print {
  /* 기본 인쇄 설정 */
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    font-size: 11pt;
    line-height: 1.4;
    color: #000;
    background: #fff;
  }

  /* 네비게이션, 버튼, 입력창 숨김 */
  header,
  nav,
  .navbar,
  .sidebar,
  .app-header,
  .bottom-bar,
  .footer,
  button:not(.print-btn),
  input[type="button"],
  input[type="submit"],
  .print-hide,
  .no-print {
    display: none !important;
  }

  /* 메인 콘텐츠 전체 너비 */
  .app-content,
  .container,
  .content-area,
  main {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
  }

  /* 페이지 설정 */
  @page {
    margin: 20mm;
    size: A4;
  }

  /* 테이블 스타일 */
  table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10pt;
    page-break-inside: avoid;
  }

  thead {
    display: table-header-group; /* 페이지마다 헤더 반복 */
  }

  tr {
    page-break-inside: avoid;
  }

  th,
  td {
    border: 1px solid #333;
    padding: 6pt 8pt;
    text-align: left;
    vertical-align: middle;
  }

  th {
    background: #f5f5f5 !important;
    font-weight: bold;
    color: #000;
  }

  /* 링크 스타일 (인쇄 시 URL 표시 안 함) */
  a {
    color: #000;
    text-decoration: none;
  }

  a[href]::after {
    content: "";
  }

  /* 이미지 스타일 */
  img {
    max-width: 100%;
    height: auto;
    page-break-inside: avoid;
  }

  /* 프린트 헤더 */
  .print-header {
    text-align: center;
    margin-bottom: 20pt;
    border-bottom: 2px solid #333;
    padding-bottom: 10pt;
    page-break-after: avoid;
  }

  .print-header img {
    max-height: 40pt;
    margin-bottom: 10pt;
  }

  .print-header h2 {
    font-size: 16pt;
    margin-bottom: 5pt;
    color: #000;
  }

  .print-header p {
    font-size: 10pt;
    color: #666;
  }

  /* 섹션 구분 */
  .print-section {
    page-break-inside: avoid;
    margin-bottom: 15pt;
  }

  .print-section h3 {
    font-size: 13pt;
    margin-bottom: 8pt;
    color: #000;
    font-weight: bold;
    page-break-after: avoid;
  }

  /* 페이지 나눔 */
  .page-break {
    page-break-before: always;
  }

  /* 텍스트 색상 제거 (검은색만) */
  .text-primary,
  .text-success,
  .text-warning,
  .text-danger,
  .text-muted {
    color: #000 !important;
  }

  /* 배경색 제거 */
  .bg-light,
  .bg-dark,
  .bg-primary {
    background: #fff !important;
  }

  /* 패딩/마진 조정 */
  p,
  li {
    margin-bottom: 5pt;
  }

  ul,
  ol {
    margin-left: 20pt;
  }

  /* 그리드 레이아웃 인쇄 최적화 */
  .row {
    display: table-row;
  }

  .col,
  [class*="col-"] {
    display: table-cell;
    vertical-align: top;
  }

  /* 모바일 전용 요소 숨김 */
  .mobile-only {
    display: none !important;
  }

  /* 인쇄 전용 요소 표시 */
  .print-only {
    display: block !important;
  }

  /* 특수 요소 숨김 */
  .modal,
  .tooltip,
  .popover,
  .carousel,
  [role="status"],
  [role="alert"] {
    display: none !important;
  }

  /* 마지막 페이지 우측 여백 */
  body::after {
    content: "";
    display: block;
    height: 50mm;
  }
}

/* 화면 모드에서 프린트 버튼 표시 */
@media screen {
  .print-only {
    display: none !important;
  }
}
