html, body {
    height: 100%; /* Ensures the body stretches to the full viewport height */
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Google Sans', Roboto, Arial, sans-serif;
    background-image: url(https://chat.imtechnologies.net/ai1.jpg);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    display: flex;
    flex-direction: column; /* Makes body a flex container for its children */
    align-items: center;
    font-size: 13px;
}

.header {
    background-color: transparent;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    box-shadow: none;
    width: 100%;
    box-sizing: border-box;
    position: fixed; /* Header remains fixed at the top */
    top: 0;
    left: 0;
    z-index: 10;
}

.header-logo {
    /* No specific styles here from original */
}

.header-title {
    display: none;
    font-size: 20px;
    font-weight: 500;
    margin: 0;
    color: white;
}

.chat-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: 95%;
    max-width: 700px;
    
    /* Adjusted margin-bottom to eliminate space */
    margin: 140px 0 0 0; /* Original: 140px 0 5px 0; */
    
    /* Re-calculated fixed height for desktop due to reduced margins */
    /* Previous calc was 100vh - 212px. Reduced 5px from chat-mb & 5px from footer-mt = 10px less vertical space */
    height: calc(100vh - 202px); /* 100vh - 212px + 10px */

    background-color: transparent;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden; /* Crucial for clipping content that spills outside if inner content is scrollable */
    align-self: center;
}

@media (max-width: 768px) {
   .chat-container {
        width: 100%;
        margin: 120px 0 0 0; /* Mobile margin-top remains as is */
        border-radius: 0;
        box-shadow: none;
        /* Re-calculated fixed height for mobile due to reduced margins */
        /* Previous calc was 100vh - 90px. Reduced 5px from chat-mb & 5px from footer-mt = 10px less vertical space */
        height: calc(100vh - 80px); /* 100vh - 90px + 10px */
    }
}

.chat-messages {
    flex-grow: 1; /* Ensures chat messages fill available space within chat-container */
    padding: 20px;
    overflow-y: auto; /* Enables vertical scrolling for messages */
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

/* Custom scrollbar for Webkit browsers */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}
.chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}
.chat-messages::-webkit-scrollbar-track {
    background-color: transparent;
}


.message {
    margin-bottom: 16px;
    padding: 14px 20px;
    border-radius: 24px;
    max-width: 80%;
    clear: both;
    word-break: break-word;
    position: relative;
}

.user-message {
    background-color: #e8f0fe;
    color: #202124;
    align-self: flex-end;
    float: right;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border-bottom-right-radius: 0;
}

.ai-message {
    background-color: #f0f0f0;
    color: #202124;
    align-self: flex-start;
    float: left;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border-bottom-left-radius: 0;
}

/* Styles for the copy icon */
.copy-icon-container {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.message:hover .copy-icon-container {
    opacity: 1;
}

.copy-icon-container:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

.copy-icon-container svg {
    width: 16px;
    height: 16px;
    fill: #555;
}

/* Styles for copy feedback message */
.copy-feedback {
    position: absolute;
    bottom: -25px;
    right: 0;
    background-color: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    white-space: nowrap;
    pointer-events: none;
    z-index: 20;
}

.copy-feedback.show {
    opacity: 1;
}


.input-area {
    display: flex;
    padding: 16px;
    border-top: 1px solid #e0e0e0;
}

input[type="text"] {
    flex-grow: 1;
    padding: 12px 16px;
    border: 1px solid #ccc;
    border-radius: 24px;
    margin-right: 10px;
    font-size: 13px;
    width: calc(100% - 140px);
    box-sizing: border-box;
    outline: none;
}

input[type="text"]:focus {
    border-color: #a7d0f0;
    box-shadow: 0 0 8px rgba(167, 208, 240, 0.6);
}

button {
    padding: 12px 20px;
    background-color: #1a73e8;
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

button:hover {
    background-color: #0d47a1;
}

button:focus {
    outline: none;
    box-shadow: 0 0 10px rgba(26, 115, 232, 0.5);
}

.loading-indicator {
    color: #757575;
    font-size: 0.9em;
    margin-top: 8px;
    align-self: center;
    display: none;
}

.suggested-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    justify-content: center;
}

.suggested-question {
    background-color: #e0e0e0;
    color: #202124;
    padding: 8px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 11px;
    transition: background-color 0.3s ease;
    border: none;
}

.suggested-question:hover {
    background-color: #c2c2c2;
}

.footer {
    margin-top: 0; /* Original: 5px; Reduced to eliminate space */
    font-size: 0.7em;
    color: #777;
    text-align: center;
    padding: 16px;
    box-sizing: border-box;
}

/* Animation for new messages fading in */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.new-message {
    animation: fadeIn 0.2s ease-out forwards;
}

/* --- Animated Typing Dots Styles --- */
.typing-indicator-dots {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 4px;
    height: 1.2em;
}

.typing-indicator-dots .dot {
    width: 6px;
    height: 6px;
    background-color: #888;
    border-radius: 50%;
    margin: 0 2px;
    opacity: 0;
    animation: bounce-dots 1.4s infinite ease-in-out;
}

/* Stagger the animation for each dot */
.typing-indicator-dots .dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator-dots .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator-dots .dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Define the animation for the bouncing dots */
@keyframes bounce-dots {
    0%, 80%, 100% {
        opacity: 0;
        transform: scale(0);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Optional: adjust the AI message bubble for typing state if you want it to be slightly smaller or different */
.ai-message.typing-state {
    /* padding-right: 15px; */
}

/* Custom CSS for text gradient */
.footer-gradient-text {
    color: #00f; /* Fallback */
    background: linear-gradient(to right, #5ec0fd, #db6d90);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    display: inline-block;
}