/**
 * Public CSS for OpenAI Chatbot Plugin
 */

/* Main container */
.openai-chatbot-container {
    position: fixed;
    bottom: 5px !important;
    right: 5px !important;
    width: 60px;
    height: 60px;
    z-index: 9998;
    display: flex;
    justify-content: center;
    /* Add transform to handle zoom better */
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}

/* Toggle button */
.openai-chatbot-toggle {
    position: absolute;
    bottom: 0 !important;
    right: 0 !important;
    width: 60px !important;
    height: 60px !important;
    background-color: #4264fb !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(66, 100, 251, 0.4) !important;
    z-index: 9999; /* Increased z-index to be above widget */
    transition: all 0.3s ease;
    border: none !important;
    /* Add transform to handle zoom */
    transform: translateZ(0);
    will-change: transform;
}

/* Style for the icon wrapper spans */
.openai-chatbot-toggle .toggle-icon {
    position: absolute !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out !important;
}

/* Default state - chat icon visible, close icon hidden */
.openai-chatbot-toggle .chat-icon {
    opacity: 1 !important;
    transform: rotate(0deg) scale(1) !important;
    z-index: 2 !important;
}

.openai-chatbot-toggle .close-icon {
    opacity: 0 !important;
    transform: rotate(90deg) scale(0.5) !important;
    z-index: 1 !important;
}

/* Open state - chat icon hidden, close icon visible */
.openai-chatbot-toggle.is-open .chat-icon {
    opacity: 0 !important;
    transform: rotate(-90deg) scale(0.5) !important;
    z-index: 1 !important;
}

.openai-chatbot-toggle.is-open .close-icon {
    opacity: 1 !important;
    transform: rotate(0deg) scale(1) !important;
    z-index: 2 !important;
}

.openai-chatbot-toggle i {
    font-size: 28px;
    color: white !important;
}

/* Toggle button state when chat is open */
.openai-chatbot-toggle.is-open {
    background-color: #DD4747 !important; /* Optional: different color for close state */
}

/* "We are here" text */
.openai-chatbot-toggle-text {
    position: absolute;
    bottom: 80px;
    right: 0;
    background: white;
    color: #333;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    white-space: nowrap;
    animation: pulse-text 2s infinite ease-in-out;
    margin-top: 10px;
}

