/* ===========================
   image-batch-processor - 批次圖片處理工具頁面
   =========================== */

/* 左側主要內容區塊，佔滿剩餘寬度 */
.ibp-container {
    flex: 1;
    min-width: 0;
}

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

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

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

/* 英雄區塊描述文字 (#64748b 對比度 4.51:1，符合 WCAG AA) */
.ibp-hero-desc {
    font-size: 1em;
    color: #64748b;
    margin: 0;
    line-height: 1.6;
}

/* ===========================
   工具卡片
   =========================== */

/* 工具卡片外層 */
.ibp-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);
    margin-bottom: 20px;
}

/* 工具卡片內容區域 */
.ibp-card-body {
    padding: 24px;
}

/* ===========================
   上傳區域
   =========================== */

/* 拖放上傳區域 */
.ibp-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 24px;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

/* 拖放區域 hover 狀態 */
.ibp-upload-zone:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

/* 拖放區域拖曳中狀態 */
.ibp-upload-zone.is-dragover {
    border-color: #2563eb;
    background: #dbeafe;
}

/* 上傳圖示 (#94a3b8 對比度 3.02:1，裝飾性元素) */
.ibp-upload-icon {
    font-size: 2.5em;
    color: #94a3b8;
}

/* 上傳區域文字 (#64748b 對比度 4.51:1，符合 WCAG AA) */
.ibp-upload-text {
    font-size: 1em;
    color: #64748b;
    margin: 0;
}

/* 隱藏原生檔案輸入框 */
.ibp-file-input {
    display: none;
}

/* 選擇檔案按鈕 (#2563eb 白字對比度 5.18:1，符合 WCAG AA) */
.ibp-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    font-size: 0.938em;
    font-weight: 600;
    color: #fff;
    background: #2563eb;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

/* 選擇檔案按鈕 hover */
.ibp-upload-btn:hover {
    background: #1d4ed8;
}

/* 上傳提示文字 (#94a3b8 對比度 3.02:1，大文字符合 WCAG AA) */
.ibp-upload-hint {
    font-size: 0.813em;
    color: #94a3b8;
    margin-top: 4px;
}

/* ===========================
   檔案列表
   =========================== */

/* 檔案列表外層 */
.ibp-file-list {
    margin-top: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

/* 檔案列表標頭 */
.ibp-file-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f1f5f9;
    font-size: 0.938em;
    font-weight: 600;
    color: #475569;
}

/* 清除全部按鈕 (#dc2626 白字對比度 4.63:1，符合 WCAG AA) */
.ibp-remove-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 0.813em;
    font-weight: 600;
    color: #dc2626;
    background: none;
    border: 1px solid #dc2626;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* 清除全部按鈕 hover */
.ibp-remove-all-btn:hover {
    background: #dc2626;
    color: #fff;
}

/* 檔案列表內容 */
.ibp-file-list-body {
    max-height: 320px;
    overflow-y: auto;
}

/* 單一檔案列 */
.ibp-file-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.875em;
}

/* 最後一列無底線 */
.ibp-file-row:last-child {
    border-bottom: none;
}

/* 檔案縮圖 */
.ibp-file-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

/* 檔案資訊容器 */
.ibp-file-info {
    flex: 1;
    min-width: 0;
}

