:root {
    --primary: #2196F3;
    --primary-dark: #1976D2;
    --secondary: #00BCD4;
    --accent: #FF4081;
    --success: #4CAF50;
    --warning: #FF9800;
    --error: #F44336;
    --bg-dark: #0a0e27;
    --bg-light: #141937;
    --surface: #1e2447;
    --surface-light: #283054;
    --text-primary: #ffffff;
    --text-secondary: #b4b9d0;
    --border: #2a3154;
    --glow: 0 0 20px rgba(33, 150, 243, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.1;
    background: 
        radial-gradient(circle at 20% 50%, var(--primary) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, var(--secondary) 0%, transparent 50%);
    filter: blur(100px);
    animation: bgMove 20s ease-in-out infinite;
}

@keyframes bgMove {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-50px, -50px) scale(1.1); }
    66% { transform: translate(50px, -30px) scale(0.9); }
}

/* Header */
.header {
    background: rgba(30, 36, 71, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: var(--glow);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text; 
    -webkit-text-fill-color: transparent;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--surface);
    border-radius: 20px;
    font-size: 0.875rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--error);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Upload Section */
.upload-section {
    background: var(--surface);
    border-radius: 20px;
    padding: 3rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.upload-section::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary), var(--secondary), var(--accent));
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: -1;
}

.upload-section:hover::before {
    opacity: 0.3;
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.upload-card{
    background: var(--surface-light);
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.upload-card.optional {
    opacity: 0.8;
}

.upload-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(33, 150, 243, 0.2);
}

.upload-card.active {
    border-color: var(--success);
    background: rgba(76, 175, 80, 0.1);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px currentColor);
}

.upload-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.upload-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.optional-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.file-input {
    display: none;
}

.file-list {
    margin-top: 1rem;
    text-align: left;
}

.file-item {
    background: var(--bg-dark);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
}

/* AI Prompt Section */
.prompt-section {
    background: var(--surface);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}

.prompt-label {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.prompt-input {
    width: 100%;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    resize: vertical;
    min-height: 150px;
    transition: all 0.3s;
}

.prompt-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.prompt-suggestions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.suggestion-chip {
    background: var(--surface-light);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.suggestion-chip:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* Action Buttons */
.action-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    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.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.2);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === NEW/MODIFIED STYLES START HERE === */

/* Main container for all analysis-related output */
.analysis-output-container {
    display: none; /* Hidden by default */
    margin-top: 2rem;
}
.analysis-output-container.active {
    display: block; /* Show when analysis starts */
    animation: slideIn 0.5s ease-out;
}

/* Global Download Section (for Dropdown and Buttons) */
.global-download-section {
    display: none; /* Hidden by default */
    margin-bottom: 2rem;
}
.global-download-section.active {
    display: block; /* Show when first result arrives */
    animation: fadeIn 0.5s ease-out;
}

/* Container for dropdown and buttons to add spacing */
.download-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem; /* This creates the vertical space you wanted */
}

/* Style for the dropdown menu */
.download-select {
    width: 100%;
    max-width: 600px;
    padding: 0.75rem 1rem;
    background-color: var(--surface-light);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

.download-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Container for the two download buttons */
.download-buttons {
    display: flex;
    gap: 1rem; /* Space between the two buttons */
    flex-wrap: wrap;
    justify-content: center;
}

/* === NEW/MODIFIED STYLES END HERE === */


.report-block {
    background: var(--surface);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}

.report-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.report-status {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--warning);
}

.progress-section {
    padding: 1rem 0;
    display: none;
}

