/* Basic reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f4f5; /* Light and clean background */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* Main chat window - Box styling removed, spans full height */
.app-container {
    width: 100%;
    max-width: 800px;
    height: 100vh;
    background: transparent; /* Removes the white box background */
    border-radius: 0; /* Removes rounded corners */
    box-shadow: none; /* Removes the shadow */
    display: flex;
    flex-direction: column;
    justify-content: center; /* Centers the input horizontally and vertically when empty */
    overflow: hidden;
}

.chat-header {
    background-color: #075e54;
    color: white;
    padding: 16px 20px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Message area */
.chat-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: transparent; /* Removes inner background */
}

/* Hides the chat area completely if there are no messages */
.chat-container:empty {
    display: none;
}

/* Chat bubble styling */
.chat-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    animation: fadeIn 0.3s ease-in-out;
}

/* Expands the bubble when it contains a chart */
.chat-bubble.has-chart {
    max-width: 95%; 
    width: 100%;
}

/* Container for the Plotly chart */
.chart-wrapper {
    margin-top: 12px;
    min-height: 350px; 
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
}

/* User message alignment and color */
.user-msg {
    align-self: flex-end;
    background-color: #f12a7c;
    color: #ffffff; 
    border-bottom-right-radius: 4px;
}

/* AI message alignment and color */
.ai-msg {
    align-self: flex-start;
    background-color: #ffffff;
    color: #303030;
    border-bottom-left-radius: 4px;
}

.loading {
    font-style: italic;
    color: #888;
}

.error-msg {
    background-color: #ffe6e6;
    color: #d9534f;
    border: 1px solid #d9534f;
}

/* Input area */
.input-container {
    display: flex;
    padding: 16px;
    background: transparent; /* Removes gray background */
    border-top: none; /* Removes the top divider line */
    gap: 10px;
}

/* Enhances the input field to look like a floating pill */
input {
    flex: 1;
    padding: 16px 20px;
    border: 1px solid #ddd;
    border-radius: 24px;
    outline: none;
    font-size: 1rem;
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); /* Adds a soft shadow to the input itself */
}

/* Update button base color to the new theme */
button {
    padding: 0 24px;
    background-color: #f12a7c; 
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: background-color 0.2s;
}

/* Update button hover color to a slightly darker shade */
button:hover {
    background-color: #d91a67; 
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cccccc;
    border-radius: 4px;
}

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

/* ------------------------------------------------------------------------------- */

/* Markdown content styling inside bubbles */
.chat-bubble p {
    margin-bottom: 8px;
}

.chat-bubble p:last-child {
    margin-bottom: 0;
}

.chat-bubble ul, .chat-bubble ol {
    margin-left: 20px;
    margin-bottom: 8px;
}

.chat-bubble code {
    background-color: rgba(0, 0, 0, 0.08);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.9em;
}

/* Code blocks (pre code) styling */
.chat-bubble pre {
    background-color: #0d1117;
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    margin: 8px 0;
}

.chat-bubble pre code {
    background-color: transparent;
    padding: 0;
    color: #c9d1d9;
    font-size: 0.85em;
}


/* --- Background Logo --- */
body::after {
    content: "";
    position: fixed;
    bottom: -80px; /* Pushes the image down to cut it off */
    right: -40px;  /* Pushes the image right to cut it off */
    width: 600px;  /* Adjust based on your logo's size */
    height: 600px;
    
    /* Set the path to your logo image */
    background-image: url('logo.png'); 
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    
    /* Tilts the image (adjust the degree as needed) */
    /* transform: rotate(-25deg); */
    
    /* Makes the logo subtle so it doesn't distract from the chat */
    opacity: 0.08; 
    
    /* Ensures the logo stays behind everything and doesn't block clicks */
    z-index: -1;
    pointer-events: none;
}

.limit-warning {
    margin-top: 8px;
    color: #d9534f;
    font-weight: bold;
    font-style: italic;
}