﻿/* --- 全域設定 --- */
:root {
    --primary-color: #1a3a6e;
    --secondary-color: #4a7ab8;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --dark-gray: #6c757d;
    --text-color: #343a40;
    --bg-color: #f4f7fc;
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.07);
    --card-hover-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 16px;
}

/* --- 應用程式外殼與畫面切換 --- */
.app-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    width: 100%;
    flex-grow: 1;
    animation: fadeIn 0.4s ease-in-out;
}

    .screen.active {
        display: flex;
        flex-direction: column;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --- 通用元件 --- */
.container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* --- 頁首樣式 --- */
.app-header {
    background-color: white;
    padding: 15px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.app-logo {
    font-size: 1.6em;
    font-weight: bold;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

    .user-profile .avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background-color: var(--medium-gray);
        color: var(--dark-gray);
        text-align: center;
        line-height: 40px;
        font-weight: bold;
    }

/* --- 專案大廳畫面 (Screen 1) 樣式 --- */
#screen-lobby .main-title {
    text-align: center;
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-top: 20px;
    margin-bottom: 50px;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.project-card, .new-project-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 25px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    border: 2px solid transparent;
}

    .project-card:hover, .new-project-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--card-hover-shadow);
        border-color: var(--secondary-color);
    }

    .project-card h4 {
        margin: 0 0 15px 0;
        color: var(--primary-color);
        font-size: 1.1rem;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .project-card p {
        font-size: 0.9em;
        color: var(--dark-gray);
        margin: 5px 0 0;
    }

.new-project-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dotted var(--medium-gray);
    min-height: 180px;
}

    .new-project-card .plus-icon {
        width: 60px;
        height: 60px;
        background-color: var(--secondary-color);
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.8rem;
        margin-bottom: 20px;
    }

    .new-project-card span {
        font-weight: 600;
        color: var(--secondary-color);
    }


/* --- Footer --- */
.app-footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 20px;
    flex-shrink: 0;
    font-size: 0.9em;
}

    .app-footer p {
        margin: 0;
        opacity: 0.8;
    }

/* --- 新專案創建流程樣式 --- */

.process-layout-header {
    background-color: transparent;
    padding: 15px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
}

.app-container-process {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 80px 20px 40px; /* 為 header 留出空間 */
}

.create-process-card {
    background-color: white;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 40px 50px;
    width: 100%;
    max-width: 800px;
}

.process-header h3 {
    text-align: center;
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 30px;
}

.import-tabs {
    display: flex;
    justify-content: center;
    border-bottom: 2px solid var(--medium-gray);
    margin-bottom: 30px;
}

.import-tab {
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: -2px;
}

    .import-tab.active {
        color: var(--primary-color);
        border-bottom: 3px solid var(--primary-color);
    }

.import-content {
    display: none;
}

    .import-content.active {
        display: block;
        animation: fadeIn 0.5s;
    }

    .import-content p {
        color: var(--dark-gray);
    }

    .import-content input[type="url"] {
        width: 100%;
        padding: 12px;
        border: 1px solid #ccc;
        border-radius: 8px;
    }

.paste-text-area {
    width: 100%;
    height: 200px;
    border-radius: 8px;
    border: 1px solid #ccc;
    padding: 15px;
    font-size: 1em;
    resize: vertical;
}

.process-footer {
    text-align: center;
    margin-top: 40px;
}

    .process-footer .btn-lg {
        padding: 15px 30px;
        font-size: 1.1rem;
    }

/* --- 步驟二: 大綱頁樣式 --- */
.process-description {
    text-align: center;
    color: var(--dark-gray);
    margin-bottom: 30px;
}

.outline-list {
    list-style: none;
    padding: 0;
}

.outline-item {
    background-color: white;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid var(--medium-gray);
    font-size: 1.1em;
}

    .outline-item .drag-handle {
        cursor: grab;
        color: var(--dark-gray);
    }

.outline-title {
    flex-grow: 1;
}

.ai-tag {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
}

    .ai-tag.tag-image {
        background-color: #d1ecf1;
        color: #0c5460;
    }

    .ai-tag.tag-chart {
        background-color: #d4edda;
        color: #155724;
    }

    .ai-tag.tag-summary {
        background-color: #fff3cd;
        color: #856404;
    }

.outline-actions {
    margin-top: 30px;
    display: flex;
    gap: 15px;
}

/* --- 美化創建流程中的導航按鈕 --- */

/* 建立一個新的按鈕樣式：btn-tertiary */
/* 通用按鈕基礎樣式 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* 取消按鈕樣式 */
#btn-cancel {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: var(--dark-gray);
    border: 2px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

    #btn-cancel:hover {
        background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
        color: var(--text-color);
        border-color: #ced4da;
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
        text-decoration: none;
    }

    #btn-cancel:active {
        transform: translateY(0);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

/* 返回按鈕樣式 */
#btn-back {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    color: white;
    border: 2px solid var(--secondary-color);
    box-shadow: 0 2px 8px rgba(74, 122, 184, 0.3);
}

    #btn-back:hover {
        background: linear-gradient(135deg, #5b8bc9 0%, #2a4a7f 100%);
        border-color: #5b8bc9;
        color: white;
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(74, 122, 184, 0.4);
        text-decoration: none;
    }

    #btn-back:active {
        transform: translateY(0);
        box-shadow: 0 2px 8px rgba(74, 122, 184, 0.3);
    }

/* 使用 ::before 偽元素來添加圖示 */
#btn-cancel::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f00d"; /* FontAwesome "X" (times) 圖示 */
    transition: transform 0.3s ease;
}

#btn-back::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f053"; /* FontAwesome "chevron-left" 圖示 */
    transition: transform 0.3s ease;
}

/* hover 時的圖示動畫效果 */
#btn-cancel:hover::before {
    transform: rotate(90deg);
}

#btn-back:hover::before {
    transform: translateX(-3px);
}

/* 波紋效果 */
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
    z-index: 0;
}

.btn:hover::after {
    width: 300px;
    height: 300px;
}

/* 確保文字在波紋效果之上 */
.btn > * {
    position: relative;
    z-index: 1;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* 焦點狀態動畫 */
@keyframes pulse {
    0% {
        box-shadow: 0 2px 8px rgba(74, 122, 184, 0.3);
    }

    50% {
        box-shadow: 0 4px 16px rgba(74, 122, 184, 0.5);
    }

    100% {
        box-shadow: 0 2px 8px rgba(74, 122, 184, 0.3);
    }
}

#btn-back:focus {
    animation: pulse 2s infinite;
    outline: none;
}