/* Chat Container */
.chat-container {
    position: fixed;
    bottom: 0;
    right: 20px;
    width: 350px;
    height: 500px;
    background-color: var(--nissan-light);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.chat-container.chat-hidden {
    transform: translateY(calc(100% - 40px));
}

/* Chat Header */
.chat-header {
    background-color: var(--nissan-dark);
    color: var(--nissan-light);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--nissan-red);
    cursor: pointer;
}

.chat-header h3 {
    margin: 0;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chat-header-buttons {
    display: flex;
    gap: 10px;
}

.chat-header-buttons button {
    background: transparent;
    border: none;
    color: var(--nissan-light);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
}

/* Chat Options */
.chat-options {
    padding: 10px;
    background-color: #f8f8f8;
    border-bottom: 1px solid #ddd;
}

.chat-options select {
    width: 100%;
    padding: 8px;
    font-size: 0.9rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: #f9f9f9;
}

.chat-message {
    max-width: 85%;
    padding: 10px 15px;
    border-radius: 18px;
    margin-bottom: 5px;
    position: relative;
}

.user-message {
    align-self: flex-end;
    background-color: var(--nissan-red);
    color: white;
    border-bottom-right-radius: 5px;
}

.assistant-message {
    align-self: flex-start;
    background-color: #e6e6e6;
    color: var(--nissan-gray);
    border-bottom-left-radius: 5px;
}

.system-message {
    align-self: center;
    background-color: #f8d7da;
    color: #721c24;
    font-size: 0.9rem;
    text-align: center;
    border-radius: 10px;
}

/* Code styling in messages */
.assistant-message pre {
    background-color: var(--nissan-dark);
    color: white;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    font-size: 0.9rem;
    margin: 10px 0;
}

.assistant-message code {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
}

/* Loading animation */
.loading-dots {
    display: flex;
    justify-content: center;
}

.loading-dots span {
    animation: dot 1.4s infinite;
    opacity: 0;
    margin: 0 2px;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Chat Input */
.chat-input {
    display: flex;
    padding: 10px;
    background-color: var(--nissan-light);
    border-top: 1px solid #ddd;
}

.chat-input textarea {
    flex: 1;
    resize: none;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    padding: 10px;
    font-size: 0.9rem;
    margin-right: 10px;
    min-height: 40px;
    max-height: 100px;
}

.chat-input button {
    background-color: var(--nissan-red);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 0 15px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.chat-input button:hover {
    background-color: #a30027;
}

/* Toggle Chat Button */
.toggle-chat-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--nissan-red);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 15px;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: none; /* Hide by default on larger screens */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chat-container {
        width: 100%;
        right: 0;
        height: 400px;
    }
    
    .toggle-chat-btn {
        display: block;
    }
    
    .chat-container.chat-hidden {
        transform: translateY(100%);
    }
}