/* 
  樣式表 (style.css)
  設計理念：提供企業級的高質感、柔和毛玻璃風格，字體清晰，色彩沉穩。
*/

/* 定義全域 CSS 變數 (Design Tokens) */
:root {
    --primary-color: #0f766e; /* 沉穩的深藍綠色 */
    --primary-hover: #115e59;
    --background-color: #f0fdfa; /* 極淡的綠底 */
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #cbd5e1;
    --danger-color: #ef4444;
    --success-color: #10b981;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Inter', 'Noto Sans TC', sans-serif;
    background-color: var(--background-color);
    color: var(--text-main);
    line-height: 1.6;
    /* 增加一個優雅的背景漸層 */
    background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
    min-height: 100vh;
}

/* 主容器：限制最大寬度並居中 */
.app-container {
    max-width: 1000px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 視圖切換邏輯 (Layer) */
.layer {
    display: none;
    flex: 1;
    padding: 2rem 1rem;
    animation: fadeIn 0.4s ease-out;
}

.layer.active {
    display: flex;
    flex-direction: column;
}

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

/* ================= 登入層樣式 ================= */
#login-layer {
    justify-content: center;
    align-items: center;
}

.card {
    background: var(--card-bg);
    padding: 3rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
    text-align: center;
}

.card h1 {
    font-size: 1.75rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.input-group {
    text-align: left;
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2);
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 按鈕共用樣式 */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
    font-family: inherit;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.primary-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.secondary-btn {
    background-color: white;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.secondary-btn:hover {
    background-color: #f8fafc;
}

.text-btn {
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem;
}

.text-btn:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.large-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.125rem;
}

/* ================= 通用 Header 樣式 ================= */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.app-header h2 {
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* ================= 作業區樣式 ================= */
.content-body {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    flex: 1;
}

.instructions {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
}

.template-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.loading-text {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem 0;
}

/* 單一選項項目 (Checkbox + Input) */
.behavior-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.behavior-item:hover {
    border-color: var(--primary-color);
}

.behavior-item.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
    background-color: #f0fdfa; /* 淺綠底代表選取狀態 */
}

.behavior-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.25rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.behavior-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.behavior-category {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* 在挑選清單中的文字輸入框 */
.behavior-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid transparent; /* 預設不顯示邊框 */
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-main);
    background: transparent;
    transition: all 0.2s;
    line-height: 1.5;
}

/* 當有勾選，或滑鼠漂移時顯示可編輯狀態 */
.behavior-item:hover .behavior-input,
.behavior-item.selected .behavior-input {
    border-color: var(--border-color);
    background: white;
}

.behavior-input:focus {
    outline: none;
    border-color: var(--primary-color) !important;
    background: white;
    box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.1);
}

.submit-section {
    margin-top: 3rem;
    text-align: center;
}

/* ================= 儀表板樣式 ================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.group-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.group-card-header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    font-weight: 600;
    font-size: 1.125rem;
}

.group-card-body {
    padding: 1rem;
}

.dashboard-item {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border-color);
}

.dashboard-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.dashboard-item-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.dashboard-item-text {
    font-size: 0.95rem;
}
