* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    height: 100vh;
    overflow: hidden;
}

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

/* Header */
.app-header {
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.header-title i {
    font-size: 1.5rem;
    color: #6366f1;
}

.header-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
}

.header-subtitle {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Provider Selection */
.provider-selection {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.provider-selection label {
    color: #ccc;
    font-weight: 500;
    font-size: 0.9rem;
}

.provider-select {
    background: #6366f1;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.provider-select:hover {
    background: #5855eb;
    transform: translateY(-1px);
}

.provider-select option {
    background: #2a2a2a;
    color: #ffffff;
    padding: 0.5rem;
}

.provider-select optgroup {
    background: #1a1a1a;
    color: #ccc;
    font-weight: bold;
    font-size: 0.9rem;
}

.provider-info {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
}

.settings-button {
    background: #2a2a2a;
    color: #ccc;
    border: 1px solid #444;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 1rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-button:hover {
    background: #333;
    color: #6366f1;
    border-color: #6366f1;
    transform: translateY(-1px);
}

#providerInfo {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

#providerInfo::before {
    content: "•";
    color: #6366f1;
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 1rem 2rem;
    height: calc(100vh - 120px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 2rem;
    background: #1a1a1a;
    border-radius: 20px;
    margin: 2rem auto;
    max-width: 700px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
}

.welcome-icon {
    font-size: 3rem;
    color: #6366f1;
    margin-bottom: 1rem;
}

.welcome-message h2 {
    color: #ffffff;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.welcome-message p {
    color: #ccc;
    margin-bottom: 2rem;
}

.example-questions h3 {
    color: #ccc;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.example-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.example-btn {
    background: #2a2a2a;
    color: white;
    border: 1px solid #444;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 400;
    text-align: left;
    justify-content: flex-start;
}

.example-btn:hover {
    background: #333;
    border-color: #6366f1;
    transform: translateY(-1px);
}

/* Message Styles */
.message {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: flex-start;
}

.message-bubble {
    max-width: 80%;
    padding: 1rem 1.5rem;
    border-radius: 20px;
    position: relative;
    word-wrap: break-word;
}

.message.user .message-bubble {
    background: #6366f1;
    color: white;
    border-bottom-right-radius: 8px;
}

.message.assistant .message-bubble {
    background: #1a1a1a;
    color: #ffffff;
    border-bottom-left-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
}

.message-meta {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 0.5rem;
}

.message.assistant .message-meta {
    color: #888;
}

/* Response Content */
.response-content {
    line-height: 1.6;
}

.response-content h1, 
.response-content h2, 
.response-content h3 {
    color: #ffffff;
    margin: 1rem 0 0.5rem 0;
    font-weight: 600;
}

.response-content p {
    margin-bottom: 1rem;
}

.response-content ul, 
.response-content ol {
    margin: 0.5rem 0 1rem 1.5rem;
}

.response-content li {
    margin-bottom: 0.25rem;
}

.response-content strong {
    font-weight: 600;
    color: #ffffff;
    /* Remove background highlighting to match OpenAI style */
}

/* Citations */
.citations {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #333;
}

.citations-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: #ccc;
    font-weight: 600;
}

.citation {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #2a2a2a;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    border: 1px solid #444;
}

.citation:hover {
    background: #333;
    transform: translateX(4px);
    border-color: #6366f1;
}

.citation-number {
    background: #6366f1;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    flex-shrink: 0;
    margin-top: 2px;
}

.citation-content {
    flex: 1;
}

.citation-title {
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.citation-url {
    color: #6366f1;
    text-decoration: none;
    font-size: 0.85rem;
    word-break: break-all;
    transition: color 0.3s ease;
}

.citation-url:hover {
    color: #8b5cf6;
    text-decoration: underline;
}

/* Highlights */
.highlights {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #333;
}

.highlights-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: #ccc;
    font-weight: 600;
}

.highlight-item {
    background: #2a2a2a;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    border-left: 4px solid #6366f1;
    font-weight: 500;
    color: #ffffff;
    border: 1px solid #444;
}

/* Input Area */
.chat-input-container {
    padding: 1rem 0;
}

.chat-form {
    max-width: 100%;
}

.input-wrapper {
    display: flex;
    background: #2a2a2a;
    border-radius: 25px;
    padding: 0.5rem;
    border: 1px solid #444;
    transition: border-color 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: #6366f1;
}

#messageInput {
    flex: 1;
    border: none;
    outline: none;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background: transparent;
    color: #ffffff;
}

#messageInput::placeholder {
    color: #888;
}

#sendButton {
    background: #6366f1;
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#sendButton:hover {
    background: #5855eb;
    transform: scale(1.05);
}

#sendButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.loading-spinner p {
    font-size: 1.2rem;
    font-weight: 500;
}

/* Error Toast */
.error-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fed7d7;
    color: #c53030;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid #feb2b2;
    display: none;
    align-items: center;
    gap: 0.75rem;
    z-index: 1001;
    max-width: 400px;
    box-shadow: 0 5px 20px rgba(197, 48, 48, 0.2);
}

.error-toast button {
    background: none;
    border: none;
    color: #c53030;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.error-toast button:hover {
    background: rgba(197, 48, 48, 0.1);
}

/* Settings Modal */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.settings-content {
    background: #1a1a1a;
    border-radius: 20px;
    border: 1px solid #333;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #333;
}

.settings-header h2 {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-header h2 i {
    color: #6366f1;
}

.close-button {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.close-button:hover {
    color: #ffffff;
    background: #333;
}

.settings-body {
    padding: 2rem;
}

.setting-group {
    margin-bottom: 2rem;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.setting-group textarea {
    width: 100%;
    min-height: 120px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 12px;
    padding: 1rem;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.3s ease;
}

.setting-group textarea:focus {
    border-color: #6366f1;
}

.setting-group textarea::placeholder {
    color: #888;
}

.setting-description {
    margin-top: 0.5rem;
    color: #888;
    font-size: 0.8rem;
    line-height: 1.4;
}

.quick-prompts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.quick-prompt-btn {
    background: #2a2a2a;
    color: #ffffff;
    border: 1px solid #444;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    justify-content: center;
}

.quick-prompt-btn:hover {
    background: #333;
    border-color: #6366f1;
    transform: translateY(-1px);
}

.quick-prompt-btn i {
    color: #6366f1;
}

.settings-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.reset-button, .save-button {
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    border: none;
}

.reset-button {
    background: #2a2a2a;
    color: #ffffff;
    border: 1px solid #444;
}

.reset-button:hover {
    background: #333;
    border-color: #666;
}

.save-button {
    background: #6366f1;
    color: #ffffff;
}

.save-button:hover {
    background: #5855eb;
    transform: translateY(-1px);
}

/* Success Toast */
.success-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #d4edda;
    color: #155724;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid #c3e6cb;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1002;
    box-shadow: 0 5px 20px rgba(21, 87, 36, 0.2);
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .app-header {
        padding: 1rem;
    }
    
    .chat-container {
        padding: 0.5rem 1rem 1rem;
    }
    
    .message-bubble {
        max-width: 95%;
    }
    
    .example-buttons {
        grid-template-columns: 1fr;
    }
    
    .header-title h1 {
        font-size: 1.25rem;
    }
}