.progress-section.active {
    display: block;
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.progress-bar-container {
    background: var(--surface-light);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

.steps-container {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 1rem;
    margin-top: 1rem;
}

.step-item {
    background: var(--surface-light);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: start;
    gap: 1rem;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { 
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.step-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.step-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.step-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-secondary);
}

.step-status.complete {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success);
}

.step-status.processing {
    background: rgba(33, 150, 243, 0.2);
    color: var(--primary);
}

/* Results Section in each block */
.results-section {
    padding: 1rem 0;
    display: none;
}

.results-section.active {
    display: block;
}

.report-content-container {
    margin-top: 1rem;
}

.download-btn {
    background: linear-gradient(135deg, var(--success), #388E3C);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.download-csv {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
}

.report-content {
    background: var(--bg-dark);
    border-radius: 12px;
    padding: 2rem;
    min-height: 200px;
    line-height: 1.8;
}

.report-content h1,
.report-content h2,
.report-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.report-content p {
    margin-bottom: 1rem;
}

/* Chat Assistant */
.chat-assistant {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 4px 20px rgba(33, 150, 243, 0.4);
    transition: all 0.3s;
    position: relative;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(33, 150, 243, 0.6);
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.chat-window {
    position: fixed;
    bottom: 100px;
    right: 2rem;
    width: 420px;
    height: 600px;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    border: 1px solid var(--border);
    overflow: hidden;
}

.chat-window.active {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

.chat-header {
    background: var(--surface-light);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.chat-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.chat-mode-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.25rem;
    transition: color 0.2s;
}

.chat-close:hover {
    color: var(--text-primary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    display: flex;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease-out;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.message-avatar.ai {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.message-content {
    flex: 1;
    background: var(--surface-light);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.5;
}

.message-content.ai {
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.message-content.ai ul {
    margin: 10px 0;
    padding-left: 20px;
}

.message-content.ai li {
    margin: 5px 0;
    line-height: 1.5;
}

/* 分析提示樣式 */
.analysis-tips {
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid rgba(33, 150, 243, 0.3);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.tips-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.analysis-tips ul {
    margin: 0;
    padding-left: 1.5rem;
}

.analysis-tips li {
    margin: 0.25rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.chat-input-container {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
}

.chat-input {
    flex: 1;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* 錯誤消息樣式 */
.error-message {
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    color: var(--error);
}

/* 動畫效果 */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 工具提示 */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-dark);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.tooltip:hover::after {
    opacity: 1;
}

/* 快速操作浮動按鈕 */
.quick-action-fab {
    position: fixed;
    bottom: 170px;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 188, 212, 0.4);
    transition: all 0.3s;
    z-index: 999;
}

.quick-action-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 188, 212, 0.6);
}

.quick-action-fab.hidden {
    opacity: 0;
    pointer-events: none;
}

.chat-send {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-send:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .upload-grid {
        grid-template-columns: 1fr;
    }

    .chat-window {
        width: calc(100% - 2rem);
        right: 1rem;
        left: 1rem;
    }

    .action-section {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

.analysis-mode-section {
    background: var(--surface);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.mode-selector {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.mode-option {
    flex: 1;
    position: relative;
    cursor: pointer;
}

.mode-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.mode-card {
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s;
}

.mode-option input[type="radio"]:checked + .mode-card {
    border-color: var(--primary);
    background: rgba(33, 150, 243, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(33, 150, 243, 0.2);
}

.mode-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.mode-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.mode-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* 合併選項的樣式 */
.prompt-options {
    transition: all 0.3s ease;
}

#mergeOptionContainer {
    transition: opacity 0.3s ease;
}

#mergeOptionContainer.disabled {
    opacity: 0.5;
    pointer-events: none;
}

#mergeReport:checked + span {
    color: var(--primary);
    font-weight: 500;
}

/* 當勾選時的視覺反饋 */
#mergeReport:checked {
    accent-color: var(--primary);
}

/* Hover 效果 */
.merge-checkbox:hover span {
    color: var(--primary);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .prompt-options > div {
        flex-direction: column;
        align-items: flex-start;
    }
    
    #mergeHint {
        text-align: left;
        margin-top: 0.5rem;
    }
}

/* 聊天模式切換 */
.chat-mode-toggle {
    display: flex;
    gap: 0.5rem;
    background: var(--surface);
    padding: 0.25rem;
    border-radius: 20px;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border: none;
    border-radius: 16px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.mode-btn.active {
    background: var(--primary);
    color: white;
}

.mode-btn:hover:not(.active) {
    background: var(--surface-light);
}

/* Prompt 生成器樣式 */
.prompt-generator {
    padding: 1.5rem;
    overflow-y: auto;
    height: calc(100% - 60px);
}

.prompt-instructions {
    text-align: center;
    margin-bottom: 1.5rem;
}

.instruction-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.prompt-instructions h3 {
    margin: 0.5rem 0;
    color: var(--primary);
}

.prompt-instructions p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* 檔案摘要 */
.file-summary {
    background: var(--surface-light);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.summary-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

#fileSummaryContent {
    font-size: 0.875rem;
}

.file-item-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

/* 快速選項 */
.quick-options {
    margin-bottom: 1.5rem;
}

.options-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
}

.option-card {
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.option-card:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.option-card.selected {
    background: rgba(33, 150, 243, 0.1);
    border-color: var(--primary);
}

.option-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.option-title {
    font-size: 0.75rem;
    font-weight: 600;
}

/* 自定義輸入 */
.custom-purpose {
    margin-bottom: 1rem;
}

.purpose-input {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    resize: vertical;
    margin-bottom: 0.75rem;
}

.purpose-input:focus {
    outline: none;
    border-color: var(--primary);
}

.generate-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.generate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Prompt 結果 */
.prompt-results {
    margin-top: 1.5rem;
}

.prompt-results-title{
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.prompt-suggestion {
    background: var(--surface-light);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    animation: fadeIn 0.3s ease-out;
}

.suggestion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.suggestion-title {
    font-weight: 600;
    color: var(--primary);
}

.copy-btn {
    background: var(--surface);
    border: none;
    border-radius: 6px;
    padding: 0.25rem 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.copy-btn:hover {
    background: var(--primary);
    color: white;
}

.copy-btn.copied {
    background: var(--success);
    color: white;
}

.suggestion-prompt {
    background: var(--bg-dark);
    border-radius: 6px;
    padding: 0.75rem;
    margin: 0.5rem 0;
    font-family: monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.suggestion-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Loading 動畫 */
.generating-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    color: var(--primary);
}

.generating-text {
    font-weight: 600;
}

/* 層級視覺區分 */
.prompt-suggestion.level-basic {
    border-left: 4px solid #4CAF50;
}

.prompt-suggestion.level-intermediate {
    border-left: 4px solid #FFC107;
}

.prompt-suggestion.level-advanced {
    border-left: 4px solid #F44336;
    background: rgba(244, 67, 54, 0.05);
}

.prompt-suggestion.level-advanced .suggestion-prompt {
    font-size: 0.85rem;
    line-height: 1.6;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .chat-window {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .prompt-generator {
        padding: 1rem;
    }

    .option-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .chat-mode-toggle {
        flex-direction: column;
        gap: 0.25rem;
    }

    .mode-btn {
        width: 100%;
        justify-content: center;
    }

    /* Pulse animation for prompt input */
    @keyframes pulse {
        0% {
            box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.7);
        }
        70% {
            box-shadow: 0 0 0 10px rgba(33, 150, 243, 0);
        }
        100% {
            box-shadow: 0 0 0 0 rgba(33, 150, 243, 0);
        }
    }

    /* Enhanced folder upload card */
    #folderUploadCard.has-analysis {
        border-color: var(--success);
        background: rgba(76, 175, 80, 0.05);
    }

    /* JSON preview styling */
    .json-preview {
        background: var(--bg-dark);
        border-radius: 8px;
        padding: 0.5rem;
        margin: 0.5rem 0;
        font-family: monospace;
        font-size: 0.8rem;
        max-height: 100px;
        overflow-y: auto;
    }
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem; /* 按鈕和狀態指示燈之間的間距 */
}

.nav-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--surface);
    border-radius: 20px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none; /* 移除連結底線 */
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
}

.nav-button:hover {
    background: var(--surface-light);
    color: var(--text-primary);
    transform: translateY(-2px); /* 懸停時輕微上浮 */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border-color: var(--primary);
}

.nav-button span {
    display: inline-block;
}
