/* 기본 CSS 초기화 및 변수 설정 */
@import url('stages.css');

/* 추가 애니메이션 */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* 버튼 호버 효과 */
.tool-link {
  position: relative;
  overflow: hidden;
}

.tool-link::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.tool-link:hover::before {
  width: 300px;
  height: 300px;
}

/* 카드 호버 효과 개선 */
.tool-card {
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s;
}

.tool-card:hover::before {
  left: 100%;
}

/* 스크롤 애니메이션 */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeIn 0.6s ease-out forwards;
}

.slide-in {
  opacity: 0;
  transform: translateX(-30px);
  animation: slideIn 0.6s ease-out forwards;
}

/* 로딩 애니메이션 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(74, 144, 226, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 추천 결과 애니메이션 */
.recommendation-result {
  animation: fadeIn 0.6s ease-out;
}

.flow-step {
  animation: slideIn 0.6s ease-out;
  animation-fill-mode: both;
}

.flow-step:nth-child(2) { animation-delay: 0.1s; }
.flow-step:nth-child(3) { animation-delay: 0.2s; }
.flow-step:nth-child(4) { animation-delay: 0.3s; }
.flow-step:nth-child(5) { animation-delay: 0.4s; }

/* 태그 스타일 */
.tool-tag {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: rgba(74, 144, 226, 0.1);
  color: var(--primary-color);
  border-radius: 1rem;
  font-size: 0.75rem;
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
}

/* 스크롤바 스타일 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* 포커스 스타일 개선 */
:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* 선택 텍스트 스타일 */
::selection {
  background: var(--primary-color);
  color: white;
}

/* 프린트 스타일 */
@media print {
  .header,
  .footer,
  .recommend-wizard,
  .search-section {
    display: none !important;
  }
  
  .tool-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  
  body {
    color: black;
    background: white;
  }
}

/* 접근성 개선 */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
  .tool-card {
    border-width: 3px;
  }
  
  .tool-link {
    border: 2px solid currentColor;
  }
}

/* 모션 감소 설정 지원 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .hero-emoji {
    animation: none;
  }
}

/* 터치 디바이스 최적화 */
@media (hover: none) {
  .tool-card:active {
    transform: scale(0.98);
  }
  
  .tool-link {
    padding: 0.5rem 1rem;
  }
}

/* 큰 화면 최적화 */
@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
  
  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  }
}

/* 초소형 화면 최적화 */
@media (max-width: 375px) {
  .hero-title {
    font-size: 1.75rem;
  }
  
  .stage-flow {
    gap: 0.5rem;
  }
  
  .stage-item {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
}
