/**
 * UI 개선 스타일
 */

/* 접근성: 포커스 표시 강화 */
*:focus-visible {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
}

/* 버튼 포커스 스타일 */
button:focus-visible,
a:focus-visible {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
    border-radius: 4px;
}

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

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-image {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

/* 이미지 로딩 플레이스홀더 */
img {
    background-color: #f3f4f6;
    transition: opacity 0.3s;
}

img[loading="lazy"] {
    opacity: 0;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* 로딩 스피너 */
.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #ef4444;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 버튼 로딩 상태 */
button.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

button.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* 터치 피드백 */
@media (hover: none) and (pointer: coarse) {
    button:active,
    a:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
}

/* 스크롤바 스타일링 (웹킷) */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

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

/* 애니메이션 개선 */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.slide-up {
    animation: slideUp 0.3s ease-out;
}

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

/* 모바일 최적화 */
@media (max-width: 768px) {
    /* 터치 영역 최소 크기 */
    button, a {
        min-height: 44px;
        min-width: 44px;
    }
}

/* 스크린 리더 전용 텍스트 */
.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;
}
