:root {
    --background-light: #f9fafb;
    --background-dark: #111827;
    --text-light: #374151;
    --text-dark: #d1d5db;
    --text-muted-light: #6b7280;
    --text-muted-dark: #9ca3af;
    --border-light: #e5e7eb;
    --border-dark: #374151;
    --surface-light: #ffffff;
    --surface-dark: #1f2937;
    --primary-color: #2563eb;
    --primary-color-hover: #1d4ed8;
    --sample-question-bg: #dbeafe;
    --sample-question-text: #3b82f6;
    --sample-question-bg-dark: #1e293b;
    --sample-question-text-dark: #60a5fa;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    font-family: var(--font-body);
    background-color: var(--background-light);
    color: var(--text-light);
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
}

.dark body {
    background-color: var(--background-dark);
    color: var(--text-dark);
}

.page-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-header {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    background-color: var(--surface-light);
    border-bottom: 1px solid var(--border-light);
    padding: 1rem;
    box-sizing: border-box;
}

.dark .page-header {
    background-color: var(--surface-dark);
    border-bottom-color: var(--border-dark);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 80rem;
    margin: 0 auto;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    height: 2rem;
    width: 2rem;
    border-radius: 0.5rem;
    background: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo svg {
    width: 20px;
    height: 12px;
}

.logo-text h1 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-light);
    margin: 0;
}

.dark .logo-text h1 {
    color: var(--text-dark);
}

.logo-text p {
    font-size: 0.875rem;
    color: var(--text-muted-light);
    margin: 0;
}

.dark .logo-text p {
    color: var(--text-muted-dark);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-button {
    padding: 0.5rem 1.25rem;
    background-color: #10b981;
    color: white;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.search-button:hover {
    background-color: #059669;
}

.chat-main-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    max-width: 80rem;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    width: 100%;
    box-sizing: border-box;
}

.welcome-message {
    padding: 2rem 0;
    text-align: center;
    font-size: 1.25rem;
    line-height: 1.6;
    max-width: 48rem;
    margin: 0 auto 2rem auto;
    color: var(--text-light);
}

.dark .welcome-message {
    color: var(--text-dark);
}

#conversation {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0.5rem;
    min-height: 300px;
}

.sample-questions-container {
    text-align: center;
    margin-bottom: 2rem;
}

.sample-questions-container p {
    font-size: 0.875rem;
    color: var(--text-muted-light);
    margin-bottom: 1rem;
    font-weight: 400;
}

.dark .sample-questions-container p {
    color: var(--text-muted-dark);
}

.sample-questions-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.sample-question {
    padding: 0.5rem 1rem;
    background-color: var(--sample-question-bg);
    color: var(--sample-question-text);
    border-radius: 9999px;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
}

.dark .sample-question {
    background-color: var(--sample-question-bg-dark);
    color: var(--sample-question-text-dark);
}

.sample-question:hover {
    filter: brightness(95%);
}

#chat-form {
    position: sticky;
    bottom: 0;
    background-color: var(--background-light);
    padding: 1rem;
    border-top: 1px solid var(--border-light);
}

.dark #chat-form {
    background-color: transparent;
    border-top-color: var(--border-dark);
}

.input-wrapper {
    display: flex;
    max-width: 80rem;
    margin: 0 auto;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--surface-light);
    border: 1px solid var(--border-light);
    border-radius: 0.75rem;
    padding: 0.25rem;
    padding-left: 1rem;
}

.dark .input-wrapper {
    background-color: var(--surface-dark);
    border-color: var(--border-dark);
}

#chat-input {
    flex-grow: 1;
    border: none;
    background-color: transparent;
    color: var(--text-light);
    font-size: 1rem;
    padding: 0.75rem 0;
}

#chat-input:focus {
    outline: none;
}

.dark #chat-input {
    color: var(--text-dark);
}

#send-button {
    padding: 0.625rem 1.25rem;
    border-radius: 0.625rem;
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
    transition: background-color 0.2s ease;
    border: none;
    cursor: pointer;
}

#send-button:hover {
    background-color: var(--primary-color-hover);
}

#send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.message-wrapper {
    display: flex;
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease-out;
}

.message-wrapper.question {
    justify-content: flex-end;
}

.message-wrapper.answer {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 80%;
    word-wrap: break-word;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
}

.message-wrapper.question .message-bubble {
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.message-wrapper.answer .message-bubble {
    background-color: #e5e7eb;
    color: #1f2937;
    border-bottom-left-radius: 0.25rem;
}

.dark .message-wrapper.answer .message-bubble {
    background-color: #374151;
    color: #f3f4f6;
}

.typing-cursor {
    display: inline-block;
    width: 8px;
    height: 1rem;
    background: var(--primary-color);
    animation: blink 1s infinite;
    vertical-align: text-bottom;
    margin-left: 2px;
}

.dark .typing-cursor {
    background: #60a5fa;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

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

.footer {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted-light);
    padding: 2rem 0;
}

.dark .footer {
    color: var(--text-muted-dark);
}

.footer p {
    margin: 0.25rem 0;
}

#thinking-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 3px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.75rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.dark-mode-toggle {
    padding: 0.5rem;
    background-color: transparent;
    border: 1px solid var(--border-light);
    border-radius: 0.5rem;
    cursor: pointer;
    color: var(--text-muted-light);
}

