/*
 * Apple Human Interface Guidelines 기반 디자인 시스템
 * 큐 관리 시스템 - 전역 스타일
 */

/* ========================================
   1. CSS 변수 - 시맨틱 컬러 시스템
   ======================================== */

:root {
  /* Primary Colors - Brand/Action */
  --color-primary: #007AFF;
  --color-primary-hover: #0051D5;
  --color-primary-active: #004BB8;
  
  /* Secondary Colors - Alternative Actions */
  --color-secondary: #5856D6;
  --color-secondary-hover: #4644B0;
  
  /* Success - Positive Actions */
  --color-success: #34C759;
  --color-success-hover: #2AA648;
  --color-success-bg: #E8F7ED;
  
  /* Warning - Caution */
  --color-warning: #FF9500;
  --color-warning-hover: #E08600;
  --color-warning-bg: #FFF4E5;
  
  /* Error/Danger - Destructive Actions */
  --color-error: #FF3B30;
  --color-error-hover: #D92B1F;
  --color-error-bg: #FFE5E5;
  
  /* Info - Informational */
  --color-info: #5AC8FA;
  --color-info-hover: #4AB3E0;
  --color-info-bg: #E5F6FD;
  
  /* Neutral Colors - Text & Backgrounds */
  --color-neutral-100: #FFFFFF;
  --color-neutral-200: #F2F2F7;
  --color-neutral-300: #E5E5EA;
  --color-neutral-400: #D1D1D6;
  --color-neutral-500: #C7C7CC;
  --color-neutral-600: #8E8E93;
  --color-neutral-700: #636366;
  --color-neutral-800: #48484A;
  --color-neutral-900: #1C1C1E;
  
  /* Semantic Text Colors */
  --color-text-primary: #1C1C1E;
  --color-text-secondary: #3A3A3C;
  --color-text-tertiary: #636366;
  --color-text-quaternary: #8E8E93;
  --color-text-inverse: #FFFFFF;
  
  /* Semantic Background Colors */
  --color-bg-primary: #FFFFFF;
  --color-bg-secondary: #F2F2F7;
  --color-bg-tertiary: #E5E5EA;
  --color-bg-elevated: #FFFFFF;
  
  /* Border & Separator */
  --color-border: #D1D1D6;
  --color-separator: rgba(60, 60, 67, 0.12);
  
  /* Shadow & Overlay */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.2);
  
  /* Spacing System - 8px 기준 */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  
  /* Border Radius */
  --radius-sm: 0.375rem;  /* 6px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
  
  /* Touch Target Minimum Size */
  --touch-target-min: 44px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --color-primary: #0A84FF;
    --color-primary-hover: #409CFF;
    
    --color-text-primary: #FFFFFF;
    --color-text-secondary: #E5E5EA;
    --color-text-tertiary: #8E8E93;
    --color-text-quaternary: #636366;
    
    --color-bg-primary: #000000;
    --color-bg-secondary: #1C1C1E;
    --color-bg-tertiary: #2C2C2E;
    --color-bg-elevated: #1C1C1E;
    
    --color-border: #48484A;
    --color-separator: rgba(255, 255, 255, 0.12);
  }
}

/* ========================================
   2. 폰트 스택 - SF Pro 우선
   ======================================== */

:root {
  /* SF Pro 폰트 스택 */
  --font-family-base: -apple-system, BlinkMacSystemFont, "Segoe UI", 
                      Roboto, "Helvetica Neue", Arial, sans-serif;
  
  /* Monospace for codes */
  --font-family-mono: ui-monospace, "SF Mono", Monaco, "Cascadia Mono", 
                      "Segoe UI Mono", Consolas, monospace;
}

/* ========================================
   3. 타이포그래피 스케일 (rem 기준)
   ======================================== */

/* Base: 16px = 1rem */

.text-large-title {
  font-size: 2.125rem;    /* 34pt / 34px */
  line-height: 1.235;     /* 41pt */
  font-weight: 700;
  letter-spacing: -0.015em;
}

.text-title1 {
  font-size: 1.75rem;     /* 28pt / 28px */
  line-height: 1.286;     /* 34pt */
  font-weight: 700;
  letter-spacing: -0.01em;
}

.text-title2 {
  font-size: 1.375rem;    /* 22pt / 22px */
  line-height: 1.273;     /* 28pt */
  font-weight: 700;
  letter-spacing: -0.008em;
}

.text-title3 {
  font-size: 1.25rem;     /* 20pt / 20px */
  line-height: 1.25;      /* 25pt */
  font-weight: 600;
  letter-spacing: -0.005em;
}

.text-headline {
  font-size: 1.0625rem;   /* 17pt / 17px */
  line-height: 1.294;     /* 22pt */
  font-weight: 600;
  letter-spacing: -0.003em;
}

.text-body {
  font-size: 1.0625rem;   /* 17pt / 17px */
  line-height: 1.294;     /* 22pt */
  font-weight: 400;
  letter-spacing: -0.003em;
}

.text-callout {
  font-size: 1rem;        /* 16pt / 16px */
  line-height: 1.313;     /* 21pt */
  font-weight: 400;
  letter-spacing: -0.002em;
}

.text-subheadline {
  font-size: 0.9375rem;   /* 15pt / 15px */
  line-height: 1.333;     /* 20pt */
  font-weight: 400;
  letter-spacing: -0.001em;
}

.text-footnote {
  font-size: 0.8125rem;   /* 13pt / 13px */
  line-height: 1.231;     /* 18pt */
  font-weight: 400;
  letter-spacing: -0.001em;
}

.text-caption1 {
  font-size: 0.75rem;     /* 12pt / 12px */
  line-height: 1.333;     /* 16pt */
  font-weight: 400;
  letter-spacing: 0;
}

