/* 全域樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* 側邊欄樣式 */
.sidebar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 100vh;
    padding: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-content {
    padding: 2rem 1.5rem;
    height: 100vh;
    overflow-y: auto;
}

.logo-section {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e9ecef;
}

.logo-icon {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.logo-section h2 {
    color: #333;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.status-section {
    margin-bottom: 2rem;
}

.status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f8f9fa;
}

.status-icon {
    color: #6c757d;
    margin-right: 0.5rem;
    width: 20px;
}

.status-indicator {
    color: #28a745;
}

.status-indicator.offline {
    color: #dc3545;
}

.info-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.info-section h6 {
    color: #667eea;
    margin-bottom: 1rem;
    font-weight: 600;
}

.info-section ul {
    list-style: none;
    padding-left: 0;
}

.info-section li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
    position: relative;
    padding-left: 1.5rem;
}

.info-section li:before {
    content: "•";
    color: #667eea;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* 主要內容區樣式 */
.main-content {
    padding: 0;
    min-height: 100vh;
}

.content-wrapper {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.header-section {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

.header-section h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* 查詢區域樣式 */
.query-section {
    margin-bottom: 2rem;
}

.query-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.query-input {
    border: 2px solid #e9ecef;
    border-radius: 10px 0 0 10px;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.query-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.query-btn {
    border-radius: 0 10px 10px 0;
    padding: 1rem 2rem;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    transition: all 0.3s ease;
}

.query-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.query-btn:disabled {
    opacity: 0.6;
    transform: none;
}

/* 載入動畫樣式 */
.loading-section {
    text-align: center;
    margin: 2rem 0;
}

.loading-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 3rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.loading-text {
    margin-top: 1rem;
    color: #6c757d;
    font-size: 1.1rem;
}

/* 結果區域樣式 */
.results-section {
    margin-top: 2rem;
}

.result-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.query-display, .answer-display, .context-display {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.query-display h5, .answer-display h5, .context-display h5 {
    color: #667eea;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.query-display h5 i, .answer-display h5 i, .context-display h5 i {
    margin-right: 0.5rem;
}

.answer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.answer-header h5 {
    margin-bottom: 0;
}

#playAudioBtn {
    transition: all 0.3s ease;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

#playAudioBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

#playAudioBtn.playing {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

#playAudioBtn.playing i {
    animation: pulse 1s infinite;
}

.query-display p {
    font-size: 1.1rem;
    color: #495057;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.answer-content {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 4px solid #28a745;
    line-height: 1.6;
    font-size: 1rem;
}

.context-content {
    max-height: 300px;
    overflow-y: auto;
}

.context-item {
    background: #f8f9fa;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.context-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #6c757d;
}

.context-item-content {
    color: #495057;
    line-height: 1.5;
}

/* 資料庫狀態樣式 */
.database-status {
    text-align: center;
    margin-top: 1rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    background: #e9ecef;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #6c757d;
}

.status-badge i {
    margin-right: 0.5rem;
}

.status-badge.found {
    background: #d4edda;
    color: #155724;
}

.status-badge.not-found {
    background: #f8d7da;
    color: #721c24;
}

/* 錯誤訊息樣式 */
.error-section {
    margin-top: 2rem;
}

.alert {
    border-radius: 10px;
    border: none;
    padding: 1rem 1.5rem;
}

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .sidebar {
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .sidebar-content {
        height: auto;
        padding: 1rem;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
    
    .header-section h1 {
        font-size: 2rem;
    }
    
    .query-container {
        padding: 1.5rem;
    }
    
    .result-container {
        padding: 1.5rem;
    }
}

/* 動畫效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* 滾動條樣式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
} 