/* --- static/style.css --- */

/* 1. 基礎滿版佈局 */
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; padding: 20px; box-sizing: border-box; background-color: #f5f7fa; height: 100vh; display: flex; flex-direction: column; }
h1 { color: #2c3e50; margin-top: 0; flex-shrink: 0; margin-bottom: 15px; }

/* 2. 全域設備設定區塊 */
.global-settings { background-color: #e8ecef; padding: 12px 20px; border-radius: 6px; border: 1px solid #d1d8dd; margin-bottom: 15px; display: flex; gap: 10px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }

/* 3. 頁籤樣式 */
.tabs { display: flex; margin-bottom: 15px; border-bottom: 2px solid #ddd; flex-shrink: 0; }
.tab-btn { padding: 10px 20px; cursor: pointer; background: none; border: none; font-size: 16px; font-weight: bold; color: #7f8c8d; }
.tab-btn.active { color: #2980b9; border-bottom: 3px solid #2980b9; margin-bottom: -2px; }

/* 4. 內容區塊 */
.tab-content { display: none; background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); flex-grow: 1; min-height: 0; }
.tab-content.active { display: flex; flex-direction: column; }

/* 5. 控制列樣式 */
.control-group { margin-bottom: 15px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; flex-shrink: 0; }
select, input[type="text"], input[type="password"] { padding: 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; }
button { padding: 8px 16px; background-color: #2980b9; color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; transition: background-color 0.2s; }
button:hover { background-color: #3498db; }

/* 6. 終端機與輸出區塊 */
#terminal-container { flex-grow: 1; width: 100%; border-radius: 6px; background-color: #1e1e1e; box-shadow: inset 0 0 10px rgba(0,0,0,0.8); box-sizing: border-box; }
.xterm { padding: 10px; }

/* 7. 專業級表單排版 (全版面 + 靠左對齊) */
.manager-container { width: 100%; display: flex; flex-direction: column; gap: 20px; }
.task-form { display: none; background: #ffffff; padding: 25px; border-radius: 8px; border: 1px solid #e2e8f0; box-shadow: 0 4px 6px rgba(0,0,0,0.02); }
.task-form.active { display: block; animation: fadeIn 0.3s ease-in-out; }

/* 網格系統：調整為更緊湊的高空間利用率排版 */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 15px; margin-bottom: 20px; justify-content: start; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 13px; font-weight: bold; color: #34495e; }
.form-row input[type="text"], .form-row select { width: 100%; box-sizing: border-box; padding: 8px; background-color: #f8f9fa; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; }
.form-row input[type="text"]:focus, .form-row select:focus { outline: none; border-color: #2980b9; background-color: #fff; }

/* 表單底部操作區 */
.form-actions { display: flex; justify-content: flex-start; align-items: center; gap: 20px; padding-top: 15px; border-top: 1px solid #ecf0f1; }
.form-actions button { padding: 10px 25px; font-size: 15px; min-width: 150px; }

/* 8. 彈出式輸出視窗 (Modal) 樣式 */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 1000; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.modal-overlay.active { display: flex; animation: fadeIn 0.2s ease-out; }
.modal-container { background: #1e1e1e; width: 95vw; max-width: 1800px; height: 85vh; border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 15px 40px rgba(0,0,0,0.6); transform: translateY(20px); transition: transform 0.3s ease-out; }
.modal-overlay.active .modal-container { transform: translateY(0); }
.modal-header { background: #2c3e50; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; color: white; flex-shrink: 0; border-bottom: 1px solid #34495e; }
.modal-title { font-size: 16px; font-weight: bold; margin: 0; display: flex; align-items: center; gap: 10px; }
.modal-close { background: none; border: none; color: #bdc3c7; font-size: 24px; cursor: pointer; padding: 0; line-height: 1; }
.modal-close:hover { color: #e74c3c; }
.modal-body { flex-grow: 1; padding: 20px; overflow: auto; background-color: #1e1e1e; }
.readonly-terminal { margin: 0; color: #e0e0e0; font-family: 'Courier New', Courier, monospace; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }

/* 樹狀圖節點的容器樣式 */
.tree-node-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 6px 8px;
    user-select: none;
    color: #2c3e50; /* 保持原本的深色文字 */
    transition: background-color 0.2s ease;
    border-radius: 4px;
}

/* 💡 輕量化懸停效果：改用極淺的灰藍色 */
.tree-node-header:hover {
    background-color: #eef2f5; /* 非常柔和的背景色 */
    /* 這裡不需要再改變文字顏色了，深色字在淺色背景上非常清晰 */
}

/* 1. 旋轉小箭頭 (Chevron) */
.tree-chevron {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    /* 內建灰色箭頭 SVG */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2395a5a6'><path d='M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z'/></svg>");
    background-size: contain;
    background-repeat: no-repeat;
    transition: transform 0.2s ease-in-out; /* 💡 旋轉動畫核心 */
}

/* 展開時：箭頭向下轉 90 度 */
.tree-node-header.is-open .tree-chevron {
    transform: rotate(90deg);
}

/* 2. 資料夾圖示 (預設為關閉狀態) */
.tree-folder-icon {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    /* 內建金色關閉資料夾 SVG */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f1c40f'><path d='M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z'/></svg>");
    background-size: contain;
    background-repeat: no-repeat;
}

/* 展開時：切換為開啟的資料夾 */
.tree-node-header.is-open .tree-folder-icon {
    /* 內建金色開啟資料夾 SVG */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f1c40f'><path d='M19 8H8.99C8.04 8 7.19 8.59 6.81 9.46L2.81 18.55C2.62 18.98 2.94 19.5 3.41 19.5H16.99C17.94 19.5 18.79 18.91 19.17 18.04L23.17 8.95C23.36 8.52 23.04 8 22.57 8H19zM4 4c-1.1 0-2 .9-2 2v10.59l3.09-7.04C5.56 8.59 6.51 8 7.46 8H20V6c0-1.1-.9-2-2-2h-8l-2-2H4z'/></svg>");
}

/* 隱藏原生 Checkbox，改為自訂的過濾器樣式 */
.filter-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #bdc3c7;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
    transition: all 0.2s ease;
}

/* 懸停時提示顏色 */
.filter-checkbox:hover {
    border-color: #e74c3c;
}

/* 勾選時背景變紅，並顯示 ✖ */
.filter-checkbox:checked {
    background-color: #e74c3c;
    border-color: #e74c3c;
}

.filter-checkbox:checked::after {
    content: '✖';
    color: white;
    font-size: 11px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
