/* Base styles and reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f5f7fb;
    color: #333;
    line-height: 1.6;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Chat container */
.chat-container {
    width: 100%;
    max-width: 800px;
    height: 90vh;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
header {
    background-color: #4a6fa5;
    color: white;
    padding: 20px;
    text-align: center;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

header p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Chat box */
.chat-box {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f9fafc;
}

/* Welcome message */
.welcome-message {
    background-color: #e8f4fd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
    color: #4a6fa5;
}

/* Message styles */
.message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    margin-bottom: 5px;
    word-wrap: break-word;
}

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

.user-message .message-content {
    background-color: #4a6fa5;
    color: white;
    border-bottom-right-radius: 4px;
}

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

.bot-message .message-content {
    background-color: #e9ecef;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.7rem;
    color: #888;
    margin: 0 8px;
}

/* Input area */
.chat-input-container {
    padding: 15px;
    background-color: #fff;
    border-top: 1px solid #e9ecef;
}

form {
    display: flex;
    gap: 10px;
}

textarea {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 24px;
    resize: none;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s;
}

textarea:focus {
    border-color: #4a6fa5;
}

button {
    background-color: #4a6fa5;
    color: white;
    border: none;
    border-radius: 24px;
    padding: 0 20px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
    position: relative;
    min-width: 80px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    background-color: #3a5a8f;
}

button:disabled {
    background-color: #a0b4d0;
    cursor: not-allowed;
}

/* Loader */
.loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    position: absolute;
}

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

.button-text {
    transition: opacity 0.3s;
}

/* Footer */
footer {
    text-align: center;
    padding: 10px;
    background-color: #f9fafc;
    color: #888;
    font-size: 0.8rem;
    border-top: 1px solid #e9ecef;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chat-container {
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
    }
    
    body {
        padding: 0;
    }
    
    .message-content {
        max-width: 90%;
    }
}

/* Error message */
.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    text-align: center;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #bbb;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    opacity: 0.4;
}

.typing-indicator span:nth-child(1) {
    animation: pulse 1s infinite;
}

.typing-indicator span:nth-child(2) {
    animation: pulse 1s infinite 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation: pulse 1s infinite 0.4s;
}

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