/* Animation for the "We are here" text */
@keyframes pulse-text {
    0% {
        transform: translateY(0);
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    50% {
        transform: translateY(-3px);
        box-shadow: 0 5px 12px rgba(0,0,0,0.15);
    }
    100% {
        transform: translateY(0);
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
}

/* Ensure animations work on mobile too */
@media (max-width: 767px) {
    .openai-chatbot-toggle-text {
        bottom: 80px;
        right: 0;
        animation: pulse-text 2s infinite ease-in-out;
        margin-top: 10px;
    }
}

/* Widget */
.openai-chatbot-widget {
    position: fixed;
    bottom: 80px !important;
    right: 5px !important;
    width: 360px; /* Decreased from 400px to 360px (10% reduction) */
    max-width: calc(100% - 40px);
    height: 700px; /* Increased from 600px to 700px for taller chat window */
    max-height: calc(100vh - 100px); /* Increased from calc(100vh - 130px) to allow more screen space usage */
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.25);
    z-index: 9998; /* Below the toggle button */
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    transform-origin: bottom right;
    /* Add transform to handle zoom */
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}

/* Widget open state with smoother animation */
.openai-chatbot-widget.openai-chatbot-widget-open {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    animation: chat-window-open 0.3s ease-out forwards;
}

/* Animation for chat window opening */
@keyframes chat-window-open {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Make sure the toggle stays in the same position when widget is open */
.openai-chatbot-widget-open + .openai-chatbot-container .openai-chatbot-toggle {
    position: fixed !important;
    bottom: 5px !important;
    right: 5px !important;
    z-index: 9999 !important;
    /* Add transform to handle zoom */
    transform: translateZ(0);
}

/* Header */
.openai-chatbot-header {
    padding: 12px 15px; 
    display: flex;
    align-items: flex-start; /* Align items to the top */
    justify-content: space-between; 
    border-bottom: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.openai-chatbot-header-branding {
    display: flex;
    flex-direction: column; 
    align-items: flex-start; 
    margin-right: 5px; /* Reduced space between branding and actions */
    min-width: 0; /* Allow shrinking */
}

.openai-chatbot-header-title {
    display: flex; 
    align-items: center; /* Vertically center name and status */
    font-size: 16px; 
    color: #fff;
    margin-bottom: 3px; /* Space below name/status line */
    line-height: 1.2; /* Adjust line height */
}

/* New Subtitle Styles */
.openai-chatbot-header-subtitle {
    font-size: 13.5px; 
    color: rgba(255, 255, 255, 0.85); 
    line-height: 1.3; 
    margin-top: 0; 
    padding-left: 50px; 
    white-space: nowrap; 
    overflow: hidden; /* Handle overflow */
    text-overflow: ellipsis; /* Add ellipsis if needed */
    max-width: 100%; /* Prevent exceeding parent width */
}

/* Header actions styling */
.openai-chatbot-header-actions {
    display: flex;
    align-items: center; /* Vertically center the button */
    margin-right: 0; 
    flex-shrink: 0; 
}

/* Explicit style for the reset button itself */
.openai-chatbot-reset-btn {
    display: flex; /* Ensure it's treated as a flex item */
    align-items: center;
    justify-content: center;
    width: 32px; /* Restore original size? */
    height: 32px;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Background color is handled by inline style */
}

.openai-chatbot-reset-btn:hover {
    background-color: rgba(220, 53, 69, 1);  /* Brighter red on hover */
    transform: scale(1.05);
}

.openai-chatbot-reset-btn i {
    font-size: 16px;
    color: white;
}

#assistant-header-name {
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    font-size: 19px; /* Increased assistant name font size */
    margin-right: 8px; 
}

.header-status {
    margin-left: 0; /* Reset margin */
    font-size: 11px; /* Slightly larger status text */
    background-color: transparent !important;
    padding: 0 !important;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    line-height: 1; /* Ensure status aligns well */
}

.header-status .status-indicator {
    width: 9px;
    height: 9px;
    margin-right: 4px;
}

.header-status .status-text {
    color: rgba(255, 255, 255, 0.9);
}

/* Back arrow styling */
.openai-chatbot-back-arrow {
    display: none; /* Hide the back arrow */
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.openai-chatbot-back-arrow i {
    font-size: 18px;
    color: #FFFFFF;
}

/* Add hover effect to back arrow */
.openai-chatbot-back-arrow:hover {
    opacity: 0.8;
    transform: translateX(-2px);
    transition: all 0.2s ease;
}

/* Close button */
.openai-chatbot-close {
    background-color: #4264fb !important;
    border: none;
    color: white !important;
    cursor: pointer;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    border-radius: 4px;
    margin-left: 10px;
}

.openai-chatbot-close i {
    font-size: 16px;
    color: white !important;
    display: inline-block !important;
}

/* Conversation area */
.openai-chatbot-conversation {
    padding: 10px;
    flex-grow: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    display: flex;
    flex-direction: column;
}

/* Message wrapper to contain message and timestamp */
.openai-chatbot-message-wrapper {
    margin-bottom: 16px !important;
    clear: both !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    float: none !important;
}

.openai-chatbot-message-wrapper.bot {
    align-items: flex-start !important;
}

.openai-chatbot-message-wrapper.user {
    align-items: flex-end !important;
}

/* Fix message layout - Remove the original margin-bottom from message */
.openai-chatbot-message {
    position: relative;
    margin-bottom: 0 !important; /* Changed from 15px to 0 */
    max-width: 80%;
    clear: both;
    border-radius: 18px;
    padding: 12px 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    line-height: 1.5;
    word-wrap: break-word;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-size: 15px !important;
    font-family: 'Roboto', sans-serif !important;
    font-weight: 400 !important;
}

.openai-chatbot-message.bot {
    position: relative !important;
    padding: 12px 16px !important;
    margin-left: 35px !important; /* Create space for the icon */
    display: flex !important;
    align-items: flex-start !important;
    float: none !important;
    border-radius: 18px !important;
    border-bottom-left-radius: 5px !important;
    margin-right: auto !important;
    background-color: #F3F4F6 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

.openai-chatbot-message.user {
    float: none !important;
    border-bottom-right-radius: 5px;
    margin-left: auto;
    text-align: right;
    background-color: #EBF8FF;
}

.openai-chatbot-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
}

.openai-chatbot-assistant-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 10px;
    flex-shrink: 0;
}

.openai-chatbot-assistant-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.openai-chatbot-message-content {
    flex: 1;
    min-width: 0;
}

.openai-chatbot-message-content p {
    margin: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    font-size: 15px !important;
    font-family: 'Roboto', sans-serif !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
}

/* Fix assistant header layout */
.openai-chatbot-assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.assistant-name-wrapper {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 14px;
}

.assistant-name {
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    color: inherit !important;
    display: inline !important;
    font-size: 14px;
}

.openai-chatbot-assistant-status {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.05);
    margin-left: 10px;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.openai-chatbot-assistant-status.online .status-indicator {
    background-color: #13CA7E;
    box-shadow: 0 0 0 2px rgba(19, 202, 126, 0.3);
    animation: pulse 1.5s infinite;
}

.openai-chatbot-assistant-status.offline .status-indicator {
    background-color: #9CA3AF;
    box-shadow: 0 0 0 2px rgba(156, 163, 175, 0.3);
}

.status-text {
    color: #6B7280;
    font-weight: 500;
}

/* Force color apply to assistant name */
#assistant-name {
    color: inherit !important;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(19, 202, 126, 0.5);
    }
    70% {
        box-shadow: 0 0 0 4px rgba(19, 202, 126, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(19, 202, 126, 0);
    }
}

/* Email container that appears after first message - fixing appearance */
.openai-chatbot-email-wrapper {
    background: #f7f9fc;
    border-radius: 12px;
    padding: 15px;
    margin: 10px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.openai-chatbot-email-required {
    display: flex;
    align-items: center;
    color: #4a4a4a;
    margin-bottom: 5px;
    font-weight: 600;
}

.openai-chatbot-email-required i {
    color: #3e87f8;
    margin-right: 5px;
}

.openai-chatbot-email-prompt {
    margin-bottom: 10px;
}

.openai-chatbot-email-prompt p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

/* Horizontal form layout */
#openai-chatbot-initial-email-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.openai-chatbot-input-wrapper {
    position: relative;
    flex: 1;
}

.openai-chatbot-input-wrapper i.input-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
}

