/* 定義品牌主題色 */
:root {
    --primary-color: #16a085; /* Hiraya Teal 藍綠色 */
    --secondary-color: #2c3e50; /* Slate Blue 深藍灰色 */
    --bg-color: #f4f7f6;
    --text-color: #333;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
}

body { 
    background-color: var(--bg-color); 
    color: var(--text-color); 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
}

/* 導覽列 Navbar 設計 */
.navbar { 
    background-color: white; 
    padding: 15px 30px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); 
}

/* 已經整合：Logo 圖片尺寸安全控制，防止跑版 */
.logo-img {
    height: 40px; 
    width: auto;  
    display: block;
}

#lang-toggle { 
    background: none; 
    border: 1px solid #ccc; 
    padding: 8px 15px; 
    border-radius: 5px; 
    cursor: pointer; 
    color: var(--secondary-color); 
    font-weight: bold; 
    transition: 0.3s; 
}
#lang-toggle:hover { 
    background: var(--secondary-color); 
    color: white; 
}

/* 登入卡片設計 */
.login-container { 
    flex: 1; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    padding: 20px; 
}
.login-card { 
    background: white; 
    padding: 40px; 
    border-radius: 10px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
    width: 100%; 
    max-width: 400px; 
    text-align: center; 
}
.login-card h2 { 
    color: var(--secondary-color); 
    margin-bottom: 5px; 
}
.login-card p { 
    color: #666; 
    margin-bottom: 25px; 
    font-size: 14px; 
}

.input-group { 
    text-align: left; 
    margin-bottom: 20px; 
}
.input-group label { 
    display: block; 
    margin-bottom: 5px; 
    font-size: 14px; 
    font-weight: bold; 
}
.input-group input { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #ccc; 
    border-radius: 5px; 
    font-size: 16px; 
    outline: none; 
}
.input-group input:focus { 
    border-color: var(--primary-color); 
}

.btn-primary { 
    width: 100%; 
    background: var(--primary-color); 
    color: white; 
    padding: 12px; 
    border: none; 
    border-radius: 5px; 
    font-size: 16px; 
    font-weight: bold; 
    cursor: pointer; 
    transition: 0.3s; 
}
.btn-primary:hover { 
    background: #13876f; 
}

/* 提示訊息與頁尾 */
.message-box { 
    margin-top: 15px; 
    font-size: 14px; 
    color: red; 
    font-weight: bold; 
}
.footer { 
    background: var(--secondary-color); 
    color: white; 
    text-align: center; 
    padding: 15px; 
    font-size: 13px; 
}
.footer p { 
    margin: 5px 0; 
}

/* ================= 後台專屬 UI 設計 ================= */

/* 後台導覽與下拉選單 */
.portal-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; background: white; padding: 15px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.portal-nav h3 { color: var(--primary-color); }

