/* Pretendard CDN — @tailwind 보다 먼저 import */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  body {
    font-family: theme('fontFamily.korean');
    @apply text-gray-900 bg-gray-50;
  }

  /* 한글 가독성 — 줄간격 */
  p, td, th, label, input, textarea, select, button {
    line-height: 1.5;
  }

  /* 한글 숫자 정렬용 mono */
  .num, td.num, .tabular-num {
    font-variant-numeric: tabular-nums;
    font-family: theme('fontFamily.mono');
  }

  h1 { @apply text-2xl font-bold; }
  h2 { @apply text-xl font-bold; }
  h3 { @apply text-lg font-semibold; }

  a { @apply text-hicom-600 hover:text-hicom-800 hover:underline; }
}

@layer components {
  /* 도어 ERP 그리드 (레거시 도어Pro10 톤) */
  table.hicom-grid {
    @apply text-sm w-full border-collapse;
  }
  table.hicom-grid thead th {
    @apply bg-hicom-50 font-semibold text-hicom-900 px-3 py-2 border-b border-hicom-200 text-left;
  }
  table.hicom-grid tbody td {
    @apply px-3 py-1.5 border-t border-gray-200;
  }
  table.hicom-grid tbody tr:hover {
    @apply bg-gray-50;
  }
  table.hicom-grid tfoot td {
    @apply px-3 py-2 bg-amber-50 font-semibold border-t-2 border-amber-300;
  }

  /* 버튼 */
  .btn {
    @apply inline-flex items-center justify-center px-4 py-2 rounded-md text-sm font-medium
           transition-colors focus:outline-none focus:ring-2 focus:ring-offset-1;
  }
  .btn-primary   { @apply btn bg-hicom-600 text-white hover:bg-hicom-700 focus:ring-hicom-500; }
  .btn-secondary { @apply btn bg-gray-200 text-gray-800 hover:bg-gray-300 focus:ring-gray-400; }
  .btn-danger    { @apply btn bg-red-600 text-white hover:bg-red-700 focus:ring-red-500; }
  .btn-ghost     { @apply btn bg-transparent text-gray-700 hover:bg-gray-100; }
  .btn-sm        { @apply px-2.5 py-1 text-xs; }

  /* 폼 */
  .form-label {
    @apply block text-sm font-medium text-gray-700 mb-1;
  }
  .form-input, .form-select, .form-textarea {
    @apply block w-full rounded-md border-gray-300 shadow-sm
           focus:border-hicom-500 focus:ring-hicom-500 sm:text-sm;
  }
  .form-checkbox {
    @apply rounded border-gray-300 text-hicom-600 focus:ring-hicom-500;
  }
  .form-error {
    @apply text-red-600 text-xs mt-1;
  }
  .form-hint {
    @apply text-gray-500 text-xs mt-1;
  }

  /* 카드 */
  .card {
    @apply bg-white rounded-lg shadow-card border border-gray-200;
  }
  .card-header {
    @apply px-4 py-3 border-b border-gray-200 font-semibold text-gray-700;
  }
  .card-body {
    @apply p-4;
  }

  /* 배지 */
  .badge {
    @apply inline-flex items-center px-2 py-0.5 rounded text-xs font-medium;
  }
  .badge-blue   { @apply badge bg-blue-100 text-blue-800; }
  .badge-green  { @apply badge bg-green-100 text-green-800; }
  .badge-red    { @apply badge bg-red-100 text-red-800; }
  .badge-amber  { @apply badge bg-amber-100 text-amber-800; }
  .badge-gray   { @apply badge bg-gray-100 text-gray-800; }

  /* Flash */
  .flash {
    @apply px-4 py-3 mb-4 rounded border text-sm;
  }
  .flash-notice  { @apply flash bg-blue-50  border-blue-200  text-blue-800; }
  .flash-alert   { @apply flash bg-red-50   border-red-200   text-red-800; }
  .flash-success { @apply flash bg-green-50 border-green-200 text-green-800; }
  .flash-warning { @apply flash bg-amber-50 border-amber-200 text-amber-800; }

  /* Devise 인증 카드 */
  .auth-card {
    @apply w-full max-w-md mx-auto bg-white rounded-lg shadow-md p-6 sm:p-8;
  }
  .auth-title {
    @apply text-xl font-bold text-center mb-6 text-gray-900;
  }
  .auth-field {
    @apply mb-4;
  }
  .auth-actions {
    @apply mt-6;
  }
  .auth-links {
    @apply mt-6 pt-4 border-t border-gray-200 text-sm text-center space-y-2;
  }

  /* 사이드바 */
  .sidebar-link {
    @apply flex items-center px-3 py-2 text-sm text-gray-700 rounded hover:bg-gray-100;
  }
  .sidebar-link-active {
    @apply sidebar-link bg-hicom-50 text-hicom-700 font-semibold;
  }
}

@layer utilities {
  /* 인쇄용 숨김 / 표시 */
  @media print {
    .no-print { display: none !important; }
  }
}