#openai-chatbot-initial-email {
    width: 100%;
    padding: 10px 10px 10px 35px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

#openai-chatbot-initial-email:focus {
    border-color: #3e87f8;
    box-shadow: 0 0 0 2px rgba(62, 135, 248, 0.2);
}

.openai-chatbot-email-submit {
    background: #3e87f8;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s;
}

.openai-chatbot-email-submit:hover {
    background: #2d75e0;
}

.openai-chatbot-email-privacy {
    display: flex;
    align-items: center;
    color: #888;
    font-size: 12px;
}

.openai-chatbot-email-privacy i {
    margin-right: 5px;
    color: #aaa;
}

.openai-chatbot-email-error {
    color: #e53935;
    font-size: 12px;
    margin-top: 5px;
    padding: 5px 0;
}

/* Message timestamp styling - Important overrides to ensure placement */
.openai-chatbot-message-timestamp {
    font-size: 11px !important;
    color: #999 !important;
    margin-top: 1px !important;
    margin-bottom: 0 !important;
    opacity: 0.8 !important;
    font-style: normal !important;
    font-weight: normal !important;
    padding: 0 5px !important;
    clear: both !important;
    display: block !important;
}

/* Make timestamp style consistent in bot and user messages */
.openai-chatbot-message-wrapper.bot .openai-chatbot-message-timestamp {
    text-align: left !important;
    margin-left: 45px !important; /* Adjusted to align with the message content */
}

.openai-chatbot-message-wrapper.user .openai-chatbot-message-timestamp {
    text-align: right !important;
    margin-right: 10px !important;
}

/* Responsive styling for timestamps */
@media (max-width: 576px) {
    .openai-chatbot-message-timestamp {
        font-size: 10px !important;
        margin-top: 1px !important;
    }
}

.openai-chatbot-email-submit:hover {
    background-color: #0078cc !important;
}

.openai-chatbot-email-submit i {
    font-size: 16px;
    color: white !important;
}