.dark .dark-mode-toggle {
    border-color: var(--border-dark);
    color: var(--text-muted-dark);
}

.citations {
    margin-top: 1.5rem;
    border-top: 1px solid #d1d5db;
    padding-top: 1rem;
}

.dark .citations {
    border-top-color: #4b5563;
}

.citations h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted-light);
    margin: 0 0 0.75rem 0;
}

.dark .citations h4 {
    color: var(--text-muted-dark);
}

.citation {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.citation-number {
    font-size: 0.75rem;
    color: var(--text-muted-light);
    background-color: #f3f4f6;
    border-radius: 50%;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dark .citation-number {
    background-color: #374151;
    color: var(--text-muted-dark);
}

.citation-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.citation-content a:hover {
    text-decoration: underline;
}

.citation-title {
    font-weight: 500;
    font-size: 0.875rem;
}

.citation-type {
    font-size: 0.75rem;
    color: var(--text-muted-light);
}

.dark .citation-type {
    color: var(--text-muted-dark);
}

.follow-ups {
    margin-top: 1.5rem;
    border-top: 1px solid #d1d5db;
    padding-top: 1rem;
}

.dark .follow-ups {
    border-top-color: #4b5563;
}

.follow-ups h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted-light);
    margin: 0 0 0.75rem 0;
}

.dark .follow-ups h4 {
    color: var(--text-muted-dark);
}

.follow-up-question {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--text-light);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dark .follow-up-question {
    color: var(--text-dark);
}

.follow-up-question:hover {
    background-color: #f3f4f6;
    border-color: var(--border-light);
}

.dark .follow-up-question:hover {
    background-color: #374151;
    border-color: var(--border-dark);
}

.error-message {
    color: #b91c1c;
    background-color: #fee2e2;
    border: 1px solid #fca5a5;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
}

.dark .error-message {
    color: #fca5a5;
    background-color: #450a0a;
    border-color: #b91c1c;
}

/* OOG Answer Formatting */
.oog-answer {
    font-family: var(--font-body);
    line-height: 1.6;
    font-size: 0.95rem;
}

.oog-answer h3 {
    color: #1e40af;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-light);
    line-height: 1.4;
}

.dark .oog-answer h3 {
    color: #60a5fa;
    border-bottom-color: var(--border-dark);
}

.oog-answer ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
    list-style-type: disc;
}

.oog-answer li {
    margin-bottom: 0.5rem;
}

.oog-answer p {
    margin-bottom: 1rem;
}

.oog-answer strong {
    font-weight: 600;
    color: var(--text-light);
}

.dark .oog-answer strong {
    color: var(--text-dark);
}

.citations {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-light);
    padding-top: 1rem;
}

.dark .citations {
    border-top-color: var(--border-dark);
}

.citations h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-muted-light);
}

.dark .citations h4 {
    color: var(--text-muted-dark);
}

.citation {
    background-color: #f0f9ff;
    border-left: 4px solid #0ea5e9;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0 0.5rem 0.5rem 0;
}

.dark .citation {
    background-color: #0c4a6e;
    border-left-color: #38bdf8;
}

.citation-number {
    font-weight: 600;
    margin-right: 0.5rem;
    color: #0369a1;
}

.dark .citation-number {
    color: #7dd3fc;
}

.citation-title {
    font-weight: 500;
}

.follow-up-questions {
    margin-top: 1.5rem;
}

.follow-up-questions h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-muted-light);
}

.dark .follow-up-questions h4 {
    color: var(--text-muted-dark);
}

.follow-up-question {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    background-color: #f0f9ff;
    border: 1px solid #e0f2fe;
    color: #0c4a6e;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dark .follow-up-question {
    background-color: #0c4a6e;
    border-color: #075985;
    color: #e0f2fe;
}

.follow-up-question:hover {
    background-color: #e0f2fe;
}

.dark .follow-up-question:hover {
    background-color: #0369a1;
}

/* Error Message Styling */
.message-error .bubble {
    background-color: #fef2f2;
    border-color: #fecaca;
}

.dark .message-error .bubble {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.error-message {
    color: #991b1b;
}

.dark .error-message {
    color: #fca5a5;
}

.error-title {
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
}

.error-text {
    font-size: 0.9rem;
}

/* Streaming Indicator */
.streaming-indicator {
    color: var(--text-muted-light);
    font-style: italic;
}

.dark .streaming-indicator {
    color: var(--text-muted-dark);
}
