body, html {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    height: 100%;
}

/* Main container */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    width: 100%;
    background-color: #f5f5f5;
    overflow: hidden;
}

/* Header area with clear button */
.chat-header {
    display: flex;
    justify-content: flex-end;
    padding: 8px 16px;
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
}

.clear-button {
    background-color: transparent;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.clear-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Messages container */
#chat-container, .messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

/* Individual message styles */
.message {
    max-width: 80%;
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.4;
}

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

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

/* Markdown styles have been moved to integration_chat.templ */
/* Input area */
.input-container {
    display: flex;
    padding: 10px;
    background-color: white;
    border-top: 1px solid #e0e0e0;
    position: sticky;
    bottom: 0;
    width: 100%;
    z-index: 100;
}

.input-form, #message-form {
    display: flex;
    width: 100%;
}

.message-input, #message-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #e0e0e0;
    background-color: white;
    color: #333;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    resize: none;
    max-height: 100px; /* Limit height to prevent it from growing too large */
    min-height: 40px; /* Ensure minimum height for visibility */
    margin-bottom: 0; /* Remove any bottom margin that might cause it to be cut off */
}

.send-button, button[type="submit"] {
    margin-left: 8px;
    padding: 0 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
}

.send-button:hover, button[type="submit"]:hover {
    background-color: #007bff;
    filter: brightness(0.9);
}

.send-button:disabled, button[type="submit"]:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Generic button styles */
button {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

button:hover {
    background-color: #0069d9;
}

#thinking span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #333;
    border-radius: 50%;
    margin-right: 3px;
    animation: typing 1s infinite;
    opacity: 0.6;
}

#thinking span:nth-child(2) {
    animation-delay: 0.2s;
}

#thinking span:nth-child(3) {
    animation-delay: 0.4s;
    margin-right: 0;
}

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

/* Integration details styles have been moved to integration_chat.templ */

/* Tool Call Display Styles - Light Blue Chat Bubble */
.tool-call {
    background: linear-gradient(135deg, #e3f2fd 0%, #e8f4fc 100%);
    border: 1px solid #bbdefb;
    border-radius: 12px;
    margin: 12px 0;
    padding: 12px 16px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 13px;
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.1);
}

.tool-call.tool-calling {
    border-left: 4px solid #ff9800;
    background: linear-gradient(135deg, #fff8e1 0%, #fffde7 100%);
    border-color: #ffe082;
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0%, 100% { border-left-color: #ff9800; }
    50% { border-left-color: #ffb74d; }
}

.tool-call.tool-completed {
    border-left: 4px solid #2196f3;
    background: linear-gradient(135deg, #e3f2fd 0%, #e8f4fc 100%);
    border-color: #90caf9;
}

.tool-call.tool-error {
    border-left: 4px solid #f44336;
    background: linear-gradient(135deg, #ffebee 0%, #fce4ec 100%);
    border-color: #ef9a9a;
}

.tool-call .tool-header {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: default;
}

.tool-call .tool-toggle-btn {
    background: rgba(33, 150, 243, 0.15);
    border: 1px solid rgba(33, 150, 243, 0.3);
    padding: 4px 10px;
    cursor: pointer;
    font-size: 11px;
    color: #1976d2;
    border-radius: 12px;
    margin: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-call .tool-toggle-btn:hover {
    background: rgba(33, 150, 243, 0.25);
    border-color: rgba(33, 150, 243, 0.5);
    color: #1565c0;
    transform: scale(1.05);
}

.tool-call .toggle-icon {
    font-family: monospace;
    font-size: 10px;
    transition: transform 0.2s ease;
}

.tool-call.expanded .toggle-icon {
    transform: rotate(90deg);
}

.tool-call .tool-icon {
    font-size: 16px;
}

.tool-call .tool-name {
    font-weight: 600;
    color: #1565c0;
    font-size: 14px;
}

.tool-call .tool-agent {
    color: #64b5f6;
    font-size: 12px;
    font-style: italic;
}

.tool-call .tool-status {
    margin-left: auto;
    font-size: 11px;
    text-transform: lowercase;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 10px;
}

.tool-call.tool-calling .tool-status {
    background-color: #ff9800;
    color: white;
}

.tool-call.tool-completed .tool-status {
    background-color: #2196f3;
    color: white;
}

.tool-call.tool-error .tool-status {
    background-color: #f44336;
    color: white;
}

.tool-call .tool-output {
    margin-top: 8px;
    padding: 8px;
    background-color: #282c34;
    border-radius: 4px;
    overflow-x: auto;
}

.tool-call .tool-output pre {
    margin: 0;
    padding: 0;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    color: #abb2bf;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
}

.tool-call.expanded {
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Tool details container (args + output) */
.tool-call .tool-details {
    margin-top: 8px;
    border-top: 1px solid #dee2e6;
    padding-top: 8px;
}

/* Tool arguments section */
.tool-call .tool-args {
    margin-bottom: 8px;
    padding: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
}

.tool-call .tool-args-label,
.tool-call .tool-output-label {
    font-size: 11px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.tool-call .tool-args pre {
    margin: 0;
    padding: 0;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 11px;
    color: #495057;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 200px;
    overflow-y: auto;
}

/* Animation for calling state */
.tool-call.tool-calling .tool-icon {
    animation: pulse 1.5s ease-in-out infinite;
}

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