/* Send button styling */
.openai-chatbot-send-btn {
    background-color: #4264fb !important;
    border: none;
    border-radius: 4px !important;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0 !important;
    margin-left: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.openai-chatbot-send-btn i {
    font-size: 16px;
    color: white !important;
    display: inline-block !important;
}

/* Hide scroll in email mode */
.openai-chatbot-widget.email-mode .openai-chatbot-conversation::-webkit-scrollbar {
    display: none;
}

/* Animation for email container */
@keyframes fadeOutUp {
    from {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
    to {
        opacity: 0;
        transform: translate3d(0, -20px, 0);
    }
}

.fadeOutUp {
    animation-name: fadeOutUp;
}

/* Input container */
.openai-chatbot-input-container {
    padding: 10px 15px; /* Adjusted padding slightly */
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background-color: #fff;
    position: relative; /* Needed for file preview positioning */
}

/* File preview area */
#openai-chatbot-file-preview {
    position: absolute;
    bottom: 100%; /* Position above the input container */
    left: 15px;
    right: 15px;
    font-size: 11px;
    color: #555;
    margin-bottom: 5px; /* Space between preview and input area */
    max-height: 3em; /* Limit height */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.openai-chatbot-form {
    display: flex;
    align-items: center;
}

/* Input Group styling */
.openai-chatbot-input-group {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    background-color: #f0f2f5; /* Light grey background for the group */
    border-radius: 25px; /* Rounded corners for the group */
    padding: 5px; /* Padding inside the group */
}

/* File upload button */
.openai-chatbot-file-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: 0 5px 0 0; /* Space between icon and input */
    color: #606770; /* Icon color */
}

.openai-chatbot-file-upload-btn i {
    font-size: 18px;
}

.openai-chatbot-file-upload-btn:hover {
    color: #000;
}

.openai-chatbot-input {
    border: none; /* Remove default border */
    border-radius: 20px;
    padding: 10px 15px;
    flex-grow: 1;
    font-size: 14px;
    outline: none;
    background-color: transparent; /* Use group background */
    min-height: 20px; /* Base height */
    line-height: 1.4;
    transition: height 0.2s ease; /* Smooth height transition */
    /* Add resize: none; if it's a textarea to prevent manual resize handle */
}

.openai-chatbot-input:focus {
    box-shadow: 0 0 0 2px rgba(66, 100, 251, 0.2); /* Subtle focus indicator */
}

/* Send Button */
.openai-chatbot-send {
    background-color: transparent !important; /* Make background transparent */
    color: inherit !important; /* Inherit color */
    border: none !important;
    border-radius: 50% !important;
    width: 35px !important; /* Adjusted size */
    height: 35px !important; /* Adjusted size */
    min-width: 35px !important; /* Ensure size */
    min-height: 35px !important; /* Ensure size */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: background-color 0.2s !important;
    padding: 0 !important;
    margin-left: 5px !important; /* Space between input and button */
    box-shadow: none !important; /* Remove shadow */
}

.openai-chatbot-send:hover {
    background-color: transparent !important; /* Keep background transparent on hover */
}

.openai-chatbot-send i {
    font-size: 18px !important; /* Slightly larger icon */
    color: #767676 !important; /* Default grey icon color */
    display: inline-block !important; /* Ensure icon displays */
    transition: color 0.2s ease; /* Add transition for color change */
}

.openai-chatbot-send:hover i {
    color: #2428ff !important; /* Blue icon color on hover */
}

/* Remove redundant button rules from .openai-chatbot-form */
.openai-chatbot-form button {
    /* Rules moved to .openai-chatbot-send */
}

.openai-chatbot-form button i {
    /* Rules moved to .openai-chatbot-send i */
}

/* Email form */
#openai-chatbot-email-form {
    margin-top: 5px;
}

/* Loading indicator */
.openai-chatbot-loading {
    display: flex;
    justify-content: center;
    padding: 10px;
    clear: both;
}

.openai-chatbot-loading span {
    width: 8px;
    height: 8px;
    margin: 0 3px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

.openai-chatbot-loading span:nth-child(1) {
    animation-delay: -0.32s;
}

.openai-chatbot-loading span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1.0);
    }
}

/* Animations */
.animated {
    animation-duration: 0.5s;
    animation-fill-mode: both;
}

