* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    background-color: #f8f9fa;
    height: 100vh;
}

/* Chat Widget */
.chat-widget {
    width: 400px;
    bottom: calc(100px + env(safe-area-inset-bottom, 20px)) !important;
    right: calc(20px + env(safe-area-inset-right, 10px)) !important;
    height: 500px;
    max-height: calc(100dvh - 120px - env(safe-area-inset-bottom, 20px)); /* Use 100dvh for dynamic height */
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: fixed !important;
    right: calc(20px + env(safe-area-inset-right, 10px));
    z-index: 1001;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

/* Fix visible state class */
.chat-widget.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chat-widget.minimized {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.ai-header-right {
    display: flex;
    align-items: center;
}

.ai-avatar {
    position: static; /* Remove absolute positioning */
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    order: 2;
}

/* Ensure the header logo is properly structured */
.ai-header-logo {
    position: static;
    display: flex;
    align-items: center;
}

.side-image {
    position: absolute; /* or fixed */
    top: 50px; /* adjust as needed */
    right: 20px; /* adjust as needed - for right side */
    /* or left: 20px; - for left side */
    width: 200px; /* adjust size as needed */
    height: auto;
    z-index: 1; /* adjust if needed for layering */
}
/* Chat Header */
.chat-header {
    background-color: #0C3C64;
    padding: 12px 16px;
    display: flex;
    width: auto !important;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #d9d9d9;
}

.ai-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.built-in-badge {
    background-color: #f2f3f3;
    border: 1px solid #d9d9d9;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    margin-left: 8px;
    color: #232f3e;
}

/* Adjust the header structure */
.ai-header-title {
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    order: 1;
}

.header-controls {
    display: flex;
    gap: 8px;
    margin-left: auto;
    width: auto !important;
}
.control-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
}

/* Status Message */
.status-message {
    padding: 8px 16px;
    background-color: #f8f8f8;
    border-bottom: 1px solid #d9d9d9;
    font-size: 12px;
    color: #545b64;
    display: flex;
    align-items: center;
}
.status-icon {
    width: 8px;
    height: 8px;
    background-color: #2cbb5d;
    border-radius: 50%;
    margin-right: 6px;
}

/* Conversation */
.conversation {
    flex-grow: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: #ffffff;
}
.message {
    display: flex;
    max-width: 100%;
}
.user-message {
    justify-content: flex-end;
}
.bot-message {
    justify-content: flex-start;
}
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 12px;
    flex-shrink: 0;
}
.bot-avatar {
    width: 32px;
    height: 42px;
    border-radius: 50%;
    margin-right: 4px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    overflow:hidden;
}

.bot-avatar img {
    width: 42px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover; /* Ensures the image fills the circular boundary without distortion */
}

.user-avatar {
    background-color: #e9ebed;
}
.message-content {
    max-width: calc(100% - 44px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: auto !important;
}
.message-bubble {
    padding: 12px 9px;
    border-radius: 8px;
    font-size: 13px;    
    line-height: 1.5;
    color: #232f3e;
    max-width: 100% !important;
    display: inline-block;
    
}

#typing-indicator .bot-avatar img {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
.user-message .message-bubble {
    background-color: #f2f3f3;
    border: 1px solid #e9ebed;
}
.bot-message .message-bubble {
    background-color: #f8f9fa;
    border: 1px solid #e9ebed;
}

/* Suggestion Container */
.suggestion-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.suggestion-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    align-items: flex-start;
}
.suggestion-button {
    background-color: #e6e6fa;
    border: none;
    color: #161d26;
    border-radius: 12px;
    padding: 7px 9px !important;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: auto;
    display: inline-block;
}
.suggestion-button:hover {
    background-color: #dadaf8;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Input Container */
.input-container {
    padding: 5px 9px;
    background-color: white;
    border-top: 1px solid #d9d9d9;
    justify-content: center; 
}
.input-wrapper {
    display: flex;
    align-items: flex-start;
    background-color: white;
    border: 1px solid #d9d9d9;
    border-radius: 9px;
    padding: 0px 7px;
    transition: all 0.2s ease;
}
.input-wrapper:focus-within {
    box-shadow: 0 0 0 2px rgba(9, 114, 211, 0.3);
    border-color: #0972d3;
}
#message-input {
    flex-grow: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 8px 11px;
    font-size: 14px;
    color: #232f3e;
    resize: none; /* Prevent manual resizing */
    font-family: inherit;
    overflow-y: auto;
    max-height: 120px; /* Limit maximum height */
    min-height: 40px;
    line-height: 1.5;

}
#message-input::placeholder {
    color: #687078;
}
#send-button {
    width: 32px;
    height: 32px;
    background-color: #ffde59;
    border-radius: 50%;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: center;
    margin-left: 8px;
}
#send-button:disabled {
    background-color: #e9ebed;
    cursor: not-allowed;
}

