/* Chatbot Styles */
.back-button {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #2d50b2, #4a6fd1);
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: 1px solid #1e3a8a;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.back-button:hover {
    background: linear-gradient(135deg, #4a6fd1, #6b8ce8);
    border-color: #3b82f6;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Dark mode styles for back button */
@media (prefers-color-scheme: dark) {
    .back-button {
        background: linear-gradient(135deg, #3bf3f6, #5ff5f8);
        border-color: #0d9488;
        color: #0f172a;
    }
    .back-button:hover {
        background: linear-gradient(135deg, #5ff5f8, #7ff9fc);
        border-color: #14b8a6;
        color: #0f172a;
    }
}
.chatbot-container {
    margin: 2rem auto;
    padding: 0;
    background-color: var(--bg-container);
    border-radius: 1rem;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.chatbot-header {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.chatbot-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.model-selector label {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.9;
    white-space: nowrap;
}

#modelSelect {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    color: white;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    min-width: 200px;
}

#modelSelect:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

#modelSelect:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

#modelSelect option {
    background-color: var(--bg-container);
    color: var(--text-primary);
    padding: 0.5rem;
}

.chatbot-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #4ade80;
    animation: pulse 2s infinite;
}

.status-indicator.typing {
    background-color: #fbbf24;
    animation: pulse 1s infinite;
}

.status-indicator.error {
    background-color: #ef4444;
    animation: none;
}

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

.chatbot-messages {
    height: 600px;
    overflow-y: auto;
    padding: 1.5rem;
    background-color: var(--bg-secondary);
    scroll-behavior: smooth;
}

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

.chatbot-messages::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

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

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

.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: var(--shadow-light);
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #6b7280, #9ca3af);
}

.message-content {
    flex: 1;
    background-color: var(--bg-container);
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    position: relative;
    max-width: 70%;
}

.user-message .message-content {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    border-color: transparent;
}

.user-message .message-content::before {
    content: '';
    position: absolute;
    top: 15px;
    right: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid var(--accent-color);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.bot-message .message-content::before {
    content: '';
    position: absolute;
    top: 15px;
    left: -8px;
    width: 0;
    height: 0;
    border-right: 8px solid var(--bg-container);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.message-content p {
    margin: 0 0 0.75rem 0;
    line-height: 1.5;
}

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

.model-info {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 0.25rem;
    border-left: 3px solid var(--accent-color);
    font-style: italic;
}

.message-content ul {
    margin: 0.75rem 0;
    padding-left: 1.25rem;
}

.message-content li {
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.error-message {
    background-color: #fef2f2 !important;
    border-color: #fecaca !important;
    color: #dc2626 !important;
}

.user-message .error-message {
    background-color: #dc2626 !important;
    color: white !important;
}

.chatbot-input-container {
    padding: 1.5rem;
    background-color: var(--bg-container);
    border-top: 1px solid var(--border-color);
}

.chatbot-form {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.input-group {
    display: flex;
    flex: 1;
    gap: 0.75rem;
    align-items: flex-end;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-group:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(45, 80, 178, 0.1);
}

#messageInput {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    min-height: 24px;
    max-height: 120px;
    font-family: inherit;
}

#messageInput::placeholder {
    color: var(--text-secondary);
}

.send-button {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.send-button:active:not(:disabled) {
    transform: translateY(0);
}

.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chatbot-container {
        margin: 1rem auto;
        border-radius: 0.75rem;
    }
    
    .chatbot-header {
        padding: 1rem 1.5rem;
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    
    .chatbot-controls {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }
    
    .model-selector {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    #modelSelect {
        min-width: 100%;
        width: 100%;
    }
    
    .chatbot-header h2 {
        font-size: 1.25rem;
    }
    
    .chatbot-messages {
        height: 500px;
        padding: 1rem;
    }
    
    .message {
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
    }
    
    .message-content {
        padding: 0.75rem 1rem;
        max-width: 85%;
    }
    
    .chatbot-input-container {
        padding: 1rem;
    }
    
    .chatbot-form {
        gap: 0.5rem;
    }
    
    .input-group {
        padding: 0.5rem;
        border-radius: 0.75rem;
    }
    
    .send-button {
        width: 36px;
        height: 36px;
    }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .chatbot-messages {
        background-color: var(--bg-primary);
    }
    
    .input-group {
        background-color: var(--bg-primary);
    }
    
    .bot-message .message-content::before {
        border-right-color: var(--bg-container);
    }
    
    .error-message {
        background-color: #7f1d1d !important;
        border-color: #991b1b !important;
        color: #fca5a5 !important;
    }
    
    .user-message .error-message {
        background-color: #991b1b !important;
        color: #fca5a5 !important;
    }
    
    .model-info {
        background: rgba(255, 255, 255, 0.1) !important;
        color: var(--text-secondary) !important;
    }
}