.fadeInUp {
    animation-name: fadeInUp;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.shake {
    animation-name: shake;
}

@keyframes shake {
    from, to {
        transform: translate3d(0, 0, 0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translate3d(-5px, 0, 0);
    }
    20%, 40%, 60%, 80% {
        transform: translate3d(5px, 0, 0);
    }
}

/* Remove toggle switch styling */
.openai-chatbot-toggle-switch {
    display: none;
}

.toggle-track {
    display: none;
}

.toggle-indicator {
    display: none;
}

/* Responsive design */
@media (max-width: 767px) {
    .openai-chatbot-widget.openai-chatbot-widget-open.active {
        width: 90% !important;
        height: 85vh !important; /* Increased from 80vh to 85vh for taller mobile chat window */
        max-height: 700px !important; /* Increased from 600px to 700px to match desktop height */
        bottom: 75px !important;
        right: 5% !important;
        left: 5% !important;
    }
    
    .openai-chatbot-toggle-text {
        bottom: 80px;
        right: 0;
    }
}

/* Fix for FontAwesome icons */
.openai-chatbot-toggle i,
.openai-chatbot-close i,
.openai-chatbot-send-btn i,
.openai-chatbot-email-submit i {
    display: inline-block !important;
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-rendering: auto !important;
    line-height: 1 !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

.fa-comments:before { content: "\f086" !important; }
.fa-times:before { content: "\f00d" !important; }
.fa-paper-plane:before { content: "\f1d8" !important; }
.fa-arrow-right:before { content: "\f061" !important; }
.fa-trash:before { content: "\f1f8" !important; }
.fa-power-off:before { content: "\f011" !important; }

/* Button animations */
.openai-chatbot-toggle,
.openai-chatbot-close,
.openai-chatbot-send-btn,
.openai-chatbot-email-submit {
    position: relative;
    overflow: hidden;
    transform: translate3d(0, 0, 0);
    transition: all 0.25s ease;
}

/* Hover animations */
.openai-chatbot-toggle:hover,
.openai-chatbot-close:hover,
.openai-chatbot-send-btn:hover,
.openai-chatbot-email-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Active animations */
.openai-chatbot-toggle:active,
.openai-chatbot-close:active,
.openai-chatbot-send-btn:active,
.openai-chatbot-email-submit:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Ripple effect */
.openai-chatbot-toggle:after,
.openai-chatbot-close:after,
.openai-chatbot-send-btn:after,
.openai-chatbot-email-submit:after {
    content: "";
    display: block;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, #fff 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform 0.5s, opacity 1s;
}

.openai-chatbot-toggle:active:after,
.openai-chatbot-close:active:after,
.openai-chatbot-send-btn:active:after,
.openai-chatbot-email-submit:active:after {
    transform: scale(0, 0);
    opacity: 0.3;
    transition: 0s;
}

/* Fix message layout */
.openai-chatbot-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 15px;
    padding: 0;
    width: auto;
    max-width: 80%;
    clear: both;
}

.openai-chatbot-message.bot {
    flex-direction: row;
    align-items: flex-start;
    float: left;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    padding: 12px 16px;
    background-color: #F3F4F6;
    margin-right: auto;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.openai-chatbot-message.user {
    align-self: flex-end;
    float: right;
    border-radius: 18px;
    border-bottom-right-radius: 5px;
    padding: 12px 16px;
    background-color: #EBF8FF;
    margin-left: auto;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.openai-chatbot-message-content {
    display: flex;
    flex-direction: column;
    word-break: break-word;
    overflow-wrap: break-word;
}

.openai-chatbot-conversation {
    padding: 15px;
    overflow-x: hidden;
}

/* Improve message appearance */
.openai-chatbot-message.bot .openai-chatbot-assistant-icon {
    margin-right: 10px;
    margin-bottom: 0;
    align-self: flex-start;
}

.openai-chatbot-message.bot .openai-chatbot-message-content {
    flex: 1;
}

.openai-chatbot-message p {
    margin: 0;
    line-height: 1.5 !important;
    font-size: 15px !important;
    font-family: 'Roboto', sans-serif !important;
    font-weight: 400 !important;
}

/* Fix status placement in messages */
.openai-chatbot-assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
    width: 100%;
}

.openai-chatbot-assistant-status {
    margin-left: 5px;
}

/* Enhanced animations for messages */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 10px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.fadeInUp {
    animation-name: fadeInUp;
    animation-duration: 0.3s;
    animation-fill-mode: both;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translate3d(10px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.openai-chatbot-message.user {
    animation-name: fadeInRight;
    animation-duration: 0.3s;
    animation-fill-mode: both;
}

.openai-chatbot-email-error {
    color: #e74c3c;
    font-size: 13px;
    padding: 8px 12px;
    margin: 8px 0;
    background-color: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
    border-left: 3px solid #e74c3c;
    display: none;
}

.openai-chatbot-message-content a {
    color: #2563EB;
    text-decoration: underline;
}

#openai-chatbot-initial-email:focus,
#openai-chatbot-email-input:focus {
    border-color: #0096FF;
    box-shadow: 0 0 0 3px rgba(0, 150, 255, 0.1);
    outline: none;
}

/* Enhanced email input styling */
.openai-chatbot-input-wrapper {
    position: relative;
    flex: 1;
    margin-right: 10px;
}

.openai-chatbot-input-wrapper .input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #6B7280;
    font-size: 14px;
    z-index: 2;
}

#openai-chatbot-initial-email {
    padding-left: 40px !important;
    border-radius: 50px !important;
    height: 46px !important;
    font-size: 14px !important;
    border: 2px solid rgba(0, 150, 255, 0.3) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.3s ease !important;
    width: 100%;
}

#openai-chatbot-initial-email:focus {
    border-color: #0096FF !important;
    box-shadow: 0 0 0 3px rgba(0, 150, 255, 0.2) !important;
    outline: none !important;
}

.openai-chatbot-email-privacy {
    margin-top: 15px;
    padding: 0 10px;
    font-size: 12px;
    color: #6B7280;
    text-align: center;
}

.openai-chatbot-email-privacy i {
    color: #13CA7E;
    margin-right: 5px;
}

.openai-chatbot-email-required {
    background-color: #EBF8FF;
    color: #0096FF;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 600;
    margin-bottom: 20px;
    display: inline-block;
}

.openai-chatbot-email-required i {
    margin-right: 5px;
}

.openai-chatbot-email-prompt {
    margin-bottom: 20px;
}

.openai-chatbot-email-prompt p {
    font-size: 15px;
    line-height: 1.5;
    color: #4B5563;
}

.openai-chatbot-email-error {
    background-color: rgba(231, 76, 60, 0.1);
    border-left: 3px solid #e74c3c;
    color: #e74c3c;
    padding: 8px 12px;
    margin: 10px 0;
    border-radius: 3px;
    font-size: 13px;
}

/* Better submit button styling for email */
.openai-chatbot-email-submit {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    margin-left: 10px !important;
    background-color: #0096FF !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(0, 150, 255, 0.4) !important;
}

/* Additional rules to keep chatbot visible */
.openai-chatbot-widget.openai-chatbot-widget-open.active {
    position: fixed !important;
    display: flex !important;
    flex-direction: column !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    z-index: 9999 !important;
    bottom: 80px !important;
    right: 5px !important;
    width: 360px !important; /* Added width to match the 10% reduction from 400px */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.25) !important;
}

