/* ===========================
   url-encoder-decoder - URL 編碼解碼工具頁面
   =========================== */

/* URL 編碼解碼工具外層容器 */
.ue-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

/* 頁面頂部英雄區塊 */
.ue-hero {
    text-align: center;
    padding: 10px 0 30px;
}

/* 英雄區塊的連結圖示 */
.ue-hero-icon {
    font-size: 3.25em;
    color: #4a6cf7;
    margin-bottom: 12px;
}

/* 英雄區塊主標題 */
.ue-hero-title {
    font-size: 2.25em;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px;
}

/* 英雄區塊副標題 (#64748b 對比度 4.51:1，符合 WCAG AA) */
.ue-hero-subtitle {
    font-size: 1.063em;
    color: #64748b;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0 0 16px;
}

/* 雙欄卡片格線佈局 */
.ue-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* 小螢幕時改為單欄 */
@media (max-width: 768px) {
    .ue-grid {
        grid-template-columns: 1fr;
    }
}

/* 轉換卡片 */
.ue-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.2s ease;
}

/* 卡片滑鼠懸停時加深陰影 */
.ue-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.06), 0 10px 24px rgba(0, 0, 0, 0.06);
}

/* 卡片標題列 */
.ue-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafbfc;
}

/* 卡片標題列的方向圖示 */
.ue-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25em;
    flex-shrink: 0;
}

/* 藍色圖示背景（URL 編碼） */
.ue-card-icon--blue {
    background: #eff6ff;
    color: #3b82f6;
}

/* 綠色圖示背景（URL 解碼） (#16a34a 對比度 3.20:1，符合 UI 元件門檻) */
.ue-card-icon--green {
    background: #f0fdf4;
    color: #16a34a;
}

/* 卡片標題文字 */
.ue-card-title {
    font-size: 1.188em;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    line-height: 1.3;
}

/* 卡片副標題 (#64748b 對比度 4.51:1，符合 WCAG AA) */
.ue-card-desc {
    font-size: 0.938em;
    color: #64748b;
    margin: 2px 0 0;
}

/* 卡片內容區域 */
.ue-card-body {
    padding: 20px 24px 24px;
}

/* 表單欄位群組 */
.ue-form-group {
    margin-bottom: 16px;
}

/* 表單標籤 */
.ue-label {
    display: block;
    font-size: 0.938em;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

/* 多行文字輸入框外層包裹 */
.ue-textarea-wrap {
    position: relative;
}

/* 多行文字輸入框 (邊框 #8b95a5 對比度 3.05:1，符合 UI 元件門檻) */
.ue-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #8b95a5;
    border-radius: 8px;
    font-size: 1em;
    color: #1e293b;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
    box-sizing: border-box;
    resize: vertical;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    line-height: 1.6;
}

/* 輸入框聚焦時的藍色邊框 */
.ue-textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* 輸入框下方提示文字 (#64748b 對比度 4.51:1，符合 WCAG AA) */
.ue-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.813em;
    color: #64748b;
}

/* 單選按鈕群組 */
.ue-radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 單選按鈕標籤（可點擊區域） */
.ue-radio-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

/* 單選按鈕標籤懸停效果 */
.ue-radio-label:hover {
    border-color: #3b82f6;
    background: #f8fafc;
}

/* 原生單選按鈕樣式微調 */
.ue-radio {
    margin-top: 3px;
    flex-shrink: 0;
    accent-color: #2563eb;
}

/* 單選按鈕文字區域 */
.ue-radio-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* 單選按鈕主要文字 */
.ue-radio-text strong {
    font-size: 0.938em;
    font-weight: 600;
    color: #1e293b;
}

/* 單選按鈕說明文字 (#64748b 對比度 4.51:1，符合 WCAG AA) */
.ue-radio-text small {
    font-size: 0.813em;
    color: #64748b;
    line-height: 1.4;
}

/* 轉換按鈕基礎樣式 */
.ue-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
    width: 100%;
    justify-content: center;
}

