/* ===========================
   timestamp - 時間戳工具頁面
   =========================== */

/* 時間戳工具外層容器 */
.ts-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

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

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

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

/* 英雄區塊副標題 (原 #94a3b8 對比度不足 2.43:1，改用 #64748b 達 4.51:1) */
.ts-hero-subtitle {
    font-size: 1.063em;
    color: #64748b;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0 0 16px;
}

/* SEO 說明文字 */
.seo-desc {
    color: #64748b;
    line-height: 1.7;
    margin-bottom: 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    font-size: 1em;
}

/* 即時時間顯示列 */
.ts-live-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

/* 即時時間顯示項目 (原 #4a6cf7 白字對比度 4.39:1 不足，改用 #3b5ce0 達 5.61:1) */
.ts-live-item {
    flex: 1;
    min-width: 220px;
    background: #3b5ce0;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* 「目前日期時間」使用綠色背景，與「轉換為時間戳」按鈕一致 (#15803d 白字對比度 5.09:1) */
.ts-live-item--green {
    background: #15803d;
}

/* 即時時間標籤文字 (原 rgba 0.8 透明度對比度 3.41:1 不足，改用純白達 5.61:1) */
.ts-live-label {
    font-size: 0.938em;
    color: #fff;
    font-weight: 500;
}

/* 即時時間數值 */
.ts-live-value {
    font-size: 1.5em;
    font-weight: 700;
    color: #fff;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    letter-spacing: 0.5px;
}

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

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

/* 轉換卡片 */
.ts-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;
}

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

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

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

/* 藍色圖示背景（時間戳轉日期） */
.ts-card-icon--blue {
    background: #eff6ff;
    color: #3b82f6;
}

/* 綠色圖示背景 (原 #22c55e 對比度 2.18:1，改用 #16a34a 達 3.20:1 符合 UI 元件門檻) */
.ts-card-icon--green {
    background: #f0fdf4;
    color: #16a34a;
}

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

/* 卡片副標題 (原 #94a3b8 對比度不足 2.47:1，改用 #64748b 達 4.51:1) */
.ts-card-desc {
    font-size: 0.938em;
    color: #64748b;
    margin: 2px 0 0;
}

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

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

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

/* 輸入框外層包裹（含左側圖示） */
.ts-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

/* 輸入框左側圖示 (原 #94a3b8 對比度不足 2.56:1，改用 #64748b 達 4.51:1 符合 UI 元件 3:1 門檻) */
.ts-input-icon {
    position: absolute;
    left: 12px;
    color: #64748b;
    font-size: 1em;
    pointer-events: none;
    z-index: 1;
}

/* 輸入框與下拉選單共用樣式 (原邊框 #e2e8f0 對比度 1.23:1，改用 #8b95a5 達 3.05:1 符合 UI 元件門檻) */
.ts-input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    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;
}

/* 輸入框聚焦時的藍色邊框 (加深邊框色與光暈透明度以提升可見度) */
.ts-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* 搭配日曆按鈕的輸入框，右側保留按鈕空間 */
.ts-input--with-picker {
    padding-right: 44px;
}

/* 隱藏的 datetime-local 選擇器，僅用於觸發瀏覽器原生日曆 */
.ts-hidden-picker {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

/* 日曆選取按鈕，位於輸入框右側 */
.ts-picker-btn {
    position: absolute;
    right: 1px;
    top: 1px;
    bottom: 1px;
    width: 40px;
    border: none;
    background: #f1f5f9;
    border-left: 1px solid #8b95a5;
    border-radius: 0 7px 7px 0;
    color: #475569;
    font-size: 1.063em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* 日曆按鈕懸停效果 */
.ts-picker-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* 日曆按鈕鍵盤聚焦指示 (WCAG 2.4.7) */
.ts-picker-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

/* 下拉選單外觀微調 */
.ts-select {
    appearance: auto;
    cursor: pointer;
}

/* 輸入框下方提示文字 (原 #94a3b8 對比度不足 2.56:1，改用 #64748b 達 4.51:1) */
.ts-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.813em;
    color: #64748b;
}

/* 轉換按鈕基礎樣式 */
.ts-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;
}

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

/* 藍色按鈕 (原 #3b82f6 白字對比度 3.68:1 不足，改用 #2563eb 達 5.18:1) */
.ts-btn--blue {
    background: #2563eb;
}
.ts-btn--blue:hover {
    background: #1d4ed8;
}

/* 綠色按鈕 (原 #22c55e 白字對比度僅 2.28:1，改用 #15803d 達 5.09:1) */
.ts-btn--green {
    background: #15803d;
}
.ts-btn--green:hover {
    background: #166534;
}

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

/* 結果區每一行 */
.ts-result-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 10px;
}

/* 結果行之間的分隔線 */
.ts-result-row + .ts-result-row {
    border-top: 1px solid #e2e8f0;
}

/* 結果標籤 */
.ts-result-label {
    font-size: 0.813em;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    min-width: 70px;
}

/* 結果數值 */
.ts-result-value {
    flex: 1;
    font-size: 1em;
    color: #1e293b;
    font-weight: 500;
    word-break: break-all;
}

/* 等寬字型的結果數值（用於數字） */
.ts-result-mono {
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

/* 結果列的複製按鈕 (原邊框 #e2e8f0 對比度不足，改用 #8b95a5 達 3.05:1；加大 padding 確保觸控目標 ≥ 24x24px，符合 WCAG 2.5.8) */
.ts-copy-btn {
    background: none;
    border: 1px solid #8b95a5;
    border-radius: 6px;
    padding: 8px 14px;
    color: #475569;
    cursor: pointer;
    font-size: 0.938em;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 36px; /* 確保觸控目標足夠大 */
}

/* 複製按鈕懸停效果 */
.ts-copy-btn:hover {
    background: #f1f5f9;
    border-color: #64748b;
    color: #1e293b;
}

/* 結果錯誤訊息 */
.ts-result-error {
    padding: 12px 16px;
    color: #dc2626;
    font-size: 1em;
}

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

/* 複製按鈕鍵盤聚焦指示 */
.ts-copy-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 1px;
}

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

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

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

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

    .ts-btn:focus-visible,
    .ts-copy-btn:focus-visible,
    .ts-picker-btn:focus-visible {
        outline-color: Highlight;
    }

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