/* Reset and base styles */
html {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: #F5F7FA;
    margin: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: #2D3748;
    line-height: 1.5;
}

/* Chat container */
#chat-container {
    width: 100vw;
    height: calc(100vh - 45px);
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    overflow: hidden;
}

/* Chat header */
#chat-header {
    padding: 16px 20px;
    background: #4A6FFF;
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

#chat-header h2 {
    margin: 0;
    font-size: 18px;
}

#chat-status {
    font-size: 12px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 12px;
}

/* Chat window */
#chat-window {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    scrollbar-width: thin;
    scrollbar-color: #CBD5E0 #F5F7FA;
}

#chat-window::-webkit-scrollbar {
    width: 8px;
}

#chat-window::-webkit-scrollbar-thumb {
    background: #CBD5E0;
    border-radius: 4px;
}

/* Message containers */
.message-container {
    display: flex;
    flex-direction: column;
    margin: 12px 0;
    animation: fadeIn 0.3s ease-out;
}

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

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

/* User message (bubble style) */
.message.user {
    background: #3B82F6;
    color: #FFFFFF;
    border-radius: 12px;
    padding: 10px 14px;
    max-width: 70%;
    margin-left: auto;
    text-align: right;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
    word-wrap: break-word;
    font-size: 15px;
}

/* Assistant message (full width, no bubble) */
.message.bot {
    width: 100%;
    padding: 10px 0;
    color: #1F2937;
    text-align: left;
    word-wrap: break-word;
    font-size: 15px;
}

/* Message time */
.message-time {
    font-size: 12px;
    margin-top: 4px;
    opacity: 0.7;
}

/* Input area */
#input-area {
    display: flex;
    padding: 12px;
    border-top: 1px solid #E5E7EB;
    background: #FFFFFF;
    flex-shrink: 0;
}

#message-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

#message-input:focus {
    border-color: #3B82F6;
}

#message-input:disabled {
    background: #F0F2F5;
    cursor: not-allowed;
}

#send-button {
    padding: 12px 20px;
    margin-left: 8px;
    background: #3B82F6;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

#send-button:hover {
    background: #2563EB;
}

#send-button:disabled {
    background: #CBD5E0;
    cursor: not-allowed;
}

#send-button svg {
    margin-left: 6px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    padding: 8px 0;
    width: 100%;
    opacity: 0;
    transition: opacity 0.3s;
}

.typing-indicator.active {
    opacity: 1;
}

.dot {
    width: 8px;
    height: 8px;
    background: #3B82F6;
    border-radius: 50%;
    margin: 0 2px;
    animation: bounce 1.5s infinite;
}

.dot:nth-child(2) { animation-delay: 0.1s; }
.dot:nth-child(3) { animation-delay: 0.2s; }

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* Scroll-down button */
#scroll-down-button {
    position: fixed;
    bottom: 70px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: #4A6FFF;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#scroll-down-button.visible {
    opacity: 1;
}

#scroll-down-button:hover {
    background: #3B5FE3;
}

/* Disclaimer banner */
#disclaimer-banner {
    width: 100%;
    min-height: 45px;
    background: #F0F2F5;
    border-top: 1px solid #E2E8F0;
    padding: 8px 16px;
    font-size: 12px;
    color: #4A5568;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

#disclaimer-banner a {
    color: #3B82F6;
    text-decoration: none;
}

#disclaimer-banner a:hover {
    text-decoration: underline;
}

/* Markdown styling */
.message.bot p {
    margin: 8px 0;
}

.message.bot ul, .message.bot ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message.bot pre {
    background: #F5F7FA;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.message.bot code {
    font-family: 'Consolas', monospace;
    background: #F5F7FA;
    padding: 2px 4px;
    border-radius: 3px;
}

.message.bot pre code {
    background: none;
    padding: 0;
}

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

/* Responsive design */
@media (max-width: 600px) {
    #chat-header {
        padding: 12px 16px;
    }
    #chat-header h2 {
        font-size: 16px;
    }
    #chat-window {
        padding: 12px;
    }
    .message.user {
        max-width: 80%;
        font-size: 14px;
    }
    .message.bot {
        font-size: 14px;
    }
    #input-area {
        padding: 8px;
    }
    #message-input {
        padding: 10px;
        font-size: 14px;
    }
    #send-button {
        padding: 10px 16px;
        font-size: 14px;
    }
    #disclaimer-banner {
        font-size: 11px;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .message.user {
        max-width: 85%;
    }
    #send-button {
        padding: 8px 12px;
    }
    #send-button span {
        display: none;
    }
    #scroll-down-button {
        bottom: 65px;
        right: 8px;
        width: 35px;
        height: 35px;
    }
}