/* Email container styling that appears after first message */
.openai-chatbot-email-container {
    max-width: 85%;
    margin: 10px auto;
    padding: 15px;
    background-color: #f7f9fc;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.openai-chatbot-email-container.fade-in {
    animation: fadeIn 0.5s;
}

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

.openai-chatbot-email-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.openai-chatbot-email-icon {
    color: #4264fb;
    font-size: 20px;
    margin-bottom: 5px;
}

.openai-chatbot-email-prompt p {
    margin: 5px 0 10px 0;
    text-align: center;
    font-size: 14px;
    color: #333;
}

.openai-chatbot-email-input-container {
    display: flex;
    width: 100%;
    margin: 5px 0;
}

#openai-chatbot-email {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
}

#openai-chatbot-email:focus {
    outline: none;
    border-color: #4264fb;
    box-shadow: 0 0 0 2px rgba(66, 100, 251, 0.2);
}

#openai-chatbot-email-submit {
    width: 40px;
    height: 40px;
    background-color: #0096FF !important;
    color: white !important;
    border: none;
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    padding: 0;
    margin: 0;
}

#openai-chatbot-email-submit:hover {
    background-color: #0078cc !important;
}

.openai-chatbot-email-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    text-align: center;
    min-height: 16px;
}

.openai-chatbot-privacy-note {
    font-size: 11px;
    color: #777;
    margin-top: 10px;
    text-align: center;
}

/* Make sure our email button remains round */
.openai-chatbot-email-container button {
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    background-color: #0096FF !important;
}

/* Send button styling */
.openai-chatbot-send {
    background-color: transparent !important;
    color: inherit !important;
    border: none !important;
    border-radius: 50% !important;
    width: 35px !important;
    height: 35px !important;
    min-width: 35px !important;
    min-height: 35px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: background-color 0.2s !important;
    padding: 0 !important;
    margin-left: 5px !important;
    box-shadow: none !important;
}

.openai-chatbot-send:hover {
    background-color: transparent !important;
}

.openai-chatbot-send i {
    font-size: 18px !important;
    color: #767676 !important;
    display: inline-block !important;
    transition: color 0.2s ease;
}

.openai-chatbot-send:hover i {
    color: #2428ff !important;
}

/* Toggle button styling */
.openai-chatbot-toggle {
    background-color: #4264fb !important; 
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 60px !important;
    height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: 0 4px 12px rgba(66, 100, 251, 0.4) !important;
    bottom: 5px !important;
    right: 5px !important;
}

.openai-chatbot-toggle:hover {
    background-color: #3050e0 !important;
}

/* Close button styling */
.openai-chatbot-close {
    background-color: #4264fb !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: background-color 0.2s !important;
    padding: 0 !important;
    margin: 0 !important;
}

.openai-chatbot-close:hover {
    background-color: #3050e0 !important;
}

/* Typing indicator */
.openai-chatbot-typing-indicator {
    background-color: #F3F4F6;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    display: inline-block;
    margin-bottom: 15px;
    max-width: 80px;
    float: left;
    margin-right: auto;
    position: relative;
    opacity: 1;
    transition: opacity 0.3s ease-out, transform 0.2s ease-out;
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Adding fade-out animation class */
.openai-chatbot-typing-indicator.fade-out {
    opacity: 0;
    transform: translateY(5px);
}

.openai-chatbot-typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 2px;
    background-color: #9E9EA1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

.openai-chatbot-typing-indicator span:nth-of-type(1) {
    animation: typing 1s infinite ease-in-out;
}

.openai-chatbot-typing-indicator span:nth-of-type(2) {
    animation: typing 1s infinite ease-in-out 0.2s;
}

.openai-chatbot-typing-indicator span:nth-of-type(3) {
    animation: typing 1s infinite ease-in-out 0.4s;
}

@keyframes typing {
    0% {
        transform: translateY(0px);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-8px);
        opacity: 0.8;
    }
    100% {
        transform: translateY(0px);
        opacity: 0.4;
    }
}