#send-button:hover:not(:disabled) {
    background-color: #fb5b8f;
    transform: scale(1.05);
}

.arrow-icon {
    color: rgb(0, 0, 0);
}

/* This selects the arrow icon when the BUTTON is hovered */
#send-button:hover:not(:disabled) .arrow-icon {
    color: white;
}

/* Footer */
.ai-footer {
    padding: 1px;
    text-align: center;
    font-size: 11px;
    color: #687078;
}
.ai-footer a {
    color: #0972d3;
    text-decoration: none;
}
.ai-footer a:hover {
    text-decoration: underline;
}

/* Chat Toggle Button */
.chat-toggle-button {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #ffde59;
    color: rgb(0, 0, 0);
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000; /* Lower than chat widget but above page content */
    transition: all 0.3s ease;
}
.chat-toggle-button:hover {
    background-color: #fb5b8f;
    color: white;
    transform: scale(1.05);
}

/* Additional styling for inquiry forms */
.message-bubble {
    padding: 9px 12px !important;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    color: #232f3e;
    width: auto;
    display: inline-block;
    max-width: 100%;
    word-break: break-word;
    border: 1px solid #e9ebed;
    background-color: #f8f9fa;
}

.bot-message .message-bubble {
    border: 1px solid #e9ebed;
    background-color: #f8f9fa;
    width: auto;
    display: inline-block;
}

.welcome-message {
    font-size: 13px !important;
    line-height: 1.5;
}

.message-bubble ul, 
.message-bubble ol {
    padding-left: 20px;
    margin: 8px 0;
}

.message-bubble li {
    margin-bottom: 6px;
}

.service-card {
    border: 1px solid #e9ebed;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    background-color: #f8f9fa;
}

.service-title {
    font-weight: 600;
    color: #0972d3;
    margin-bottom: 6px;
}

.service-description {
    font-size: 13px;
    color: #232f3e;
}

.job-listing {
    border-left: 3px solid #0972d3;
    padding-left: 12px;
    margin: 12px 0;
}

.job-title {
    font-weight: 600;
    color: #232f3e;
}

.inquiry-form {
    border-radius: 8px;
    background-color: #f8f9fa;
    margin: 2px 1px;
}

