@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* 全域變數定義 */
:root {
    --bg-main: #0b0f19;
    --bg-card: #131b2e;
    --bg-card-hover: #1e294b;
    --bg-sidebar: #070a12;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-primary: #6366f1; /* 靛藍 */
    --accent-secondary: #06b6d4; /* 青色 */
    
    --color-critical: #ff2e93; /* 霓虹玫瑰紅 (關鍵路徑) */
    --color-normal: #10b981; /* 綠色 */
    --color-warning: #f59e0b; /* 橘黃 */
    --color-danger: #ef4444; /* 紅色 */
    
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    
    --base-font-size: 15px;
}

/* 主題：明亮簡潔 (Light & Clean) */
body.theme-light {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-sidebar: #f1f5f9;
    --border-color: rgba(0, 0, 0, 0.08);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --accent-primary: #4f46e5;
    --accent-secondary: #0ea5e9;
    
    --color-critical: #e11d48;
    --color-normal: #059669;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.15);
}

/* 主題：極簡暗黑 (Minimalist Dark) */
body.theme-minimal {
    --bg-main: #121212;
    --bg-card: #1e1e1e;
    --bg-card-hover: #2a2a2a;
    --bg-sidebar: #181818;
    --border-color: rgba(255, 255, 255, 0.05);
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-muted: #6e6e6e;
    
    --accent-primary: #ffffff;
    --accent-secondary: #bbbbbb;
    
    --color-critical: #ff5555;
    --color-normal: #55ff55;
    --color-warning: #ffaa00;
    --color-danger: #ff5555;
}

/* 主題：自然大地 (Nature/Earthy) */
body.theme-nature {
    --bg-main: #1c211c;
    --bg-card: #252b25;
    --bg-card-hover: #313831;
    --bg-sidebar: #161a16;
    --border-color: rgba(180, 210, 180, 0.1);
    --text-primary: #e6eee6;
    --text-secondary: #a3b8a3;
    --text-muted: #728272;
    
    --accent-primary: #4ade80;
    --accent-secondary: #86efac;
    
    --color-critical: #fb7185;
    --color-normal: #a3e635;
    --color-warning: #facc15;
    --color-danger: #ef4444;
}