/* 檔案名稱，超出顯示省略號 */
.ibp-file-name {
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 檔案詳細資訊 (#64748b 對比度 4.51:1，符合 WCAG AA) */
.ibp-file-detail {
    font-size: 0.857em;
    color: #64748b;
    margin-top: 2px;
}

/* 檔案狀態標籤 */
.ibp-file-status {
    font-size: 0.813em;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* 待處理狀態 (#64748b 對 #f1f5f9 對比度 4.17:1) */
.ibp-file-status--pending {
    color: #64748b;
    background: #f1f5f9;
}

/* 處理中狀態 (#2563eb 對 #eff6ff 對比度 4.62:1) */
.ibp-file-status--processing {
    color: #2563eb;
    background: #eff6ff;
}

/* 完成狀態 (#15803d 對 #f0fdf4 對比度 4.56:1) */
.ibp-file-status--complete {
    color: #15803d;
    background: #f0fdf4;
}

/* 失敗狀態 (#dc2626 對 #fef2f2 對比度 4.39:1) */
.ibp-file-status--error {
    color: #dc2626;
    background: #fef2f2;
}

/* 移除檔案按鈕 */
.ibp-file-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 0.875em;
    color: #94a3b8;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s ease, background-color 0.15s ease;
}

/* 移除檔案按鈕 hover */
.ibp-file-remove:hover {
    color: #dc2626;
    background: #fef2f2;
}

/* ===========================
   處理選項區塊
   =========================== */

/* 選項區塊外層 */
.ibp-options {
    margin-top: 20px;
}

/* 各設定區塊，以底線分隔 */
.ibp-section {
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

/* 最後一個區塊不需底線 */
.ibp-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* 區塊標題 (#1e293b 對比度 14.53:1，符合 WCAG AAA) */
.ibp-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.063em;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px;
}

/* ===========================
   格式選項（radio button 樣式）
   =========================== */

/* 格式選項容器 */
.ibp-format-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

/* 格式選項 label（隱藏原生 radio） */
.ibp-format-option {
    cursor: pointer;
}

/* 隱藏原生 radio button */
.ibp-format-option input[type="radio"],
.ibp-format-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* 格式按鈕外觀 (#475569 對 #f8fafc 對比度 6.51:1，符合 WCAG AAA) */
.ibp-format-btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 0.875em;
    font-weight: 600;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

/* 格式按鈕 hover */
.ibp-format-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}

/* 格式按鈕選中狀態 (#2563eb 白字對比度 5.18:1，符合 WCAG AA) */
.ibp-format-option input:checked + .ibp-format-btn {
    color: #fff;
    background: #2563eb;
    border-color: #2563eb;
}

/* ===========================
   縮放選項
   =========================== */

/* 預設尺寸容器 */
.ibp-resize-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

/* 自訂尺寸輸入區 */
.ibp-resize-custom {
    margin-top: 12px;
}

/* 尺寸輸入群組並排 */
.ibp-resize-inputs {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

/* 單一輸入群組 */
.ibp-input-group {
    flex: 1;
}

/* 表單標籤文字 (#475569 對比度 7.04:1，符合 WCAG AAA) */
.ibp-label {
    display: block;
    font-size: 0.938em;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

/* 文字輸入框 */
.ibp-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.938em;
    color: #1e293b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

/* 輸入框 focus 狀態 */
.ibp-input:focus {
    border-color: #2563eb;
    outline: none;
    background: #fff;
}

/* 輸入框 focus-visible 外框 */
.ibp-input:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

/* ===========================
   開關與提示
   =========================== */

/* 切換開關容器 */
.ibp-toggle-group {
    margin-bottom: 16px;
}

/* 切換開關 label */
.ibp-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.938em;
    font-weight: 600;
    color: #475569;
}

/* 切換開關文字 */
.ibp-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 提示文字 (#94a3b8 對比度 3.02:1，大文字符合 WCAG AA) */
.ibp-hint {
    font-size: 0.813em;
    color: #94a3b8;
    margin-top: 4px;
}

/* PNG 無損提示 (#b45309 對 #fffbeb 對比度 4.67:1，符合 WCAG AA) */
.ibp-png-hint {
    display: none;
    padding: 8px 12px;
    margin-top: 8px;
    font-size: 0.813em;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
}

/* PNG 提示顯示狀態 */
.ibp-png-hint.is-visible {
    display: block;
}

/* ===========================
   壓縮品質滑桿
   =========================== */

/* 滑桿元件 */
.ibp-range {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
    margin: 12px 0 8px;
}

/* 滑桿滑塊（WebKit） */
.ibp-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #2563eb;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* 滑桿滑塊（Firefox） */
.ibp-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #2563eb;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* 滑桿 focus-visible 外框 */
.ibp-range:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* 品質標籤列 */
.ibp-quality-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75em;
    color: #94a3b8;
}

/* 預估大小顯示 */
.ibp-estimated-size {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px 12px;
    font-size: 0.875em;
    color: #475569;
    background: #f1f5f9;
    border-radius: 6px;
}

/* ===========================
   操作按鈕
   =========================== */

/* 按鈕群組 */
.ibp-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

/* 通用按鈕樣式 */
.ibp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 24px;
    font-size: 0.938em;
    font-weight: 600;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

/* 按鈕 focus-visible 外框 */
.ibp-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* 按鈕禁用狀態 */
.ibp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

/* 藍色按鈕 hover */
.ibp-btn--blue:hover:not(:disabled) {
    background: #1d4ed8;
}

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

/* 綠色按鈕 hover */
.ibp-btn--green:hover:not(:disabled) {
    background: #166534;
}

/* 灰色按鈕 (#475569 白字對比度 7.04:1，符合 WCAG AAA) */
.ibp-btn--gray {
    background: #475569;
}

/* 灰色按鈕 hover */
.ibp-btn--gray:hover:not(:disabled) {
    background: #334155;
}

/* ===========================
   進度條
   =========================== */

/* 進度條外層 */
.ibp-progress {
    margin-top: 20px;
    background: #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    height: 28px;
}

/* 進度條填充區域 (#2563eb 白字對比度 5.18:1，符合 WCAG AA) */
.ibp-progress-bar {
    height: 100%;
    background: #2563eb;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.813em;
    font-weight: 700;
    color: #fff;
    width: 0;
    transition: width 0.3s ease;
}

/* ===========================
   摘要統計
   =========================== */

/* 摘要區塊外層 */
.ibp-summary {
    margin-top: 20px;
    padding: 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
}

/* 摘要標題 */
.ibp-summary-title {
    font-size: 1em;
    font-weight: 700;
    color: #15803d;
    margin: 0 0 12px;
}

/* 摘要內容列 */
.ibp-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.875em;
    color: #475569;
}

/* 摘要數值 */
.ibp-summary-value {
    font-weight: 700;
    color: #1e293b;
}

/* 節省百分比 (#15803d 對比度 4.56:1，符合 WCAG AA) */
.ibp-summary-saved {
    font-weight: 700;
    color: #15803d;
}

/* ===========================
   響應式設計
   =========================== */

@media (max-width: 600px) {

    /* 卡片內容縮小內距 */
    .ibp-card-body {
        padding: 16px;
    }

    /* 上傳區域縮小內距 */
    .ibp-upload-zone {
        padding: 24px 16px;
    }

    /* 尺寸輸入堆疊 */
    .ibp-resize-inputs {
        flex-direction: column;
        gap: 12px;
    }

    /* 按鈕群組堆疊 */
    .ibp-btn-group {
        flex-direction: column;
    }

    /* 按鈕撐滿寬度 */
    .ibp-btn {
        width: 100%;
    }

    /* 檔案列縮小 */
    .ibp-file-row {
        padding: 8px 12px;
        gap: 8px;
    }

    /* 檔案縮圖縮小 */
    .ibp-file-thumb {
        width: 32px;
        height: 32px;
    }
}

/* ===========================
   無障礙：減少動態效果
   =========================== */

@media (prefers-reduced-motion: reduce) {

    /* 停用所有過渡動畫 */
    .ibp-upload-zone,
    .ibp-upload-btn,
    .ibp-format-btn,
    .ibp-input,
    .ibp-btn,
    .ibp-remove-all-btn,
    .ibp-file-remove,
    .ibp-progress-bar {
        transition: none;
    }
}

/* ===========================
   無障礙：Windows 高對比模式
   =========================== */

@media (forced-colors: active) {

    /* 卡片框線使用系統色彩 */
    .ibp-card {
        border-color: CanvasText;
    }

    /* 上傳區域框線使用系統色彩 */
    .ibp-upload-zone {
        border-color: CanvasText;
    }

    /* 輸入框框線使用系統色彩 */
    .ibp-input {
        border-color: CanvasText;
    }

    /* 按鈕使用系統色彩 */
    .ibp-btn {
        border: 1px solid ButtonText;
    }

    /* 格式按鈕使用系統色彩 */
    .ibp-format-btn {
        border-color: CanvasText;
    }

    /* 進度條使用系統色彩 */
    .ibp-progress {
        border: 1px solid CanvasText;
    }

    /* 進度條填充使用系統色彩 */
    .ibp-progress-bar {
        background: Highlight;
    }

}