.inquiry-form p {
    margin-bottom: 16px;
    color: #232f3e;
    font-size: 14px;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    font-weight: 600;
    color: #232f3e;
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: #0972d3;
    box-shadow: 0 0 0 2px rgba(9, 114, 211, 0.2);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-group input[type="submit"] {
    background-color: #0972d3;
    color: white;
    border: none;
    cursor: pointer;
    padding: 10px 20px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.form-group input[type="submit"]:hover {
    background-color: #075aad;
}

.form-group input[type="file"] {
    padding: 6px;
    border: 1px dashed #d9d9d9;
    background-color: #fff;
}

.inquiry-confirmation, 
.application-confirmation,
.error-message {
    padding: 12px;
    border-radius: 6px;
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.5;
}

.inquiry-confirmation, 
.application-confirmation {
    background-color: #f0f7ff;
    border-left: 3px solid #0972d3;
    color: #232f3e;
}

.error-message {
    background-color: #fff0f0;
    border-left: 3px solid #d13212;
    color: #d13212;
}

/* Add this to your styles */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #0972d3;
    animation: spin 1s ease-in-out infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.processing-message {
    color: #555;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 10px;
}

.inquiry-confirmation, .application-confirmation {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    background-color: #f0f7ff;
    border-left: 3px solid #0972d3;
    color: #232f3e;
}

/* Add these media queries at the end of your CSS file */

/* For tablets and smaller screens */
@media (max-width: 768px) {
    .chat-widget {
        width: 320px; /* Set fixed width for consistency */
        max-width: 95%; /* But allow it to shrink on very small screens */
        height: 500px; /* Fixed height */
        max-height: 80vh; /* But allow it to adjust on small screens */
        right: 10px;
        bottom: 80px;
        margin: 0; /* Remove any automatic margins */
        transform-origin: bottom right; /* Ensure animations work correctly */
    }
    
    /* Fix avatar positioning at top */
    .ai-avatar {
        width: 32px;
        height: 32px;
        top: -15px;
        right: 272px;
        border: 2px solid #0C3C64; /* Add border to make it stand out */
        background-color: white;
    }
    
    /* Adjust header elements for better small screen display */
    .chat-header {
        position: relative; /* For absolute positioning of avatar */
        padding: 10px 12px;
    }
    
    .ai-header-title {
        font-size: 14px;
    }
    
    /* Fix control buttons positioning */
    .header-controls {
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    /* Adjust toggle button position and size */
    .chat-toggle-button {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
    }
}

/* For mobile devices */
@media (max-width: 480px) {
    .chat-widget {
        width: 90%;
        height: 80vh;
        max-height: calc(100vh - 120px);
        bottom: 80px;
        right: 5%;
        left: 5%; /* Center horizontally */
        margin: 0 auto;
        transform-origin: bottom center;
    }
    /* Update animation keyframes for mobile */
    @keyframes slideInFromAboveButton {
        from {
            transform: scale(0.3);
            opacity: 0;
            bottom: 70px;
            right: 5%;
        }
        to {
            transform: scale(1);
            opacity: 1;
            bottom: 80px;
            right: 5%;
        }
    }

    .chat-toggle-button {
        width: 45px;
        height: 45px;
        bottom: 15px;
        right: 15px;
    }
    
    .chat-header {
        position: sticky;
        top: 0;
        z-index: 10;
        width: 100% !important;
    }
    
    .ai-header-title {
        font-size: 14px;
    }
    
    .ai-avatar {
        width: 32px;
        height: 32px;
        top: -16px;
        right: 272px;
    }
    
    .message-bubble {
        padding: 8px 10px !important;
        font-size: 12px;
    }
    
    .bot-avatar img,
    .bot-avatar {
        width: 28px;
        height: 28px;
    }
    
    .conversation {
        max-height: calc(80vh - 140px); /* Adjust based on header and input heights */
    }

    .suggestion-button {
        padding: 8px 10px !important;
        font-size: 12px;
    }
    
    .input-container {
        padding: 8px;
    }
    
    #message-input {
        font-size: 13px;
        max-height: 100px;
    }
    
    #send-button {
        width: 28px;
        height: 28px;
    }
}

/* Extra adjustments for very small screens */
@media (max-width: 380px) {
    .chat-widget {
        width: 300px;
        right: 5px;
    }
    
    .suggestion-button {
        padding: 8px !important;
        font-size: 12px;
    }
    
    .ai-header-title {
        font-size: 13px;
    }
}

/* For very small screens */
@media (max-width: 350px) {
    .chat-widget {
        width: 95%;
        right: 2.5%;
        bottom: 70px;
    }
    
    .ai-avatar {
        width: 24px;
        height: 24px;
        margin-right: 6px;
    }

    .ai-header-title {
        font-size: 13px;
    }

    .message-bubble {
        padding: 6px 8px !important;
        font-size: 11px;
    }
    
    .input-wrapper {
        padding: 0 5px;
    }
    
    .control-button {
        width: 20px;
        height: 20px;
        font-size: 16px;
    }
    
    .built-in-badge {
        font-size: 10px;
        padding: 1px 6px;
    }
}

/* Ensure proper handling of orientation changes */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .chat-widget {
        height: 85vh;
        width: 60%;
        right: 20%;
    }
    
    .conversation {
        max-height: 60vh;
    }
}

/* Ensure proper animation scaling for all screen sizes */
@keyframes slideInFromAboveButton {
    from {
        transform: scale(0.3);
        opacity: 0;
        bottom: calc(70px + env(safe-area-inset-bottom, 20px));
        right: calc(20px + env(safe-area-inset-right, 10px));
    }
    to {
        transform: scale(1);
        opacity: 1;
        bottom: calc(100px + env(safe-area-inset-bottom, 20px));
        right: calc(20px + env(safe-area-inset-right, 10px));
    }
}

@keyframes slideOutToAboveButton {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.3);
        opacity: 0;
        bottom: calc(70px + env(safe-area-inset-bottom, 20px));
        right: calc(20px + env(safe-area-inset-right, 10px));
    }
}

/* Add this to ensure proper sizing of form elements */
.inquiry-form, 
.form-group input, 
.form-group select, 
.form-group textarea {
    max-width: 100%;
    box-sizing: border-box;
}

/* Ensure popup is responsive */
.chat-popup {
    width: 90%;
    max-width: 280px;
}

.disclaimer-popup {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
    /* Fixed positioning to ensure it covers the entire viewport */
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .disclaimer-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 700px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    animation: slideIn 0.3s;
    /* Remove margin-top to ensure vertical centering */
    margin: 0 auto;
    position: relative;
  }
  
  .disclaimer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
  }
  
  .disclaimer-header h2 {
    margin: 0;
    color: #333;
  }
  
  .disclaimer-body {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
  }
  
  .disclaimer-body p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #444;
  }
  
  .close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
  }
  
  .close-btn:hover,
  .close-btn:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
  }
  
  @keyframes fadeIn {
    from {opacity: 0}
    to {opacity: 1}
  }
  
  @keyframes slideIn {
    from {transform: translateY(-20px); opacity: 0;}
    to {transform: translateY(0); opacity: 1;}
  }
  