.dropdown { position: relative; display: inline-block; }
.dropbtn { background-color: var(--secondary-color); color: white; padding: 10px 20px; font-size: 14px; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; }
.dropdown-content { display: none; position: absolute; right: 0; background-color: #f9f9f9; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; border-radius: 5px; overflow: hidden; }
.dropdown-content a { color: #333; padding: 12px 16px; text-decoration: none; display: block; font-size: 14px; font-weight: bold; border-bottom: 1px solid #eee; cursor: pointer; }
.dropdown-content a:hover { background-color: #e9e9e9; color: var(--primary-color); }
.dropdown:hover .dropdown-content { display: block; }

/* 表單雙欄式排版 (Grid) */
.portal-section { background: white; padding: 30px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); animation: fadeIn 0.5s ease-in-out; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 20px; }
.form-section-title { grid-column: span 2; font-size: 18px; font-weight: bold; color: var(--secondary-color); margin-top: 15px; border-bottom: 2px solid var(--primary-color); padding-bottom: 5px; }

/* 響應式設計：手機版自動變單欄 */
@media (max-width: 600px) {
    .profile-grid { grid-template-columns: 1fr; }
    .form-section-title, .input-group[style*="span 2"], .btn-primary[style*="span 2"] { grid-column: span 1 !important; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ================= 上傳卡片專屬樣式 ================= */
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.upload-card { background: #fafafa; border: 1px solid #e0e0e0; border-radius: 8px; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; transition: 0.3s; }
.upload-card:hover { border-color: var(--primary-color); background: white; box-shadow: 0 4px 10px rgba(0,0,0,0.03); }

.card-info h4 { color: var(--secondary-color); font-size: 15px; margin-bottom: 5px; }
.card-info small { color: #888; font-weight: normal; }

/* 狀態標籤 */
.file-status { font-size: 12px; font-weight: bold; padding: 2px 8px; border-radius: 12px; display: inline-block; }
.status-none { background: #eee; color: #777; }
.status-done { background: #e8f8f5; color: #27ae60; }

/* 隱藏原生檔案按鈕，美化自訂標籤 */
.card-action input[type="file"] { display: none; }
.btn-upload { background: white; border: 1px solid var(--primary-color); color: var(--primary-color); padding: 8px 16px; border-radius: 5px; font-size: 13px; font-weight: bold; cursor: pointer; display: inline-block; transition: 0.3s; }
.btn-upload:hover { background: var(--primary-color); color: white; }

/* 手機版自動改單欄 */
@media (max-width: 768px) {
    .upload-grid { grid-template-columns: 1fr; }
}

/* 進度查詢專屬樣式 */
.progress-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #eee; padding-bottom: 15px; margin-bottom: 20px; }
.badge-id { background: var(--secondary-color); color: white; padding: 5px 12px; border-radius: 20px; font-weight: bold; font-size: 14px; }

.info-card { background: #f9f9f9; padding: 20px; border-radius: 8px; margin-bottom: 25px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 14px; }

.sub-title { font-size: 18px; color: var(--secondary-color); margin: 25px 0 15px; border-left: 5px solid var(--primary-color); padding-left: 10px; }

.progress-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 14px; }
.progress-table th { background: #f2f2f2; padding: 12px; text-align: left; border-bottom: 2px solid #ddd; }
.progress-table td { padding: 12px; border-bottom: 1px solid #eee; }

.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; }
.status-item { background: white; border: 1px solid #eee; padding: 12px; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; }
.status-item label { font-size: 13px; color: #666; font-weight: bold; }
.status-val { font-size: 13px; font-weight: bold; color: var(--primary-color); }

.refresh-note { font-size: 12px; color: #999; margin-top: 30px; font-style: italic; text-align: center; }

/* 彈跳視窗樣式 */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; }

/* ================= 管理員專屬樣式 ================= */
.tab-buttons { display: flex; border-bottom: 2px solid #ddd; margin-bottom: 20px; }
.tab-btn { background: none; border: none; padding: 10px 20px; cursor: pointer; font-size: 15px; font-weight: bold; color: #777; transition: 0.3s; }
.tab-btn:hover { color: var(--primary-color); }
.tab-btn.active { color: var(--primary-color); border-bottom: 3px solid var(--primary-color); }
.tab-content { animation: fadeIn 0.3s; }

.input-styled { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; margin-top: 5px; font-size: 14px; outline: none; }
.input-styled:focus { border-color: var(--primary-color); }
.btn-action { background: var(--primary-color); color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: bold; }
.btn-action:hover { background: #13876f; }

/* 僅補上需要新增修改的 CSS，其餘可以保留您原本的 */
:root { --primary-color: #16a085; --secondary-color: #2c3e50; --bg-color: #f4f7f6; --text-color: #333; }
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: var(--bg-color); color: var(--text-color); display: flex; flex-direction: column; min-height: 100vh; }

.navbar { background-color: white; padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }

/* ✨ 最佳 Logo 設定 */
.logo-img { height: 48px; width: auto; display: block; transition: transform 0.3s ease; }
.logo-img:hover { transform: scale(1.05); }

#lang-toggle { background: none; border: 1px solid #ccc; padding: 8px 15px; border-radius: 5px; cursor: pointer; color: var(--secondary-color); font-weight: bold; transition: 0.3s; }
#lang-toggle:hover { background: var(--secondary-color); color: white; }

/* 登入區與彈窗 */
.login-container { flex: 1; display: flex; justify-content: center; align-items: center; padding: 20px; }
.login-card { background: white; padding: 40px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); width: 100%; max-width: 400px; text-align: center; }
.login-card h2 { color: var(--secondary-color); margin-bottom: 5px; }
.login-card p { color: #666; margin-bottom: 25px; font-size: 14px; }
.input-group { text-align: left; margin-bottom: 20px; }
.input-group label { display: block; margin-bottom: 5px; font-size: 14px; font-weight: bold; }
.input-group input { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 16px; outline: none; }
.input-group input:focus { border-color: var(--primary-color); }
.btn-primary { width: 100%; background: var(--primary-color); color: white; padding: 12px; border: none; border-radius: 5px; font-size: 16px; font-weight: bold; cursor: pointer; transition: 0.3s; }
.btn-primary:hover { background: #13876f; }
.message-box { margin-top: 15px; font-size: 14px; color: red; font-weight: bold; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; }

/* 後台 UI 共用 */
.portal-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; background: white; padding: 15px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.portal-nav h3 { color: var(--primary-color); }
.dropdown { position: relative; display: inline-block; }
.dropbtn { background-color: var(--secondary-color); color: white; padding: 10px 20px; font-size: 14px; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; }
.dropdown-content { display: none; position: absolute; right: 0; background-color: #f9f9f9; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; border-radius: 5px; overflow: hidden; }
.dropdown-content a { color: #333; padding: 12px 16px; text-decoration: none; display: block; font-size: 14px; font-weight: bold; border-bottom: 1px solid #eee; cursor: pointer; }
.dropdown-content a:hover { background-color: #e9e9e9; color: var(--primary-color); }
.dropdown:hover .dropdown-content { display: block; }
.portal-section { background: white; padding: 30px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); animation: fadeIn 0.5s ease-in-out; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 20px; }
.form-section-title { grid-column: span 2; font-size: 18px; font-weight: bold; color: var(--secondary-color); margin-top: 15px; border-bottom: 2px solid var(--primary-color); padding-bottom: 5px; }

/* 檔案上傳 */
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.upload-card { background: #fafafa; border: 1px solid #e0e0e0; border-radius: 8px; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; transition: 0.3s; }
.upload-card:hover { border-color: var(--primary-color); background: white; box-shadow: 0 4px 10px rgba(0,0,0,0.03); }
.card-info h4 { color: var(--secondary-color); font-size: 15px; margin-bottom: 5px; }
.file-status { font-size: 12px; font-weight: bold; padding: 2px 8px; border-radius: 12px; display: inline-block; }
.status-none { background: #eee; color: #777; }
.status-done { background: #e8f8f5; color: #27ae60; }
.card-action input[type="file"] { display: none; }
.btn-upload { background: white; border: 1px solid var(--primary-color); color: var(--primary-color); padding: 8px 16px; border-radius: 5px; font-size: 13px; font-weight: bold; cursor: pointer; display: inline-block; transition: 0.3s; }
.btn-upload:hover { background: var(--primary-color); color: white; }

/* 進度與管理員表格 */
.progress-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #eee; padding-bottom: 15px; margin-bottom: 20px; }
.badge-id { background: var(--secondary-color); color: white; padding: 5px 12px; border-radius: 20px; font-weight: bold; font-size: 14px; }
.info-card { background: #f9f9f9; padding: 20px; border-radius: 8px; margin-bottom: 25px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 14px; }
.sub-title { font-size: 18px; color: var(--secondary-color); margin: 25px 0 15px; border-left: 5px solid var(--primary-color); padding-left: 10px; }
.progress-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 14px; }
.progress-table th { background: #f2f2f2; padding: 12px; text-align: left; border-bottom: 2px solid #ddd; }
.progress-table td { padding: 12px; border-bottom: 1px solid #eee; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; }
.status-item { background: white; border: 1px solid #eee; padding: 12px; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; }
.status-item label { font-size: 13px; color: #666; font-weight: bold; }
.status-val { font-size: 13px; font-weight: bold; color: var(--primary-color); }
.refresh-note { font-size: 12px; color: #999; margin-top: 30px; font-style: italic; text-align: center; }

/* 管理員介面擴充 */
.tab-buttons { display: flex; border-bottom: 2px solid #ddd; margin-bottom: 20px; }
.tab-btn { background: none; border: none; padding: 10px 20px; cursor: pointer; font-size: 15px; font-weight: bold; color: #777; transition: 0.3s; }
.tab-btn:hover, .tab-btn.active { color: var(--primary-color); }
.tab-btn.active { border-bottom: 3px solid var(--primary-color); }
.input-styled { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; margin-top: 5px; font-size: 14px; outline: none; }
.input-styled:focus { border-color: var(--primary-color); }
.btn-action { background: var(--primary-color); color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: bold; }
.btn-action:hover { background: #13876f; }
.footer { background: var(--secondary-color); color: white; text-align: center; padding: 15px; font-size: 13px; }
.footer p { margin: 5px 0; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 768px) { .upload-grid, .profile-grid { grid-template-columns: 1fr; } .form-section-title, .input-group[style*="span 2"], .btn-primary[style*="span 2"] { grid-column: span 1 !important; } }