/* style.css */

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

:root {
    /* --- 1. Dark Blue (深藍色 - 穩重/專業) --- */
    --sidebar-bg-end: #003366;      /* Navy Blue */
    --text-primary: #0f172a;        /* 深灰藍，適合閱讀 */
    
    /* --- 2. Bright Blue (亮藍色 - 活力/吸引目光) --- */
    --sidebar-bg-start: #0088cc;    /* Cerulean Blue */
    --primary-color: #0077b6;       /* 主要互動色 */
    
    /* --- 3. Light Blue (淺藍色 - 科技/輕盈) --- */
    --accent-color: #38bdf8;        /* Sky Blue */
    --bg-color: #f0f8ff;            /* AliceBlue (極淺的藍背景) */
    
    --text-secondary: #475569;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-float: 0 10px 25px -5px rgba(0, 50, 100, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    --shadow-bubble: 0 2px 5px rgba(0,0,0,0.05); 
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    overflow-x: hidden;
    font-size: 16px;
    line-height: 1.5;
}

/* --- Layout Standard (有側邊欄的頁面) --- */
.main-wrapper { display: flex; height: 100vh; width: 100vw; }

/* --- Sidebar (改為藍色漸層) --- */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 20;
    box-shadow: 5px 0 15px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}
.sidebar-header { padding: 32px 28px; font-size: 1.4rem; font-weight: 700; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-menu { list-style: none; padding: 24px 16px; margin: 0; }
.sidebar-menu li a { display: flex; align-items: center; gap: 16px; padding: 14px 20px; color: rgba(255,255,255,0.7); text-decoration: none; border-radius: 12px; font-size: 1.05rem; font-weight: 500; margin-bottom: 8px; transition: all 0.2s ease; }
.sidebar-menu li a:hover { background-color: rgba(255,255,255,0.15); color: white; transform: translateX(3px); }
.sidebar-menu li a.active { background-color: white; color: var(--sidebar-bg-end); font-weight: 700; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

/* --- Content Area --- */
.content-area { 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    background-color: var(--bg-color); 
    position: relative; 
    overflow: hidden; 
    height: 100vh;
}
.page-container { padding: 40px 50px; height: 100%; overflow-y: auto; max-width: 1600px; margin: 0 auto; width: 100%; }

/* --- Full Screen Mode (AI Expert 專用 - 改為藍色系背景) --- */
.full-screen-layout {
    width: 100vw;
    height: 100vh;
    /* 改為淡藍色徑向漸層 */
    background: radial-gradient(circle at 12% 18%, rgba(224, 242, 254, 0.9) 0%, rgba(255, 255, 255, 0.95) 55%, rgba(230, 245, 255, 0.9) 100%);
    position: relative;
    display: flex;
    flex-direction: column;
}

/* 頂部導航列 */
.expert-navbar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 50;
    pointer-events: none; 
}
.expert-navbar .btn-back {
    pointer-events: auto;
    background: white;
    border: 1px solid #e5e7eb;
    padding: 10px 20px;
    border-radius: 50px;
    color: var(--text-secondary);
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
.expert-navbar .btn-back:hover {
    box-shadow: var(--shadow-float);
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* 背景動態球 (裝飾用 - 改為藍色系) */
.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.6;
    animation: blob-float 10s infinite alternate;
}
.blob-1 { top: -10%; right: -5%; width: 500px; height: 500px; background: rgba(0, 136, 204, 0.15); animation-delay: 0s; } /* Bright Blue */
.blob-2 { bottom: -10%; left: -10%; width: 600px; height: 600px; background: rgba(56, 189, 248, 0.15); animation-delay: -5s; } /* Light Blue */

@keyframes blob-float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, -50px) scale(1.1); }
}


/* --- Playful Animated Background (AI Expert) --- */
#bgCanvas{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    z-index:1;
    pointer-events:none;
    opacity:0.95;
}
/* subtle confetti dots layer (改為藍色系點綴) */
.full-screen-layout::before{
    content:"";
    position:absolute;
    inset:0;
    z-index:0;
    pointer-events:none;
    background-image:
        radial-gradient(circle at 12px 18px, rgba(0, 136, 204, 0.12) 2px, transparent 3px),
        radial-gradient(circle at 38px 42px, rgba(56, 189, 248, 0.10) 2px, transparent 3px),
        radial-gradient(circle at 72px 30px, rgba(0, 51, 102, 0.07) 2px, transparent 3px);
    background-size: 120px 120px, 160px 160px, 200px 200px;
    animation: sprinklesMove 18s linear infinite;
    opacity:0.55;
    filter: blur(0.2px);
}
@keyframes sprinklesMove{
    0%{ background-position: 0 0, 0 0, 0 0; }
    100%{ background-position: 140px -220px, -180px 160px, 220px 180px; }
}
/* Owl SVG */
.owl-logo{ display:block; }