.text-caption2 {
  font-size: 0.6875rem;   /* 11pt / 11px */
  line-height: 1.273;     /* 13pt */
  font-weight: 400;
  letter-spacing: 0.002em;
}

/* Font Weight Utilities */
.font-thin { font-weight: 100; }
.font-light { font-weight: 300; }
.font-regular { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-heavy { font-weight: 800; }
.font-black { font-weight: 900; }

/* ========================================
   4. 기본 스타일
   ======================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family-base);
  font-size: 1.0625rem;  /* Body size: 17pt */
  line-height: 1.294;
  color: var(--color-text-primary);
  background-color: var(--color-bg-secondary);
}

/* ========================================
   5. 버튼 컴포넌트
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-target-min);
  min-width: var(--touch-target-min);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-family-base);
  font-size: 1.0625rem;  /* 17pt */
  font-weight: 600;
  line-height: 1.294;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Primary Button */
.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-hover);
}

.btn-primary:active:not(:disabled) {
  background-color: var(--color-primary-active);
  transform: scale(0.98);
}

/* Success Button */
.btn-success {
  background-color: var(--color-success);
  color: var(--color-text-inverse);
}

.btn-success:hover:not(:disabled) {
  background-color: var(--color-success-hover);
}

.btn-success:active:not(:disabled) {
  transform: scale(0.98);
}

/* Warning Button */
.btn-warning {
  background-color: var(--color-warning);
  color: var(--color-text-inverse);
}

.btn-warning:hover:not(:disabled) {
  background-color: var(--color-warning-hover);
}

/* Error/Danger Button */
.btn-danger {
  background-color: var(--color-error);
  color: var(--color-text-inverse);
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--color-error-hover);
}

/* Secondary Button (Outline) */
.btn-secondary {
  background-color: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-secondary:hover:not(:disabled) {
  background-color: rgba(0, 122, 255, 0.1);
}

/* Tertiary Button (Text Only) */
.btn-tertiary {
  background-color: transparent;
  color: var(--color-primary);
  padding: var(--space-2) var(--space-4);
}

.btn-tertiary:hover:not(:disabled) {
  background-color: rgba(0, 122, 255, 0.08);
}

/* Button Sizes */
.btn-sm {
  min-height: 36px;
  padding: var(--space-2) var(--space-4);
  font-size: 0.9375rem;  /* 15pt */
}

.btn-lg {
  min-height: 52px;
  padding: var(--space-4) var(--space-8);
  font-size: 1.0625rem;  /* 17pt */
}

/* ========================================
   6. 카드 컴포넌트
   ======================================== */

.card {
  background-color: var(--color-bg-elevated);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-separator);
}

.card-lg {
  padding: var(--space-6);
  border-radius: var(--radius-2xl);
}

.card-hover {
  transition: all var(--transition-base);
}

.card-hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ========================================
   7. 상태 배지
   ======================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: 0.8125rem;  /* 13pt */
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-success {
  background-color: var(--color-success-bg);
  color: var(--color-success);
}

.badge-warning {
  background-color: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge-error {
  background-color: var(--color-error-bg);
  color: var(--color-error);
}

.badge-info {
  background-color: var(--color-info-bg);
  color: var(--color-info);
}

/* ========================================
   8. 입력 필드
   ======================================== */

.input {
  width: 100%;
  min-height: var(--touch-target-min);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-family-base);
  font-size: 1.0625rem;  /* 17pt */
  line-height: 1.294;
  color: var(--color-text-primary);
  background-color: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.input::placeholder {
  color: var(--color-text-tertiary);
}

.input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: var(--color-bg-tertiary);
}

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

/* Spacing */
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-3 { margin: var(--space-3); }
.m-4 { margin: var(--space-4); }
.m-5 { margin: var(--space-5); }
.m-6 { margin: var(--space-6); }
.m-8 { margin: var(--space-8); }

/* Text Colors */
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }

/* Background Colors */
.bg-primary { background-color: var(--color-bg-primary); }
.bg-secondary { background-color: var(--color-bg-secondary); }
.bg-elevated { background-color: var(--color-bg-elevated); }

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* ========================================
   10. 애니메이션
   ======================================== */

@keyframes pulse-grow {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.02);
    opacity: 0.95;
  }
}

.pulse-grow {
  animation: pulse-grow 2s ease-in-out infinite;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn var(--transition-slow) ease-out;
}

/* ========================================
   11. 접근성 개선
   ======================================== */

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .pulse-grow {
    animation: none;
  }
}

/* Focus Visible (Keyboard Navigation) */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Skip to Main Content Link */
.skip-to-main {
  position: absolute;
  top: -100px;
  left: 0;
  padding: var(--space-4);
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  text-decoration: none;
  z-index: 9999;
}

.skip-to-main:focus {
  top: 0;
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ========================================
   12. 반응형 디자인 (모바일 퍼스트)
   ======================================== */

/* Small devices (tablets, 768px and up) */
@media (min-width: 768px) {
  .text-large-title {
    font-size: 2.5rem;    /* 40pt */
  }
  
  .text-title1 {
    font-size: 2rem;      /* 32pt */
  }
}

/* Medium devices (desktops, 1024px and up) */
@media (min-width: 1024px) {
  .text-large-title {
    font-size: 3rem;      /* 48pt */
  }
  
  .text-title1 {
    font-size: 2.25rem;   /* 36pt */
  }
}

/* ========================================
   13. 프린트 스타일
   ======================================== */

@media print {
  body {
    background-color: white;
    color: black;
  }
  
  .btn,
  .badge {
    border: 1px solid black;
  }
  
  /* Hide interactive elements */
  button:not(.print-visible),
  .no-print {
    display: none !important;
  }
}
