/* SafetyLink Design System - Global Styles */
/* 모든 페이지에서 공통으로 사용하는 애니메이션 및 유틸리티 클래스 */

/* === 애니메이션 === */
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fade-in-down {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes pulse-subtle {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

/* === 애니메이션 클래스 === */
.animate-fade-in {
  animation: fade-in 0.3s ease-out;
}

.animate-fade-in-up {
  animation: fade-in-up 0.4s ease-out;
}

.animate-fade-in-down {
  animation: fade-in-down 0.4s ease-out;
}

.animate-slide-in-right {
  animation: slide-in-right 0.3s ease-out;
}

.animate-slide-in-left {
  animation: slide-in-left 0.3s ease-out;
}

.animate-scale-in {
  animation: scale-in 0.2s ease-out;
}

.animate-shimmer {
  animation: shimmer 2s infinite;
  background: linear-gradient(to right, #f0f0f0 4%, #f8f8f8 25%, #f0f0f0 36%);
  background-size: 1000px 100%;
}

.animate-pulse-subtle {
  animation: pulse-subtle 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* === 트랜지션 유틸리티 === */
.transition-all-smooth {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-colors-smooth {
  transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-transform-smooth {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === 호버 효과 === */
.hover-lift {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.hover-scale {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-scale:hover {
  transform: scale(1.02);
}

/* === 스크롤바 스타일링 === */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

.scrollbar-thin {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
}

.scrollbar-thin::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* === 그림자 유틸리티 === */
.shadow-brand {
  box-shadow: 0 1px 3px 0 rgb(var(--brand-600) / 0.1), 0 1px 2px -1px rgb(var(--brand-600) / 0.1);
}

.shadow-brand-md {
  box-shadow: 0 4px 6px -1px rgb(var(--brand-600) / 0.1), 0 2px 4px -2px rgb(var(--brand-600) / 0.1);
}

.shadow-brand-lg {
  box-shadow: 0 10px 15px -3px rgb(var(--brand-600) / 0.1), 0 4px 6px -4px rgb(var(--brand-600) / 0.1);
}

/* === 포커스 스타일 === */
.focus-ring {
  outline: none;
  transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.focus-ring:focus {
  box-shadow: 0 0 0 4px rgb(var(--brand-600) / 0.1);
}

.focus-ring:focus-visible {
  box-shadow: 0 0 0 4px rgb(var(--brand-600) / 0.2);
}

/* === 로딩 스켈레톤 === */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* === 배지 애니메이션 === */
.badge-pulse {
  animation: pulse-subtle 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* === 글래스모피즘 효과 === */
.glass {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.glass-dark {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* === 그라데이션 유틸리티 === */
.gradient-brand {
  background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-600) 100%);
}

.gradient-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.gradient-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.gradient-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* === 반응형 유틸리티 === */
@media (max-width: 768px) {
  .mobile-hide {
    display: none;
  }
  
  .mobile-full-width {
    width: 100%;
  }
}

@media (min-width: 769px) {
  .desktop-hide {
    display: none;
  }
}

/* === Print 스타일 === */
@media print {
  .no-print {
    display: none !important;
  }
  
  .print-break-before {
    break-before: page;
  }
  
  .print-break-after {
    break-after: page;
  }
  
  .print-avoid-break {
    break-inside: avoid;
  }
}

/* === 접근성 개선 === */
.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;
}

/* 포커스 시 표시 */
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* === 인터랙션 개선 === */
.clickable {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* === 텍스트 유틸리티 === */
.text-balance {
  text-wrap: balance;
}

.text-ellipsis-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-ellipsis-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === 프린트 === */
@media print {
  body.worklog-printing * {
    visibility: hidden !important;
  }
  body.worklog-printing #worklog-print-layout,
  body.worklog-printing #worklog-print-layout * {
    visibility: visible !important;
    display: block !important;
  }
  body.worklog-printing #worklog-print-layout {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    padding: 20px !important;
  }
  body.worklog-printing #worklog-print-layout table {
    display: table !important;
  }
  body.worklog-printing #worklog-print-layout thead {
    display: table-header-group !important;
  }
  body.worklog-printing #worklog-print-layout tbody {
    display: table-row-group !important;
  }
  body.worklog-printing #worklog-print-layout tr {
    display: table-row !important;
    page-break-inside: avoid;
  }
  body.worklog-printing #worklog-print-layout th,
  body.worklog-printing #worklog-print-layout td {
    display: table-cell !important;
  }
}