/* 按鈕點擊時的按壓效果 */
.ue-btn:active {
    transform: scale(0.98);
}

/* 藍色按鈕 (#2563eb 白字對比度 5.18:1，符合 WCAG AA) */
.ue-btn--blue {
    background: #2563eb;
}
.ue-btn--blue:hover {
    background: #1d4ed8;
}

/* 綠色按鈕 (#15803d 白字對比度 5.09:1，符合 WCAG AA) */
.ue-btn--green {
    background: #15803d;
}
.ue-btn--green:hover {
    background: #166534;
}

/* 轉換結果容器 */
.ue-result {
    margin-top: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

/* 結果區標題列 */
.ue-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid #e2e8f0;
    background: #f1f5f9;
}

/* 結果標籤 */
.ue-result-label {
    font-size: 0.813em;
    font-weight: 600;
    color: #64748b;
}

/* 結果操作按鈕群組 */
.ue-result-actions {
    display: flex;
    gap: 6px;
}

/* 結果操作按鈕 (邊框 #8b95a5 對比度 3.05:1，符合 UI 元件門檻；min-height 36px 確保觸控目標符合 WCAG 2.5.8) */
.ue-action-btn {
    background: #fff;
    border: 1px solid #8b95a5;
    border-radius: 6px;
    padding: 6px 12px;
    color: #475569;
    cursor: pointer;
    font-size: 0.813em;
    font-weight: 500;
    transition: all 0.15s ease;
    white-space: nowrap;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 操作按鈕懸停效果 */
.ue-action-btn:hover {
    background: #f1f5f9;
    border-color: #64748b;
    color: #1e293b;
}

/* 危險操作按鈕（清除）懸停效果 */
.ue-action-btn--danger:hover {
    background: #fef2f2;
    border-color: #dc2626;
    color: #dc2626;
}

/* 結果內容區域 */
.ue-result-body {
    padding: 12px 16px;
}

/* 結果文字（使用等寬字型方便閱讀編碼字串） */
.ue-result-text {
    margin: 0;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.938em;
    color: #1e293b;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

/* 結果錯誤訊息 */
.ue-result-error {
    color: #dc2626;
    font-family: inherit;
    font-size: 1em;
}

/* 轉換按鈕鍵盤聚焦指示 (WCAG 2.4.7 Focus Visible) */
.ue-btn:focus-visible {
    outline: 2px solid #1e293b;
    outline-offset: 2px;
}

/* 操作按鈕鍵盤聚焦指示 */
.ue-action-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 1px;
}

/* 多行輸入框鍵盤聚焦指示 */
.ue-textarea:focus-visible {
    outline: none;
}

/* 單選按鈕鍵盤聚焦指示 */
.ue-radio:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* 尊重使用者減少動態效果的偏好設定 (WCAG 2.3.3 Animation from Interactions) */
@media (prefers-reduced-motion: reduce) {
    .ue-card,
    .ue-btn,
    .ue-textarea,
    .ue-action-btn,
    .ue-radio-label {
        transition: none;
    }
}

/* Windows 高對比模式支援，確保邊框與聚焦指示在強制色彩下仍可見 */
@media (forced-colors: active) {
    /* 輸入框邊框改用系統邊框色 */
    .ue-textarea {
        border-color: ButtonText;
    }

    /* 聚焦時使用系統高亮色 */
    .ue-textarea:focus {
        border-color: Highlight;
        box-shadow: none;
    }

    /* 按鈕在高對比模式下保持可見邊框 */
    .ue-btn {
        border: 2px solid ButtonText;
    }

    .ue-btn:focus-visible,
    .ue-action-btn:focus-visible {
        outline-color: Highlight;
    }

    /* 卡片邊框確保在高對比模式下可見 */
    .ue-card {
        border-color: CanvasText;
    }

    /* 單選按鈕標籤在高對比模式下的邊框 */
    .ue-radio-label {
        border-color: ButtonText;
    }
}