/* Quick reply animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeOutDown {
    from {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
    to {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }
}

@keyframes pulse {
    from {
        transform: scale3d(1, 1, 1);
    }
    50% {
        transform: scale3d(1.05, 1.05, 1.05);
    }
    to {
        transform: scale3d(1, 1, 1);
    }
}

.quick-reply-button,
.openai-chatbot-quick-reply {
    background-color: #e8eeff;
    border: 1px solid #4264fb;
    color: #4264fb;
    padding: 8px 12px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-size: 12px !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important; 
    gap: 4px !important;
    margin: 4px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    text-align: center !important;
    font-weight: normal !important;
    white-space: nowrap !important;
    min-height: 36px !important;
    min-width: 90% !important;
    width: 90% !important;
    overflow: hidden !important;
    z-index: 1 !important;
    opacity: 1 !important;
}

.quick-reply-button i,
.openai-chatbot-quick-reply i {
    margin-right: 5px !important;
    font-size: 12px !important;
    display: inline-block !important;
    color: inherit;
}

.quick-replies-container,
.openai-chatbot-quick-replies {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    margin: 10px 0 !important;
    padding: 5px !important;
    justify-items: center !important;
    width: 100% !important;
    animation: fadeInUp 0.3s ease forwards !important;
    position: relative !important;
    clear: both !important;
}

.quick-reply-button:hover,
.openai-chatbot-quick-reply:hover {
    background-color: #4264fb;
    color: white;
    transform: translateY(-2px) !important;
    box-shadow: 0 3px 6px rgba(66, 100, 251, 0.3) !important;
}

.openai-chatbot-message p span,
.openai-chatbot-message-content p span {
    display: inline !important;
}

/* Button animations */
.quick-reply-button.animated,
.openai-chatbot-quick-reply.animated {
    animation-duration: 0.5s !important;
    animation-fill-mode: both !important;
}

.quick-reply-button.fadeInUp,
.openai-chatbot-quick-reply.fadeInUp {
    animation-name: fadeInUp !important;
}

.quick-reply-button.fadeOutDown,
.openai-chatbot-quick-reply.fadeOutDown {
    animation-name: fadeOutDown !important;
}

.quick-reply-button.pulse,
.openai-chatbot-quick-reply.pulse {
    animation-name: pulse !important;
    animation-duration: 0.3s !important;
}

.quick-reply-button:hover i,
.openai-chatbot-quick-reply:hover i {
    transform: scale(1.1) !important;
}

/* Responsive styles */
@media (max-width: 767px) {
    .openai-chatbot-widget.openai-chatbot-widget-open.active {
        width: 90% !important;
        height: 85vh !important; /* Increased from 80vh to 85vh for taller mobile chat window */
        max-height: 700px !important; /* Increased from 600px to 700px to match desktop height */
        bottom: 75px !important;
        right: 5% !important;
        left: 5% !important;
    }
    
    .openai-chatbot-toggle-text {
        bottom: 80px;
        right: 0;
    }
}

@media (max-height: 600px) {
    .openai-chatbot-widget {
        height: 95vh; /* Increased from 90vh to 95vh for very small screens */
        max-height: 95vh;
    }
}

