/* 無障礙輔助樣式 */

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

/* 確保所有互動元素都有適當的焦點指示器 */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* 確保連結有適當的顏色對比 */
a {
    color: #007bff;
    text-decoration: underline;
}

a:hover,
a:focus {
    color: #0056b3;
    text-decoration: underline;
}

/* 確保表單標籤與控制元件的關聯 */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

/* 確保錯誤訊息有適當的樣式 */
.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* 確保成功訊息有適當的樣式 */
.success-message {
    color: #28a745;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* 確保跳過連結可見 */
.accessibility a {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.accessibility a:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 10px;
    background: #000;
    color: #fff;
    text-decoration: none;
    z-index: 9999;
}

/* 隱藏空的連結元素 */
a:empty {
    display: none !important;
}

/* 確保有title但沒有文字內容的連結有適當的樣式 */
a[title]:empty::after {
    content: attr(title);
    display: inline;
    color: #007bff;
    text-decoration: underline;
}
