/**
 * KGPC 모바일 최적화 변수 및 공통 스타일
 * 생성일: 2025-12-03
 */

/* ==================== CSS 변수 정의 ==================== */
:root {
  /* 분기점 (Breakpoints) */
  --breakpoint-mobile: 768px;
  --breakpoint-tablet: 1024px;
  --breakpoint-desktop: 1400px;
  
  /* 색상 */
  --primary-color: #1a399e;
  --primary-hover: #0f2870;
  --secondary-color: #1976d2;
  --text-primary: #333;
  --text-secondary: #666;
  --border-color: #e0e0e0;
  --bg-light: #f8f9fa;
  
  /* 간격 */
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 20px;
  --spacing-xl: 30px;
  
  /* 폰트 크기 */
  --font-xs: 12px;
  --font-sm: 14px;
  --font-md: 16px;
  --font-lg: 18px;
  --font-xl: 20px;
  
  /* 모바일 전용 */
  --mobile-header-height: 60px;
  --mobile-padding: 7px;
  --mobile-font-base: 14px;
}

/* ==================== 모바일 감지 클래스! ==================== */
body.is-mobile {
  font-size: var(--mobile-font-base);
}

body.is-desktop {
  font-size: 16px;
}

/* ==================== 유틸리티 클래스 ==================== */

/* 모바일에서만 표시 */
.show-on-mobile {
  display: none !important;
}

@media (max-width: 768px) {
  .show-on-mobile {
    display: block !important;
  }
}

/* 모바일에서 숨김 */
.hide-on-mobile {
  display: block;
}

@media (max-width: 768px) {
  .hide-on-mobile {
    display: none !important;
  }
}

/* 데스크톱에서만 표시 */
.show-on-desktop {
  display: none;
}

@media (min-width: 769px) {
  .show-on-desktop {
    display: block !important;
  }
}

/* 데스크톱에서 숨김 */
.hide-on-desktop {
  display: none;
}

@media (min-width: 769px) {
  .hide-on-desktop {
    display: block !important;
  }
}

/* ==================== 모바일 공통 레이아웃 ==================== */
@media (max-width: 768px) {
  /* 컨테이너 패딩 */
  #container,
  #content {
    padding-left: var(--mobile-padding);
    padding-right: var(--mobile-padding);
  }
  
  /* 버튼 */
  button,
  .btn {
    min-height: 44px; /* 터치 영역 최소 크기 */
    font-size: var(--font-md);
  }
  
  /* 입력 필드 */
  input[type="text"],
  input[type="password"],
  input[type="email"],
  select,
  textarea {
    min-height: 44px; /* 터치 영역 최소 크기 */
    font-size: var(--font-md);
    padding: 10px 15px;
  }
  
  /* 링크 */
  a {
    display: inline-flex;
    align-items: center;
  }
}

/* ==================== 모바일 테이블 공통 스타일 ==================== */
@media (max-width: 768px) {
  /* 테이블을 카드형으로 변환 */
  table.mobile-card-table {
    border: 0;
  }
  
  table.mobile-card-table thead {
    display: none;
  }
  
  table.mobile-card-table tbody tr {
    display: block;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
  }
  
  table.mobile-card-table tbody td {
    display: block;
    text-align: right;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    padding-left: 50%;
  }
  
  table.mobile-card-table tbody td:last-child {
    border-bottom: none;
  }
  
  table.mobile-card-table tbody td::before {
    content: attr(data-label);
    position: absolute;
    left: 15px;
    top: 12px;
    font-weight: bold;
    color: var(--text-secondary);
    text-align: left;
  }
}

/* ==================== 모바일 스크롤 힌트 ==================== */
@media (max-width: 768px) {
  .table-scroll-container {
    position: relative;
  }
  
  .table-scroll-container::after {
    content: '← 좌우로 스크롤하세요 →';
    display: block;
    text-align: center;
    padding: 8px;
    background: #fff9e6;
    color: #856404;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    margin-top: 5px;
  }
}

