/* ========================================
   ========== 變數設定 (CSS Variables) ==========
   ======================================== */
:root {
    --primary: #2d89ef; /* 主要按鈕／標題色 */
    --danger: #e81123; /* 危險／刪除按鈕色 */
    --bg: #fafafa; /* 卡片背景色 */
    --text: #333; /* 文字主色 */
}

/* ========================================
   ========== 全域樣式 (Global Styles) ==========
   ======================================== */
body {
    margin: 0;
    padding: 0;
    font-family: '微軟正黑體', sans-serif;
    background: #f0f0f0;
    color: var(--text);
}

/* ========================================
   ========== 容器 Container ==========
   ======================================== */
.container {
    width: 90%;
    max-width: 900px;
    margin: 20px auto;
}

/* ========================================
   ========== 標題 Headings ==========
   ======================================== */
h1 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 1rem; /* 與下方內容保持間距 */
}

/* ========================================
   ========== 卡片 Card ==========
   ======================================== */
.card {
    background: var(--bg);
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* ========================================
   ========== 表單 Form 控制項 ==========
   ======================================== */
input,
select,
.form-control {
    box-sizing: border-box;
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

/* ========================================
   ========== 按鈕 Buttons ==========
   ======================================== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: var(--primary); /* 預設主色 */
    color: #fff;
    font-size: 1rem;
    text-align: center;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.btn-danger {
    background: var(--danger);
}
/* 隱藏類別 */
.hidden {
    display: none !important;
}

/* 成功（綠色）按鈕群 */
.btn.success,
#btnLoad,
#btnReupload {
    background: #28a745; /* 成功的綠色 */
    color: #fff;
}

    .btn.success:hover,
    #btnLoad:hover,
    #btnReupload:hover {
        background: #218838; /* 深綠 hover */
    }

/* 危險（紅色）刪除按鈕 */
.btn.danger {
    background: var(--danger) !important;
}

    .btn.danger:hover {
        background: #c50f1f; /* 深紅 hover */
    }

/* ========================================
   ========== 縮圖格 Thumb Grid ==========
   ======================================== */
.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.thumb-card {
    background: #fff;
    padding: 10px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

    .thumb-card img {
        width: 100%;
        height: 140px;
        object-fit: contain;
        margin-bottom: 10px;
    }

/* ========================================
   ========== 補傳區 Reupload ==========
   ======================================== */
/* 補傳按鈕群上下間隔 */
#btnReupload {
    margin-bottom: 1rem; /* 你想要的數值 */
}

#reuploadControls .bulk-buttons {
    margin-top: 0.5rem; /* 讓「全部霧面/全部亮面」下移 */
}
/* 新縮圖：固定高度＋內部滾動 */
#thumbsContainerRe {
    height: 300px; /* 可依需求微調 */
    overflow-y: auto;
}

/* ========================================
   ========== 模態視窗 Modal (如有) ==========
   ======================================== */
.modal {
    /* 如有使用，可在此加入樣式 */
}

/* ========================================
   ========== 手機響應式優化 (≤600px) ==========
   ======================================== */
@media (max-width: 600px) {
    /* 一欄縮圖 */
    .thumb-grid {
        grid-template-columns: 1fr;
    }

    /* 容器邊距縮小 */
    .container {
        width: 95%;
        margin: 10px auto;
    }

    /* 標題字級稍微縮小 */
    h1 {
        font-size: 1.25rem;
    }

    /* 卡片內距調整 */
    .card {
        padding: 15px;
    }

    /* 表單輸入框與按鈕字級與內距優化 */
    input,
    select,
    .form-control {
        font-size: 1.125rem;
        padding: 10px;
    }

    /* 按鈕寬度撐滿、增加點擊區 */
    .btn {
        display: block;
        width: 100%;
        padding: 12px 0;
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
        /* 如果不想最後一顆按鈕多餘下邊距，可加上這行 */
        .btn:last-child {
            margin-bottom: 0;
        }

    /* 縮圖卡片內圖片高度自動調整 */
    .thumb-card img {
        height: auto;
        max-height: 200px;
    }

}
/* 按鈕小轉圈 (loading) */
@keyframes btn-spinner {
    to {
        transform: rotate(360deg);
    }
}

.btn.loading {
    position: relative;
    pointer-events: none; /* 按鈕鎖住，避免重複點 */
    color: transparent !important; /* 隱藏文字 */
}

    .btn.loading::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 16px;
        height: 16px;
        margin: -8px 0 0 -8px;
        border: 2px solid #fff;
        border-top-color: rgba(255,255,255,0.5);
        border-radius: 50%;
        animation: btn-spinner 0.6s linear infinite;
    }
/* 管理區：鎖定狀態下，霧面選項顯示紅色 */
.thumb-card select[disabled] {
    color: #6c757d; /* 預設灰色 */
}

    .thumb-card select[disabled].matte-locked {
        color: red !important; /* 霧面強制紅色 */
    }

/* 縮圖區外框：steps 2 上傳和補傳都套用 */
#thumbsContainer,
#thumbsContainerRe {
    /* 你要的外框樣式 */
    border: 1px solid #ccc;
    padding: 8px; /* 讓裡面的卡片不要貼到邊 */
    border-radius: 6px; /* 圓角，可自由調整 */
}
/* ============================
   外部瀏覽器提示 Modal
   ============================ */
#externalBrowserModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    display: flex; /* 預設 flex 以便顯示時置中 */
}

    #externalBrowserModal .modal-content {
        background: #fff;
        padding: 1.5rem;
        border-radius: 8px;
        max-width: 90%;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        text-align: center;
    }

        #externalBrowserModal .modal-content p {
            margin: 0 0 1rem;
            font-size: 1rem;
            color: var(--text);
        }

        #externalBrowserModal .modal-content button {
            display: inline-block;
            padding: 0.6rem 1.2rem;
            font-size: 1rem;
            background: var(--primary);
            color: #fff;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }

            #externalBrowserModal .modal-content button:hover {
                background: #1b5faa; /* 深一階主色 */
            }

@media (max-width: 600px) {
    /* 取消固定隱藏，讓 JS 決定 show/hide */
    #externalBrowserModal {
        /* 不要 display:none 這行 */
        flex-direction: column;
    }
}