/* Bot Message Icon - Outside Bubble - Final Styling */
.openai-chatbot-message.bot {
    position: relative !important;
    padding: 12px 16px !important;
    margin-left: 35px !important; /* Create space for the icon */
    display: flex !important;
    align-items: flex-start !important;
    float: none !important;
    border-radius: 18px !important;
    border-bottom-left-radius: 5px !important;
    margin-right: auto !important;
    background-color: #F3F4F6 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

.openai-chatbot-message.bot .openai-chatbot-bot-icon {
    position: absolute !important;
    left: -30px !important; /* Position outside the bubble */
    top: 50% !important;
    transform: translateY(-50%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    z-index: 5 !important;
}

.openai-chatbot-message.bot .openai-chatbot-bot-icon img {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    border-radius: 50% !important;
    border: 1px solid rgba(66, 100, 251, 0.2) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.openai-chatbot-message.bot .openai-chatbot-bot-icon i {
    padding: 5px !important;
    color: #4264fb !important;
    background-color: #ffffff !important;
    border-radius: 50% !important; 
    border: 1px solid rgba(66, 100, 251, 0.2) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
}

/* Icon sizes with improved dimensions */
.openai-chatbot-message.bot .openai-chatbot-bot-icon.small {
    width: 20px !important;
    height: 20px !important;
    font-size: 10px !important;
}

.openai-chatbot-message.bot .openai-chatbot-bot-icon.medium {
    width: 24px !important;
    height: 24px !important;
    font-size: 14px !important;
}

.openai-chatbot-message.bot .openai-chatbot-bot-icon.large {
    width: 32px !important;
    height: 32px !important;
    font-size: 18px !important;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .openai-chatbot-message.bot {
        margin-left: 30px !important;
    }
    
    .openai-chatbot-message.bot .openai-chatbot-bot-icon {
        left: -25px !important;
    }
}

/* Message content styling */
.openai-chatbot-message.bot .openai-chatbot-message-content {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
}

.openai-chatbot-message.bot .openai-chatbot-message-content p {
    margin: 0 !important;
    line-height: 1.5 !important;
    font-size: 15px !important;
    font-family: 'Roboto', sans-serif !important;
    font-weight: 400 !important;
}

/* Additional safeguards for zoom handling */
@supports (position: fixed) {
    .openai-chatbot-container,
    .openai-chatbot-toggle,
    .openai-chatbot-widget {
        /* Ensure hardware acceleration for smoother rendering */
        -webkit-transform: translateZ(0);
        -moz-transform: translateZ(0);
        -ms-transform: translateZ(0);
        -o-transform: translateZ(0);
        transform: translateZ(0);
        
        /* Force visibility during transformations */
        -webkit-backface-visibility: hidden;
        -moz-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

/* Improve GPU rendering */
.openai-chatbot-container,
.openai-chatbot-toggle,
.openai-chatbot-widget {
    transform: translate3d(0, 0, 0);
    /* Indicate that these elements might change */
    will-change: transform, opacity;
}

/* Prevent elements from disappearing at certain zoom levels */
.openai-chatbot-container.force-visible,
.openai-chatbot-toggle.force-visible,
.openai-chatbot-widget.force-visible {
    /* Force visibility */
    visibility: visible !important;
    /* Use alternative positioning as fallback */
    position: fixed !important;
    /* Make sure position is enforced */
    right: 5px !important;
    /* Ensure proper z-index stacking order */
    z-index: 9999 !important;
}

/* Only apply font styling to header elements */
.openai-chatbot-header-title .assistant-name,
.openai-chatbot-header-branding .assistant-name {
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    color: inherit !important;
}

/* Message assistant name should use default font */
.openai-chatbot-message-content .assistant-name,
#openai-chatbot-conversation .assistant-name:not(.openai-chatbot-header .assistant-name) {
    font-weight: bold;
    font-family: inherit;
    display: none !important; /* Add !important */
}

/* Message content styling */
.openai-chatbot-message-content,
.openai-chatbot-message-content p {
    font-family: 'Roboto', sans-serif !important;
    font-weight: 300 !important;
    line-height: 1.5;
}

/* Confirmation message styling */
.openai-chatbot-confirmation-container {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 15px 10px;
    margin: 15px 0;
}

.openai-chatbot-confirmation-message {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 85%;
    animation: fadeInUp 0.3s ease forwards;
}

.openai-chatbot-confirmation-message p {
    margin: 0 0 15px 0;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.openai-chatbot-confirmation-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.openai-chatbot-confirmation-buttons button {
    padding: 8px 15px;
    border-radius: 5px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.openai-chatbot-confirmation-buttons .confirm-yes {
    background-color: #dc3545;
    color: white;
}

.openai-chatbot-confirmation-buttons .confirm-no {
    background-color: #6c757d;
    color: white;
}

.openai-chatbot-confirmation-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.openai-chatbot-confirmation-buttons .confirm-yes:hover {
    background-color: #c82333;
}

/* Style for uploaded file previews within messages */
.openai-chatbot-message-file {
    margin-top: 8px; /* Add some space above the file preview */
    max-width: 150px; /* Limit the width of the preview container */
}

.openai-chatbot-message-file img {
    max-width: 100%; /* Ensure image scales down */
    max-height: 100px; /* Limit the height */
    height: auto; /* Maintain aspect ratio */
    border-radius: 8px; /* Rounded corners */
    display: block; /* Prevent extra space below */
    cursor: pointer; /* Indicate it's clickable */
    border: 1px solid #eee; /* Subtle border */
    object-fit: cover; /* Cover the area nicely */
}

/* Style for non-image file previews */
.openai-chatbot-message-file-icon {
    display: flex;
    align-items: center;
    background-color: #f0f2f5;
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: 8px;
}

.openai-chatbot-message-file-icon i {
    font-size: 20px;
    color: #4264fb;
    margin-right: 8px;
}

.openai-chatbot-message-file-name {
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Attribution Link Styling */
.openai-chatbot-attribution {
    text-align: center;
    padding: 8px 0;
    font-size: 12px;
    color: #999;
    background-color: #ffffff; /* Match widget background or adjust as needed */
    border-top: 1px solid #eee; /* Optional separator */
    /* Ensure it stays at the bottom if widget height changes */
    margin-top: auto; 
}

.openai-chatbot-attribution a {
    color: #777; /* Slightly darker link color */
    text-decoration: none;
    font-weight: 500;
}

.openai-chatbot-attribution a:hover {
    color: #333;
    text-decoration: underline;
} 