/* Health QA - Modern Chat Interface Styles */

:root {
    /* Color Palette - Medical Theme */
    --primary: #00d4aa;
    --primary-dark: #00b894;
    --primary-light: #00f5c4;
    --secondary: #6c5ce7;
    --background: #0f1419;
    --surface: #1a1f2e;
    --surface-light: #242d3d;
    --surface-hover: #2d3748;
    --text: #e8e8e8;
    --text-muted: #a0aec0;
    --text-dim: #718096;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: rgba(0, 0, 0, 0.3);
    
    /* Metric Colors */
    --metric-similarity: #00d4aa;
    --metric-bleu: #6c5ce7;
    --metric-rouge1: #fd79a8;
    --metric-rouge2: #fdcb6e;
    --metric-rougeL: #74b9ff;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 50%;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-light) 100%);
    border-bottom: 1px solid var(--border);
    padding: var(--space-md) var(--space-xl);
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.logo-icon {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 400;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    gap: 0;
    overflow: hidden;
}

/* Chat Section */
.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    background: var(--background);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: var(--space-xl);
    max-width: 500px;
    margin: auto;
}

.welcome-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.welcome-message h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text);
}

.welcome-message p {
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
}

.sample-questions {
    margin-top: var(--space-lg);
}

.sample-label {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: var(--space-sm);
}

.sample-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.sample-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.sample-btn:hover {
    background: var(--surface-hover);
    color: var(--primary);
    border-color: var(--primary);
    transform: translateX(5px);
}

/* Message Bubbles */
.message {
    display: flex;
    gap: var(--space-sm);
    max-width: 80%;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.bot {
    align-self: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--primary);
}

.message.bot .message-avatar {
    background: var(--secondary);
}

.message-content {
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    line-height: 1.5;
}

.message.user .message-content {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #000;
    border-bottom-right-radius: var(--radius-sm);
}

.message.bot .message-content {
    background: var(--surface-light);
    color: var(--text);
    border-bottom-left-radius: var(--radius-sm);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: var(--space-md);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: var(--radius-full);
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Chat Input */
.chat-input-container {
    padding: var(--space-md) var(--space-xl);
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.chat-input-container form {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.chat-input {
    flex: 1;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-lg);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.chat-input::placeholder {
    color: var(--text-dim);
}

.chat-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.2);
}

.send-btn {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(0, 212, 170, 0.4);
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.send-icon {
    font-size: 1.2rem;
    color: #000;
}

/* Metrics Panel */
.metrics-panel {
    width: 320px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    padding: var(--space-lg);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.metrics-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.metrics-icon {
    font-size: 1.5rem;
}

.metrics-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.metrics-placeholder {
    text-align: center;
    color: var(--text-dim);
    padding: var(--space-xl) var(--space-md);
    font-size: 0.9rem;
}

.metrics-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.hidden {
    display: none !important;
}

/* Metric Cards */
.metric-card {
    background: var(--surface-light);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    transition: all 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--shadow);
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.metric-card.similarity .metric-value { color: var(--metric-similarity); }
.metric-card.bleu .metric-value { color: var(--metric-bleu); }
.metric-card.rouge1 .metric-value { color: var(--metric-rouge1); }
.metric-card.rouge2 .metric-value { color: var(--metric-rouge2); }
.metric-card.rougeL .metric-value { color: var(--metric-rougeL); }

.metric-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.metric-fill {
    height: 100%;
    border-radius: var(--radius-lg);
    transition: width 0.5s ease-out;
    width: 0%;
}

.metric-card.similarity .metric-fill { background: var(--metric-similarity); }
.metric-card.bleu .metric-fill { background: var(--metric-bleu); }
.metric-card.rouge1 .metric-fill { background: var(--metric-rouge1); }
.metric-card.rouge2 .metric-fill { background: var(--metric-rouge2); }
.metric-card.rougeL .metric-fill { background: var(--metric-rougeL); }

/* Matched Question */
.matched-question {
    background: var(--surface-light);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    border-left: 3px solid var(--secondary);
}

.matched-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.matched-text {
    font-size: 0.9rem;
    color: var(--text);
    font-style: italic;
}

/* Footer */
.app-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: var(--space-md) var(--space-xl);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.app-footer strong {
    color: var(--primary);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-hover);
    border-radius: var(--radius-lg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Loading Shimmer */
.shimmer {
    background: linear-gradient(
        90deg,
        var(--surface-light) 25%,
        var(--surface-hover) 50%,
        var(--surface-light) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Responsive Design */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }
    
    .metrics-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
        max-height: 300px;
    }
    
    .metrics-cards {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
    
    .message {
        max-width: 90%;
    }
}
