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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 800px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    height: 90vh;
    max-height: 800px;
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    text-align: center;
    border-radius: 20px 20px 0 0;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
}

.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Messages */
.message {
    margin-bottom: 15px;
    display: flex;
    animation: fadeIn 0.3s ease-in;
}

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

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
}

.user-message {
    justify-content: flex-end;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message {
    justify-content: flex-start;
}

.bot-message .message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    margin: 0 20px 15px 20px;
}

.typing-indicator.active {
    display: flex;
    gap: 4px;
    animation: fadeIn 0.3s ease-in;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input Area */
.input-area {
    display: flex;
    gap: 10px;
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

#userInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s;
}

#userInput:focus {
    border-color: #667eea;
}

button {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: scale(0.95);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

#resetButton {
    background: #ff4757;
}

#resetButton:hover {
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
}

/* Footer */
.footer {
    padding: 12px;
    text-align: center;
    font-size: 12px;
    color: #999;
    background: white;
    border-radius: 0 0 20px 20px;
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .header {
        border-radius: 0;
    }

    .header h1 {
        font-size: 24px;
    }

    .subtitle {
        font-size: 12px;
    }

    .message-content {
        max-width: 85%;
    }

    .footer {
        border-radius: 0;
    }
}

/* RTL Support */
[dir="rtl"] .user-message {
    justify-content: flex-start;
}

[dir="rtl"] .bot-message {
    justify-content: flex-end;
}

[dir="rtl"] .user-message .message-content {
    border-bottom-right-radius: 18px;
    border-bottom-left-radius: 4px;
}

[dir="rtl"] .bot-message .message-content {
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 4px;
}
