/* General Body & Layout */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #f0f2f5;
    color: #333;
}

/* Header */
header {
    background-color: #ffffff;
    padding: 10px 20px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-logo {
    max-height: 50px;
    width: auto;
}

.header-subtitle {
    margin: 5px 0 0;
    font-size: 1.2em;
    font-weight: 400;
    color: #555;
    letter-spacing: 0.5px;
}

/* Main Chat Area */
.chat-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    width: 100%;
    margin: 20px auto;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.chat-history {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Chat Messages */
.message {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 80%;
    line-height: 1.5;
}

.message.user {
    background-color: #007bff;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    background-color: #e9e9eb;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.assistant.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message p {
    margin: 0;
}

.message ul {
    padding-left: 20px;
    margin-top: 10px;
    margin-bottom: 0;
}

/* Loading Indicator */
.loading {
    text-align: center;
    padding: 10px;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: #007bff;
    animation: spin 1s ease infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Input Form */
.chat-form {
    display: flex;
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    background-color: #f8f9fa;
}

.chat-form input {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 20px;
    margin-right: 10px;
    font-size: 16px;
}

.chat-form button {
    padding: 10px 20px;
    border: none;
    background-color: #007bff;
    color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}

.chat-form button:hover {
    background-color: #0056b3;
}

/* Footer */
footer {
    background-color: #343a40;
    color: #f8f9fa;
    padding: 15px 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    font-size: 1em;
    position: sticky;
    bottom: 0;
    z-index: 10;
}