/* --- Cards --- */
.card-custom { 
    background: white; 
    border-radius: 16px; 
    box-shadow: var(--shadow-sm); 
    margin-bottom: 30px; 
    border: 1px solid #e5e7eb; 
}
.card-header-custom { padding: 24px 32px; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; align-items: center; background: #fff; border-radius: 16px 16px 0 0; }
.card-title { font-weight: 700; font-size: 1.25rem; color: #111827; margin: 0; }
.card-body-custom { padding: 32px; }

/* --- Tables --- */
.table-saas { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-saas thead th { background-color: #f9fafb; color: #6b7280; font-weight: 600; font-size: 0.9rem; letter-spacing: 0.02em; padding: 16px 24px; border-bottom: 1px solid #e5e7eb; }
.table-saas tbody td { padding: 20px 24px; vertical-align: middle; border-bottom: 1px solid #f3f4f6; font-size: 1rem; color: #374151; }
.table-saas tbody tr:last-child td { border-bottom: none; }
.btn-icon-delete { width: 36px; height: 36px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: #9ca3af; display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s; cursor: pointer; }
.btn-icon-delete:hover { background-color: #fee2e2; color: #ef4444; }

/* --- Chat Interface --- */
#chat-interface { 
    display: none; 
    flex-direction: column; 
    height: 100%; 
    position: relative; 
    z-index: 10; 
}

/* 捲動區 */
.chat-scroll-area { 
    flex-grow: 1; 
    overflow-y: auto; 
    padding-bottom: 160px; 
    padding-top: 80px; 
    scroll-behavior: smooth;
}
.chat-container { 
    max-width: 900px; 
    width: 90%; 
    margin: 0 auto; 
    display: flex; 
    flex-direction: column; 
    gap: 24px; 
}

/* 訊息列 */
.message-row { 
    display: flex; 
    gap: 16px; 
    animation: slideUpFade 0.5s cubic-bezier(0.16, 1, 0.3, 1); 
    opacity: 0;
    animation-fill-mode: forwards;
}

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

.message-content { line-height: 1.7; font-size: 1.05rem; position: relative; }
.avatar { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1.1rem; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }

/* AI 樣式 - 貓頭鷹背景改藍 */
.message-row.ai { flex-direction: row; padding-right: 15%; }
.ai-avatar { background: linear-gradient(135deg, var(--primary-color), var(--accent-color)); color: white; }
.message-row.ai .message-content { 
    color: #1f2937; 
    background: rgba(255, 255, 255, 0.85); 
    backdrop-filter: blur(10px);
    padding: 18px 24px;
    border-radius: 0 20px 20px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    border: 1px solid rgba(255,255,255,0.6);
}

/* User 樣式 - 改為藍色漸層 */
.message-row.user { flex-direction: row-reverse; padding-left: 15%; }
.user-avatar { display: none; }
.message-row.user .message-content {
    background: linear-gradient(135deg, var(--sidebar-bg-end), var(--primary-color));
    color: #ffffff;
    padding: 16px 24px;
    border-radius: 20px 20px 4px 20px;
    box-shadow: 0 4px 12px rgba(0, 119, 182, 0.25);
    text-align: left;
}

/* 延伸問題 (Chips) 區域 - 邊框改藍 */
.suggestion-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    margin-left: 4px;
    animation: fadeIn 0.8s ease forwards;
}
.suggestion-chip {
    background: white;
    border: 1px solid rgba(0, 119, 182, 0.35); /* Blue border */
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 119, 182, 0.05);
    display: flex;
    align-items: center;
    gap: 6px;
}
.suggestion-chip:hover {
    background: rgba(0, 119, 182, 0.10);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 119, 182, 0.15);
    border-color: rgba(0, 119, 182, 0.65);
}
.suggestion-chip i { font-size: 0.8em; opacity: 0.7; }

/* Actions */
.message-actions { margin-top: 6px; display: flex; gap: 8px; margin-left: 4px; opacity: 0.6; transition: 0.2s; }
.message-row:hover .message-actions { opacity: 1; }
.action-btn { background: transparent; border: none; color: #64748b; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.action-btn:hover { background: rgba(0,0,0,0.05); color: #0f172a; }

/* Input Area */
.input-container-wrapper {
    position: absolute; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    background: linear-gradient(to top, rgba(255,255,255, 1) 40%, rgba(255,255,255, 0));
    padding: 20px 0 40px 0; 
    display: flex; 
    justify-content: center; 
    z-index: 20;
}
.input-box {
    width: 90%; 
    max-width: 900px; 
    background: white;
    border-radius: 28px;
    box-shadow: var(--shadow-float);
    border: 1px solid rgba(255,255,255, 0.8);
    padding: 10px 10px 10px 24px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}
.input-box:focus-within {
    box-shadow: 0 20px 40px -10px rgba(0, 119, 182, 0.22);
    transform: translateY(-2px);
    border-color: rgba(0, 119, 182, 0.35);
}
.input-box textarea {
    border: none;
    resize: none;
    width: 100%;
    max-height: 180px;
    padding: 14px 0;
    font-size: 1.1rem;
    color: #1f2937;
    background: transparent;
    outline: none;
}
.btn-send-icon {
    width: 48px; height: 48px;
    border: none; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    flex-shrink: 0;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); 
    box-shadow: 0 4px 10px rgba(0, 119, 182, 0.3);
}
.btn-send-icon:hover { transform: scale(1.1) rotate(-10deg); box-shadow: 0 6px 15px rgba(0, 119, 182, 0.4); }
.btn-send-icon:active { transform: scale(0.95); }

/* Welcome Screen Animation */
#welcome-screen h2 { animation: slideUpFade 0.6s ease-out; }
#welcome-screen p { animation: slideUpFade 0.8s ease-out; }
#welcome-screen button { animation: slideUpFade 1s ease-out; }

/* Badge Role (更新背景色) */
.badge-role { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 50px; font-size: 0.9rem; font-weight: 600; }
.badge-role.ai { background-color: #e0f2fe; color: #0284c7; } /* Light Blue */
.badge-role.user { background-color: #f1f5f9; color: var(--text-secondary); }

/* Override Bootstrap .bg-primary usage inside expert navbar to match blue theme */
.expert-navbar .bg-primary{
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color)) !important;
}

/* Owl inside chat avatar */
.ai-avatar .owl-logo{
    width:18px;
    height:18px;
}

/* --- Empty State (共用) --- */
.empty-state      { text-align:center; padding: 26px 12px; }
.empty-state-icon { font-size: 40px; color: var(--primary-color); margin-bottom: 10px; }
.empty-state-title{ font-size: 1.15rem; font-weight: 700; color: #111827; }
.empty-state-desc { margin-top: 6px; color: #64748b; }
.empty-inline     { padding: 10px 0; }

/* --- Timeline / 對話紀錄 (logs.html) --- */
.timeline { display:flex; flex-direction:column; gap:16px; padding:8px 0; }

.timeline-item               { display:flex; gap:12px; align-items:flex-start; }
.timeline-item.user          { flex-direction:row-reverse; }

.timeline-avatar {
    width:36px; height:36px; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    flex-shrink:0; font-size:14px;
}
.timeline-item.ai   .timeline-avatar { background:#e8f0fe; color:#3b5bdb; }
.timeline-item.user .timeline-avatar { background:#e9fbe9; color:#2f9e44; }

.timeline-body { max-width:75%; }
.timeline-role { font-size:0.75rem; color:#888; margin-bottom:4px; }
.timeline-item.user .timeline-role { text-align:right; }

.timeline-text {
    background:#fff; border:1px solid #e9ecef; border-radius:12px;
    padding:10px 14px; font-size:0.9rem; line-height:1.6; word-break:break-word;
}
.timeline-item.user .timeline-text { background:#f0f9f0; }

.timeline-vote { font-size:0.8rem; padding-left:4px; }
mark { background:#fff3cd; padding:0 2px; border-radius:3px; }

.badge-role.system { background-color: #f1f5f9; color: #475569; }
