/* ===== 접근성 개선 CSS ===== */

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

/* 포커스 시각화 개선 */
:focus {
    outline: 3px solid #4A6FA5;
    outline-offset: 2px;
}

/* 키보드 네비게이션 표시 */
.keyboard-focus-visible:focus {
    outline: 3px dashed #FF6B35;
    outline-offset: 4px;
}

/* 건너뛰기 링크 */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #1E3A5F;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    z-index: 9999;
}

.skip-link:focus {
    top: 0;
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
    body {
        background: white;
        color: black;
    }
    
    a {
        color: #0000EE;
        text-decoration: underline;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* 다크 모드 지원 */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #6B8BC4;
        --secondary-color: #3A5A8F;
        --text-dark: #F0F0F0;
        --text-light: #CCCCCC;
        --background-light: #1A1A1A;
        --background-dark: #0D0D0D;
        --white: #0D0D0D;
        --border-color: #333333;
    }
    
    body {
        background-color: #0D0D0D;
        color: #F0F0F0;
    }
    
    .header {
        background-color: #1A1A1A;
    }
}

/* 애니메이션 감소 모드 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 터치 타겟 크기 확보 */
button,
a,
input,
select,
textarea {
    min-height: 44px;
    min-width: 44px;
}

/* 폼 요소 레이블 연결 */
label {
    cursor: pointer;
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* 에러 메시지 접근성 */
.error-message {
    color: #D32F2F;
    font-weight: 500;
    margin-top: 0.25rem;
}

.error-message::before {
    content: "⚠ ";
    font-size: 1.2em;
}

/* 성공 메시지 접근성 */
.success-message {
    color: #388E3C;
    font-weight: 500;
    margin-top: 0.25rem;
}

.success-message::before {
    content: "✓ ";
    font-size: 1.2em;
}

/* 색상 대비 개선 */
.text-light-improved {
    color: #666666; /* WCAG AA 기준 충족 */
}

/* 링크 구분 개선 */
a:not(.btn) {
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

a:not(.btn):hover,
a:not(.btn):focus {
    text-decoration-thickness: 3px;
}

/* 테이블 접근성 */
table {
    border-collapse: collapse;
    width: 100%;
}

th {
    background-color: var(--background-light);
    font-weight: 600;
    text-align: left;
    padding: 12px;
}

td {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

/* 모달 접근성 */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* 로딩 상태 표시 */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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