/* 高齡者友善無障礙樣式 - Accessibility Styles for Elderly Users */

/* CSS 變數 - 字體大小縮放 */
:root {
    /* 基礎字體大小 (預設為大字體，適合高齡者) */
    --font-scale: 1.1;

    /* 字體大小變數 */
    --font-xs: calc(14px * var(--font-scale));
    --font-sm: calc(16px * var(--font-scale));
    --font-base: calc(18px * var(--font-scale));
    --font-lg: calc(20px * var(--font-scale));
    --font-xl: calc(24px * var(--font-scale));
    --font-2xl: calc(28px * var(--font-scale));
    --font-3xl: calc(32px * var(--font-scale));
    --font-4xl: calc(36px * var(--font-scale));

    /* 行高 */
    --line-height-tight: 1.4;
    --line-height-normal: 1.7;
    --line-height-relaxed: 1.9;

    /* 最小觸控區域 */
    --min-touch-target: 48px;
}

/* 字體大小等級 */
html.font-size-normal {
    --font-scale: 1;
}

html.font-size-large {
    --font-scale: 1.15;
}

html.font-size-xlarge {
    --font-scale: 1.3;
}

/* 字體大小控制 - 整合到 Header */
.font-size-controls {
    display: flex;
    gap: 4px;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    padding: 4px;
    border-radius: 6px;
}

.font-size-btn {
    background: transparent;
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}

.font-size-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
}

.font-size-btn.active {
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
}

.font-size-btn[data-size="normal"] {
    font-size: 13px;
}

.font-size-btn[data-size="large"] {
    font-size: 16px;
}

.font-size-btn[data-size="xlarge"] {
    font-size: 19px;
}

/* 字體大小標籤 - 隱藏文字，只顯示圖示 */
.font-size-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    margin-right: 6px;
    display: none;
}

@media (min-width: 600px) {
    .font-size-label {
        display: block;
    }
}

/* 高對比度連結 */
a {
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

/* 確保所有可點擊元素有足夠的觸控區域 */
button,
.btn,
.nav-link,
.nav-button,
.quick-link,
.download-button,
.tab {
    min-height: var(--min-touch-target);
    padding-top: 12px;
    padding-bottom: 12px;
}

/* 表格文字大小 */
table {
    font-size: var(--font-base);
}

th, td {
    padding: 15px 12px;
    line-height: var(--line-height-normal);
}

/* 響應式字體控制 */
@media (max-width: 480px) {
    .font-size-controls {
        padding: 3px;
        gap: 2px;
    }

    .font-size-btn {
        padding: 5px 8px;
        min-width: 32px;
        min-height: 32px;
    }

    .font-size-btn[data-size="normal"] {
        font-size: 12px;
    }

    .font-size-btn[data-size="large"] {
        font-size: 14px;
    }

    .font-size-btn[data-size="xlarge"] {
        font-size: 16px;
    }
}

/* 列印樣式 - 恢復正常字體 */
@media print {
    :root {
        --font-scale: 1;
    }

    .accessibility-bar {
        display: none;
    }
}