/* 基礎重設 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow-hidden;
    height: 100vh;
    display: flex;
    font-size: var(--base-font-size);
    line-height: 1.5;
}

/* 按鈕與連結預設 */
button, input, textarea, select {
    font-family: inherit;
    background: none;
    border: none;
    outline: none;
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

/* 主版面架構 */
.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* 左側邊欄 */
.sidebar {
    width: 300px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width var(--transition-normal), border-right-color var(--transition-normal), opacity var(--transition-normal);
    overflow: hidden;
}

.sidebar.collapsed {
    width: 0 !important;
    border-right-color: transparent;
    opacity: 0;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header .logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.project-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.project-list-title {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    padding-left: 8px;
    font-weight: 700;
}

.project-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

.project-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.project-item.active {
    background-color: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: inset 0 0 10px rgba(99, 102, 241, 0.05);
}

.project-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.project-name {
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.project-date {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-delete-project {
    opacity: 0;
    transition: var(--transition-fast);
    padding: 4px;
    border-radius: 4px;
    color: var(--text-muted);
}

.project-item:hover .btn-delete-project {
    opacity: 1;
}

.btn-delete-project:hover {
    color: var(--color-danger);
    background-color: rgba(239, 68, 68, 0.1);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    transition: var(--transition-fast);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* 頂部操作按鈕 */
.btn-header-action {
    padding: 6px 12px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid transparent;
    background-color: transparent;
}

.btn-header-action.tour {
    background-color: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.35);
    color: var(--accent-primary);
}

.btn-header-action.edit {
    background-color: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.35);
    color: var(--color-normal);
}

.btn-header-action.settings {
    background-color: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.35);
    color: var(--color-warning);
}

.btn-header-action:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* 右側主顯示區 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* 側邊欄切換按鈕 (懸浮拉頁風格) */
.sidebar-toggle-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 60px;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 10px 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001; /* 確保在拖曳節點、畫布與其他提示框之上 */
    color: var(--text-secondary);
    transition: background-color var(--transition-fast), color var(--transition-fast), width var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
}

.sidebar-toggle-btn:hover {
    width: 24px;
    color: var(--accent-primary);
    background-color: var(--bg-card-hover);
    box-shadow: 3px 0 12px rgba(0, 0, 0, 0.25);
}

.sidebar-toggle-btn i {
    font-size: 14px;
    transition: transform var(--transition-fast);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    gap: 16px;
    padding: 40px;
    text-align: center;
}

.empty-state .icon {
    font-size: 64px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    opacity: 0.6;
}

/* 專案儀表板內容 */
.project-dashboard {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.dashboard-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(19, 27, 46, 0.3);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-title-area {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dashboard-title {
    font-size: 24px;
    font-weight: 700;
}

.dashboard-desc {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 數據概覽卡片 */
.stats-container {
    display: flex;
    gap: 20px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 160px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.duration {
    background-color: rgba(6, 182, 212, 0.1);
    color: var(--accent-secondary);
}

.stat-icon.critical {
    background-color: rgba(255, 46, 147, 0.1);
    color: var(--color-critical);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 分頁導覽列 */
.dashboard-nav {
    padding: 0 32px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(19, 27, 46, 0.2);
    display: flex;
    gap: 24px;
}

.nav-tab {
    padding: 16px 4px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: var(--transition-fast);
}

.nav-tab:hover {
    color: var(--text-primary);
}

.nav-tab.active {
    color: var(--text-primary);
    font-weight: 600;
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 3px 3px 0 0;
}

/* 分頁內容區 */
.dashboard-body {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    position: relative;
}

.tab-content {
    display: none;
    height: 100%;
}

.tab-content.active {
    display: block;
}

/* 表格樣式 */
.table-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 16px 20px;
    background-color: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.01);
}

/* 關鍵路徑高亮行 */
tr.critical-task-row td {
    border-left: 3px solid var(--color-critical);
}

/* 標籤徽章 */
.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge.critical {
    background-color: rgba(255, 46, 147, 0.1);
    color: var(--color-critical);
    border: 1px solid rgba(255, 46, 147, 0.2);
    box-shadow: 0 0 10px rgba(255, 46, 147, 0.1);
}

.badge.normal {
    background-color: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

/* 前置任務依賴徽章樣式 */
.badge-predecessor {
    background-color: rgba(99, 102, 241, 0.12);
    color: #c7d2fe;
    border: 1px solid rgba(99, 102, 241, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 2px;
    padding: 2px 6px;
    font-size: 11px;
    border-radius: 4px;
    font-weight: 500;
}

body.theme-light .badge-predecessor {
    background-color: rgba(79, 70, 229, 0.08);
    color: #4f46e5;
    border: 1px solid rgba(79, 70, 229, 0.2);
}

body.theme-minimal .badge-predecessor {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

body.theme-nature .badge-predecessor {
    background-color: rgba(74, 222, 128, 0.08);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.2);
}

/* 版面佈局：任務列表 + 相依性設定 */
.task-config-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

/* 卡片與表單 */
.config-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

input, select, textarea {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 8px;
    transition: var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* 相依性項目列表 */
.dependency-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.dependency-item {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.dep-arrow {
    color: var(--accent-secondary);
    font-weight: bold;
    margin: 0 8px;
}

/* 甘特圖容器 */
.gantt-chart-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
}

.gantt-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    position: relative;
}

.gantt-header-label {
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.gantt-timeline-header {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    overflow: hidden;
}

.gantt-time-col {
    flex-shrink: 0;
    text-align: center;
    padding: 12px 0;
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.gantt-row {
    display: contents;
}

.gantt-task-name {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gantt-bar-cell {
    position: relative;
    border-bottom: 1px solid var(--border-color);
    background-image: linear-gradient(90deg, rgba(255, 255, 255, 0.01) 1px, transparent 1px);
    background-size: 40px 100%; /* 動態調整此大小符合 JS 算出的天數寬度 */
    display: flex;
    align-items: center;
    padding: 8px 0;
}

.gantt-bar {
    height: 28px;
    border-radius: 6px;
    position: absolute;
    display: flex;
    align-items: center;
    padding-left: 12px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}

.gantt-bar:hover {
    filter: brightness(1.15);
    transform: scaleY(1.04);
}

.gantt-bar.normal {
    background: linear-gradient(90deg, #6366f1, #06b6d4);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.gantt-bar.critical {
    background: linear-gradient(90deg, #ec4899, #ff2e93);
    border: 1px solid rgba(255, 46, 147, 0.4);
    box-shadow: 0 0 15px rgba(255, 46, 147, 0.3);
}

/* 浮時條 (Slack/Float line) */
.gantt-slack {
    height: 4px;
    background-color: var(--text-muted);
    border-top: 1px dotted rgba(255,255,255,0.4);
    position: absolute;
    opacity: 0.6;
}

/* 網路圖區域 */
.network-diagram-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    overflow: auto;
    position: relative;
    min-height: 500px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: center;
}

.network-svg-container {
    position: relative;
    width: 1200px;
    height: 600px;
}

.network-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 網路圖節點卡片 */
.network-node {
    position: absolute;
    width: 200px;
    height: 160px;
    background-color: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-md);
    cursor: grab;
    user-select: none;
    transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.network-node:active {
    cursor: grabbing;
}

.network-node.dragging {
    opacity: 0.85;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.6) !important;
    transform: scale(1.02) !important;
    z-index: 1000;
    transition: none !important;
}

.network-node:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
}

.network-node.critical-node {
    border-color: var(--color-critical);
    box-shadow: 0 0 15px rgba(255, 46, 147, 0.2);
}

.network-node.critical-node:hover {
    box-shadow: 0 0 25px rgba(255, 46, 147, 0.4);
}

.node-title {
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 4px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.25;
    word-break: break-all;
    overflow: hidden;
}

/* 節點時程網格 */
.node-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    overflow: hidden;
    font-size: 11px;
    text-align: center;
}

.grid-cell {
    padding: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    background-color: rgba(0,0,0,0.1);
}

.grid-cell:nth-child(2n) {
    border-right: none;
}

.grid-cell:nth-child(3), .grid-cell:nth-child(4) {
    border-bottom: none;
}

.grid-cell-label {
    font-size: 9px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 2px;
}

.grid-cell-val {
    font-weight: 700;
}

.node-footer {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    padding: 0 4px;
    color: var(--text-secondary);
}

.node-footer span.float-val.critical-text {
    color: var(--color-critical);
    font-weight: 700;
}

/* 發光的文字與線條 */
.critical-text {
    color: var(--color-critical);
}

.critical-line {
    stroke: var(--color-critical);
    stroke-width: 3px;
    filter: drop-shadow(0px 0px 4px var(--color-critical));
    stroke-dasharray: 5;
    animation: dash 30s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -1000;
    }
}

/* 彈出視窗 Notification */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background-color: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    padding: 16px 24px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid var(--color-normal);
}

.toast.error {
    border-left: 4px solid var(--color-danger);
    background-color: #271420;
}

.toast-icon {
    font-size: 20px;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.toast-close {
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition-fast);
}

.toast-close:hover {
    opacity: 1;
}

/* Modal 樣式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 480px;
    max-width: 90%;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==========================================
   引導教學 (Guided Tour) 樣式
   ========================================== */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(3, 7, 18, 0.75);
    z-index: 9998;
    display: none;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: auto;
}

.tour-overlay.active {
    display: block;
    opacity: 1;
}

.tour-highlight {
    position: relative;
    z-index: 9999 !important;
    background-color: var(--bg-card) !important;
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.8) !important;
    outline: 2px solid var(--accent-primary) !important;
    pointer-events: none; /* 防止使用者在導覽時誤觸高亮元素 */
}

/* 提示框 */
.tour-tooltip {
    position: fixed;
    z-index: 9999;
    width: 320px;
    background-color: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    display: none;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0;
    transform: scale(0.95);
}

.tour-tooltip.active {
    display: flex;
    opacity: 1;
    transform: scale(1);
}

.tour-step-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tour-step-title::before {
    content: "💡";
}

.tour-step-content {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.tour-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 12px;
    margin-top: 4px;
}

.tour-progress {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.tour-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-tour-nav {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-tour-next {
    background-color: var(--accent-primary);
    color: #fff;
    border: none;
}

.btn-tour-next:hover {
    background-color: #4f46e5;
}

.btn-tour-prev {
    background-color: rgba(255,255,255,0.06);
    color: var(--text-primary);
    border: 1px solid rgba(255,255,255,0.1);
}

.btn-tour-prev:hover {
    background-color: rgba(255,255,255,0.12);
}

.btn-tour-skip {
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    transition: var(--transition-fast);
    border: none;
}

.btn-tour-skip:hover {
    color: var(--color-danger);
}

/* 箭頭 */
.tour-arrow {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: #1e293b;
    border-left: 1px solid rgba(255,255,255,0.12);
    border-top: 1px solid rgba(255,255,255,0.12);
    transform: rotate(45deg);
    display: block;
}

.tour-tooltip[data-align="top"] .tour-arrow {
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(225deg);
}

.tour-tooltip[data-align="bottom"] .tour-arrow {
    top: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
}

.tour-tooltip[data-align="left"] .tour-arrow {
    right: -6px;
    top: 50%;
    transform: translateY(-50%) rotate(135deg);
}

.tour-tooltip[data-align="right"] .tour-arrow {
    left: -6px;
    top: 50%;
    transform: translateY(-50%) rotate(315deg);
}

/* 今日時間進度線 (Today line in Gantt) */
.gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, #22d3ee, #06b6d4);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.8), 0 0 20px rgba(6, 182, 212, 0.4);
    z-index: 10;
    pointer-events: none;
}

.gantt-today-label {
    position: absolute;
    top: -20px;
    transform: translateX(-50%);
    background: #06b6d4;
    color: #0f172a;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.6);
}

/* 進行中任務（當天落在時程內）特殊霓虹呼吸發光 */
@keyframes activePulseTeal {
    0% { box-shadow: 0 0 5px rgba(20, 184, 166, 0.3); border-color: rgba(20, 184, 166, 0.4); }
    50% { box-shadow: 0 0 15px rgba(20, 184, 166, 0.8), inset 0 0 5px rgba(20, 184, 166, 0.2); border-color: rgba(20, 184, 166, 1); }
    100% { box-shadow: 0 0 5px rgba(20, 184, 166, 0.3); border-color: rgba(20, 184, 166, 0.4); }
}

/* 進行中任務（甘特圖條與任務列表行） */
.gantt-row.active-task-row .gantt-task-name {
    color: #14b8a6 !important;
    font-weight: 600;
}

.gantt-bar.active-task-bar {
    animation: activePulseTeal 2.5s infinite ease-in-out;
}

.active-task-tr {
    background: rgba(20, 184, 166, 0.03) !important;
    border-left: 3px solid #14b8a6 !important;
}

.active-task-tr td:first-child {
    color: #14b8a6 !important;
    font-weight: 600;
}

/* 任務明細表格進行中徽章 */
.badge-active-task {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(20, 184, 166, 0.15);
    color: #14b8a6;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 50px;
    border: 1px solid rgba(20, 184, 166, 0.3);
    margin-left: 6px;
    box-shadow: 0 0 8px rgba(20, 184, 166, 0.2);
}

.badge-active-task::before {
    content: '';
    width: 6px;
    height: 6px;
    background-color: #14b8a6;
    border-radius: 50%;
    display: inline-block;
    animation: blinker 1.5s linear infinite;
}

@keyframes blinker {
    50% { opacity: 0; }
}

/* 關鍵路徑網路圖進行中節點樣式 - 發光呼吸特效 (加強高亮版) */
.network-node.active-task-node {
    border: 2px solid #2dd4bf !important;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.08) 0%, rgba(15, 23, 42, 0.95) 100%) !important;
    box-shadow: 0 0 20px rgba(45, 212, 191, 0.6), inset 0 0 8px rgba(45, 212, 191, 0.2) !important;
    animation: activeNodeGlowPulse 1.5s infinite alternate !important;
}

@keyframes activeNodeGlowPulse {
    0% {
        box-shadow: 0 0 12px rgba(45, 212, 191, 0.5), inset 0 0 6px rgba(45, 212, 191, 0.15);
        border-color: #14b8a6 !important;
    }
    100% {
        box-shadow: 0 0 35px rgba(45, 212, 191, 1.0), 0 0 15px rgba(99, 102, 241, 0.6), inset 0 0 15px rgba(45, 212, 191, 0.4);
        border-color: #06b6d4 !important;
    }
}

/* 節點備忘記事滾動條樣式 */
.node-notes::-webkit-scrollbar {
    width: 3px;
}
.node-notes::-webkit-scrollbar-track {
    background: transparent;
}
.node-notes::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}
.node-notes::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 複製任務圖示按鈕樣式 */
.btn-copy-task {
    background: none;
    border: none;
    color: #a7f3d0;
    cursor: pointer;
    font-size: 14px;
    padding: 6px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-copy-task:hover {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

/* ==========================================
   第三階段：版面滿版與科技感番茄鐘樣式
   ========================================== */

/* 覆寫任務管理版面為單欄滿版 */
.task-config-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
}

/* 已完成任務列樣式 */
.task-completed-tr {
    opacity: 0.55;
}
.task-completed-tr td {
    color: var(--text-muted) !important;
}
.task-completed-tr strong {
    text-decoration: line-through;
    color: var(--text-muted) !important;
}

/* 番茄鐘正在執行的任務列 */
.pomo-active-task-tr {
    position: relative;
    border-left: 4px solid #f43f5e !important;
    background: rgba(244, 63, 94, 0.05) !important;
    animation: pomoActivePulse 2s infinite ease-in-out;
}

@keyframes pomoActivePulse {
    0%, 100% { box-shadow: inset 0 0 10px rgba(244, 63, 94, 0.1), 0 0 12px rgba(244, 63, 94, 0.15); }
    50% { box-shadow: inset 0 0 20px rgba(244, 63, 94, 0.2), 0 0 20px rgba(244, 63, 94, 0.35); }
}

/* 番茄鐘浮動視窗主體 */
.pomodoro-floating-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 260px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(0, 242, 254, 0.35);
    box-shadow: 0 0 25px rgba(0, 242, 254, 0.25), inset 0 0 15px rgba(0, 242, 254, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 16px;
    z-index: 1000;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 拖拽把手 */
.pomodoro-drag-handle {
    background: rgba(0, 242, 254, 0.08);
    border-bottom: 1px solid rgba(0, 242, 254, 0.2);
    padding: 8px 12px;
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.dot-matrix {
    color: rgba(0, 242, 254, 0.5);
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 2px;
}

.btn-min-max:hover {
    opacity: 1 !important;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

/* 主面板 */
.pomodoro-main-panel {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 計時 SVG 環 */
.progress-ring__circle {
    transition: stroke-dashoffset 0.1s linear;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

/* 迷你計時面板 */
.pomodoro-mini-panel {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    background: rgba(15, 23, 42, 0.9);
}

.pulsing-pomo-icon {
    animation: miniPulse 1.5s infinite;
}

@keyframes miniPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px var(--accent-primary)); }
    50% { transform: scale(1.2); filter: drop-shadow(0 0 8px var(--accent-primary)); }
}

/* 狀態徽章 */
.badge-completed {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: #10b981 !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

/* 勾選按鈕樣式 */
.btn-complete-task {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    padding: 6px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-complete-task:hover {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.btn-complete-task.completed {
    color: #10b981;
}

/* 假日順延建議按鈕 */
.date-suggest-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 6px 12px;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #38bdf8;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.date-suggest-btn:hover {
    background: rgba(56, 189, 248, 0.3);
    border-color: #38bdf8;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(56, 189, 248, 0.2);
}

.date-suggest-btn:active {
    transform: translateY(0);
}

/* 提示框滑入與淡入動畫 */
@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#task-date-tip {
    animation: slideDownFade 0.25s ease-out forwards;
}

/* 懸浮在活動節點右上角的「進行中」膠囊標籤 */
.node-active-tag {
    position: absolute;
    top: -10px;
    right: 12px;
    background: linear-gradient(90deg, #14b8a6, #06b6d4);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    box-shadow: 0 0 10px rgba(20, 184, 166, 0.6);
    z-index: 10;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 2px;
    animation: tagPulse 1.5s infinite alternate;
}

@keyframes tagPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 6px rgba(20, 184, 166, 0.4);
    }
    100% {
        transform: scale(1.06);
        box-shadow: 0 0 14px rgba(20, 184, 166, 0.8), 0 0 4px rgba(99, 102, 241, 0.3);
    }
}


