/* Components styles: Chat messages, buttons, input fields, and other UI components */

/* Header components */
.header-icon {
    stroke: white;
}

.chat-header h2 {
    margin: 0;
    font-weight: 600;
    font-size: 1.25rem;
}

/* Button components */
#submit-button {
    width: 42px;
    height: 42px;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

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

/* Theme toggle button */
#theme-toggle {
    background-color: var(--surface-hover);
    color: var(--text-color);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
}

#theme-toggle span {
    display: none; /* Hide the text */
}

/* New topic button */
#new-topic-button {
    background-color: var(--surface-hover);
    color: var(--text-color);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    height: 38px;
    flex: 0 0 auto;
}

#new-topic-button:hover {
    background-color: var(--border-color);
}

/* Model selector */
.model-select-label {
    color: var(--text-color);
    font-size: 0.875rem;
    margin-right: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
}

#model-select {
    background-color: transparent;
    color: var(--text-color);
    border: none;
    font-size: 0.875rem;
    font-family: var(--font-family);
    cursor: pointer;
    outline: none;
    padding: 0.25rem;
    width: 100%;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M6 9l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right center;
    padding-right: 1.5rem;
    text-overflow: ellipsis;
}

/* Input field */
#question-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.5rem;
    color: var(--text-color);
    font-size: 1rem;
    font-family: var(--font-family-secondary);
    resize: none;
    outline: none;
    min-height: 42px;
    max-height: 120px;
}

#question-input::placeholder {
    color: var(--text-light);
}

/* Welcome message styling */
.welcome-message h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
}

.welcome-message p {
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* Suggested questions styling */
.suggested-questions a {
    background-color: var(--surface-color);
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.suggested-questions a:hover {
    background-color: var(--surface-hover);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.suggested-questions a::before {
    content: "→";
    margin-right: 0.5rem;
    color: var(--accent-color);
    font-weight: bold;
}

/* Message styling */
.user-message {
    background-color: var(--primary-color);
    color: white;
}

.response-message {
    background-color: var(--surface-hover);
    color: var(--text-color);
}

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

.message-content {
    line-height: 1.6;
    word-wrap: break-word;
}

.user-message .message-content {
    color: rgba(255, 255, 255, 0.95);
}

.message-content p {
    margin-bottom: 0.875rem;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.user-label, .bot-label {
    font-weight: 600;
}

.user-message .user-label {
    color: white;
}

.response-message .bot-label {
    color: var(--primary-color);
}

/* Sources styling */
.sources {
    color: var(--text-light);
}

.sources a {
    color: var(--primary-color);
    text-decoration: none;
    word-break: break-all;
    display: inline-block;
    margin-top: 0.25rem;
}

.sources a:hover {
    text-decoration: underline;
}

/* Copy button styling */
.copy-button {
    background-color: transparent;
    border: none;
    color: var(--text-light);
    opacity: 0;
    transition: opacity 0.2s, background-color 0.2s;
}

.response-message:hover .copy-button {
    opacity: 0.7;
}

.copy-button:hover {
    opacity: 1 !important;
    background-color: var(--surface-color);
}

.copy-button.copied {
    color: var(--success-color);
}

/* Typing indicator styling */
.typing-indicator {
    background-color: var(--surface-hover);
}

.typing-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 2px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background-color: #bbb;
    border-radius: 50%;
    display: inline-block;
}

/* Error message styling */
.error-message {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.error-details {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    opacity: 0.8;
}

.error-close-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: var(--error-color);
    font-size: 1.25rem;
    cursor: pointer;
}

/* Code blocks inside messages */
.message-content pre {
    background-color: var(--surface-hover);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    overflow-x: auto;
    margin: 0.875rem 0;
}

.message-content code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.875rem;
}

/* Lists in messages */
.message-content ul, .message-content ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.message-content li {
    margin-bottom: 0.5rem;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    #new-topic-button span {
        display: none; /* Hide text on mobile */
    }
    
    #new-topic-button {
        min-width: 38px;
        width: 38px;
        padding: 0.5rem;
        justify-content: center;
    }
    
    .model-select-label {
        font-size: 0.75rem;
    }
    
    #model-select {
        font-size: 0.75rem;
        padding-right: 1.25rem;
    }
}

/* Dark mode specific component styles */
.dark-mode .typing-indicator {
    background-color: rgba(255, 255, 255, 0.08);
}

.dark-mode .typing-label {
    color: #aaa;
}

.dark-mode .typing-dots span {
    background-color: #bbb;
}

/* Ensure all header text is white */
.chat-header h2, 
.chat-header p,
.header-disclaimer p {
    color: white;
}