/* Complete CSS Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --gray-color: #64748b;
    --border-radius: 12px;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: var(--shadow);
}

/* Header Styles */
.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo i {
    font-size: 2.5rem;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
}

.beta {
    background: var(--warning-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.tagline {
    margin-top: 0.25rem;
    opacity: 0.9;
    font-size: 0.9rem;
}

.stats {
    display: flex;
    gap: 2rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.stat i {
    font-size: 1.2rem;
}

/* Main Content */
.main-content {
    padding: 2rem;
}

/* Form Styles */
.query-section {
    background: var(--light-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    border: 1px solid #e2e8f0;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.form-group label i {
    color: var(--primary-color);
}

textarea, select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
}

textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.submit-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    white-space: nowrap;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Response Section */
.response-section {
    margin-bottom: 3rem;
}

.confidence-indicator {
    background: #f1f5f9;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.confidence-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), #34d399);
    opacity: 0.2;
    transition: width 1s ease;
}

.confidence-text {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.query-type {
    font-weight: normal;
    color: var(--gray-color);
    margin-left: 0.5rem;
}

/* Card Styles */
.answer-card, .sources-card, .history-card {
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    background: #f8fafc;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
}

.badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

.answer-text {
    line-height: 1.8;
    font-size: 1.05rem;
}

.answer-text pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
    font-family: 'Monaco', 'Consolas', monospace;
}

.answer-text code {
    background: #f1f5f9;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
}

/* Sources Grid */
.sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.source-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    transition: var(--transition);
}

.source-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.source-type {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.source-id {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    color: var(--gray-color);
    margin-bottom: 0.25rem;
}

.source-relevance {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--success-color);
}

.source-meta {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #e2e8f0;
}

.pubmed-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.pubmed-link:hover {
    text-decoration: underline;
}

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.history-query {
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.history-response {
    color: var(--gray-color);
    font-size: 0.9rem;
}

/* Examples */
.examples-section {
    margin-bottom: 3rem;
}

.examples-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.example-btn {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.example-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.example-btn i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.example-btn span {
    font-weight: 500;
    color: var(--dark-color);
}

/* Features */
.features-section {
    margin-bottom: 3rem;
}

.features-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.feature {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid #e2e8f0;
    transition: var(--transition);
}

.feature:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.feature-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.feature h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.feature p {
    color: var(--gray-color);
    font-size: 0.95rem;
}

/* Footer */
.app-footer {
    background: var(--dark-color);
    color: white;
    padding: 3rem 2rem 1.5rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #e2e8f0;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
    color: #94a3b8;
}

.disclaimer {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--danger-color);
    padding: 0.75rem;
    border-radius: 0 8px 8px 0;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.disclaimer i {
    color: var(--danger-color);
    margin-top: 0.1rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid #334155;
    color: #94a3b8;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        margin: 0;
    }
    
    .app-header {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
    
    .stats {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .sources-grid {
        grid-template-columns: 1fr;
    }
    
    .examples-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .examples-grid {
        grid-template-columns: 1fr;
    }
}
/* ================= ENHANCED UI STYLES ================= */

/* Code block wrapper */
.code-block-wrapper {
    position: relative;
    margin: 1rem 0;
}

/* Copy button */
.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    opacity: 0.8;
    transition: all 0.3s;
    z-index: 10;
}

.copy-btn:hover {
    opacity: 1;
    transform: translateY(-1px);
}

/* Response actions */
.response-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: flex-end;
}

.export-pipeline-btn {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.export-pipeline-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
}

/* Quick actions */
.quick-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.quick-action-btn {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--gray-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.quick-action-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

/* Syntax highlighting */
.code-comment {
    color: #6b7280;
    font-style: italic;
}

.code-string {
    color: #059669;
}

.code-function {
    color: #2563eb;
    font-weight: 600;
}

.code-keyword {
    color: #7c3aed;
    font-weight: 600;
}

.code-command {
    color: #dc2626;
    font-weight: 600;
}

.code-option {
    color: #9333ea;
}

.code-path {
    color: #059669;
}

/* Clear history button */
.clear-history-btn {
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.3s;
    margin-left: auto;
}

.clear-history-btn:hover {
    background: #ef4444;
    color: white;
}

/* Auto-resize textareas */
textarea {
    transition: height 0.2s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .response-actions {
        flex-direction: column;
    }
    
    .export-pipeline-btn {
        width: 100%;
        justify-content: center;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .quick-action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .copy-btn {
        position: relative;
        top: 0;
        right: 0;
        width: 100%;
        border-radius: 0 0 4px 4px;
        justify-content: center;
        margin-top: -1px;
    }
}