/* Main styles for TechCorp Chat Assistant */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: transparent; /* Make body background transparent for iframe */
    height: 100vh;
    width: 100vw;
    padding: 0;
    margin: 0;
    overflow: hidden; /* Prevent scrollbars on the iframe content */
}

/* Wrapper for the chatbot and toggle button */
.chatbot-wrapper {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Styles for the chat container */
.chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 400px;
    max-width: 400px;
    min-width: 400px;
    height: 500px; /* Decreased height */

    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0); /* Initially hidden */
    transform-origin: bottom right;
    transition: all 0.3s ease-in-out;
    z-index: 1050;
}

.chat-container.open {
    transform: scale(1);
}

/* Styles for the chat toggle button */
.chat-toggle-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 70px; /* Increased width */
    height: 70px; /* Increased height */
    background-color: transparent; /* Make background transparent for lottie */
    color: #185bac;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0; /* Remove padding */
    border-radius: 70px; /* Remove border-radius to remove circle */
    border: unset;
    margin: 0; /* Remove margin */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease, opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease; /* Add transitions for opacity and transform */
    z-index: 1100;
    overflow: visible; /* Allow overflow for bigger lottie */
}

.chat-toggle-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
}

.chat-toggle-button.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateX(100px); /* Move out to the right */
}
.chat-header {
    background: white;
    color: black;
    padding: 10px; /* Decreased padding for smaller height */
    text-align: center;
    border-radius: 20px 20px 0 0;
    border-bottom: 1px solid #e1e8ed;
    display: flex; /* Added flexbox for alignment */
    justify-content: space-between; /* Space out logo and close button */
    align-items: center; /* Vertically align items */
}
.logo {
    padding: 10px;
}
.logo img {
    height: 40px;
}
.close-button {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}
.close-button:hover {
    background-color: #f0f0f0;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}
.message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    animation: fadeIn 0.3s ease-in;
}
.message.user {
    justify-content: flex-end;
}
.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
}
.message.user .message-content {
    background: #01abfe;
    color: white;
    border-bottom-right-radius: 6px;
}
.message.bot .message-content {
    background: white;
    color: #333;
    border: 1px solid #e1e8ed;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 26px; /* Added padding for markdown content */
    line-height:25px
}
p{
    margin-bottom: 14px; /* Remove default margin for paragraphs */
}
.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    overflow: hidden; /* Ensure image is clipped to circle */
}
.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover the area without distortion */
}
.message.user .message-avatar {
    display: none; /* Hide user avatar */
}
.message.bot .message-avatar {
    background: white;
    border: 1px solid #01abfe; /* Blue border */
    color: white;
}
.chat-input {
    padding: 20px;
    background: white;
    border-top: 1px solid #e1e8ed;
    display: flex;
    gap: 10px;
}
.input-field {
    flex: 1;
    padding: 10px 15px; /* Decreased padding for smaller height */
    border: 2px solid #e1e8ed;
    border-radius: 20px; /* Adjusted border-radius for a nicer look */
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}
.input-field:focus {
    border-color: #01abfe;
    box-shadow: 0 0 0 3px rgba(1, 171, 254, 0.1);
}
.send-button {
    background-color: #fff;
    color: #185bac;
    font-weight: 700;
    font-size: 1rem; /* Adjusted font size to match input */
    padding: 10px 20px; /* Adjusted padding to match input height */
    border-radius: 20px; /* Adjusted border-radius to match input */
    border: unset;
    margin: 0; /* Removed margin to align better */
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}
.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(1, 171, 254, 0.3);
}
.send-button:active {
    transform: translateY(0);
}
.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.disclaimer-text {
    font-size: 10px;
    color: #666;
    text-align: center;
    padding: 10px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e1e8ed;
}
.typing-indicator {
    display: none; /* Hidden by default */
    padding: 15px;
    color: #666;
    font-style: italic;
}
.typing-indicator.show {
    display: flex; /* Display as flex when 'show' class is present */
    align-items: center; /* Vertically align items */
    gap: 10px; /* Space between image and text */
}
.error-message {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 400px; /* Desired width when open */
    height: 700px; /* Desired height when open */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0); /* Initially hidden */
    transform-origin: bottom right;
    transition: all 0.3s ease-in-out;
    z-index: 1050;
}
.config-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 10px;
}
.config-label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 768px) {
    .chat-container {
        width: 100%; /* Full width */
        max-width: 100%;
        min-width: unset;
        height: 100%; /* Full height */
        max-height: 100%;
        min-height: unset;
        border-radius: 0; /* No border-radius for full screen */
        top: 0; /* Connect to top */
        left: 0; /* Connect to left */
        right: 0; /* Connect to right */
        bottom: 0; /* Connect to bottom */
        transform: scale(0); /* Initially hidden on mobile */
        transform-origin: center; /* Center origin for scaling on mobile */
    }
    .chat-container.open {
        transform: scale(1); /* Ensure it scales to 1 when open on mobile */
    }
    .chat-header {
        border-radius: 0;
    }
}
