.chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Auth Forms in Chat Widget */
.chat-widget-auth {
    padding: 20px;
    max-height: calc(500px - 60px); /* Subtract header height */
    overflow-y: auto;
    background: white; /* White background */
    flex: 1; /* Take remaining space */
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1; /* Below header */
    margin-top: 0; /* Ensure no margin pushing it up */
}

.chat-widget-auth-tabs {
    display: flex;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 20px;
}

.chat-widget-auth-tabs .auth-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: #447cf7;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.chat-widget-auth-tabs .auth-tab.active {
    border-bottom-color: #007bff;
    color: #007bff;
}

.chat-widget-auth-tabs .auth-tab:hover {
    color: #007bff;
}

.chat-widget-auth .auth-form {
    color: #333; /* Dark text for white background */
    flex: 1;
    overflow-y: auto;
    padding-bottom: 10px;
}

.chat-widget-auth .form-group {
    margin-bottom: 15px;
}

.chat-widget-auth .input-label {
    color: #333; /* Dark text for visibility */
    font-size: 13px;
    margin-bottom: 5px;
    display: block;
    font-weight: 500;
}

.chat-widget-auth .form-control {
    background: white;
    border: 1px solid #dee2e6;
    color: #333;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
}

.chat-widget-auth .form-control:focus {
    background: white;
    border-color: #007bff;
    color: #333;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.chat-widget-auth .form-control::placeholder {
    color: #6c757d;
}

.chat-widget-auth .wizard-custom-radio {
    margin-bottom: 15px;
}

.chat-widget-auth .wizard-custom-radio-item label {
    color: #333;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.chat-widget-auth .wizard-custom-radio-item input:checked + label {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.chat-widget-auth .custom-control-label {
    color: #333;
    font-size: 12px;
}

.chat-widget-auth .custom-control-label a {
    color: #007bff;
    text-decoration: underline;
}

.chat-widget-auth .btn-primary {
    background: #007bff;
    border: none;
    padding: 10px;
    font-weight: 500;
}

.chat-widget-auth .btn-primary:hover {
    background: #0056b3;
}

.chat-widget-auth a {
    color: #007bff;
    font-size: 12px;
}

.chat-widget-auth a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.chat-widget-auth .text-secondary {
    color: #6c757d !important;
}

.chat-widget-auth .invalid-feedback {
    color: #dc3545;
    font-size: 12px;
    display: block;
    margin-top: 5px;
}

.chat-widget-auth .danger-transparent-alert {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
}

.chat-widget-auth .badge-circle-gray300 {
    background: #e9ecef;
    color: #6c757d;
}

.chat-widget-auth .social-login {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
}

.chat-widget-auth .social-login:hover {
    background: #f8f9fa;
    color: #333;
}

.chat-widget-toggle {
    width: 60px;
    height: 60px;
    background: #007bff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
    transition: all 0.3s ease;
    position: relative;
    z-index: 10000;
    border: none;
    outline: none;
}

.chat-widget-toggle:hover {
    background: #0056b3;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.5);
}

.chat-widget-toggle svg {
    color: white;
    width: 24px;
    height: 24px;
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

.chat-widget-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 443px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior: contain; /* Prevent scroll chaining to parent page */
    z-index: 10001;
}

.chat-widget-header {
    background: #638ed8 !important; /* Force background */
    color: white !important; /* Force text color */
    padding: 15px;
    display: flex !important; /* Force display */
    justify-content: space-between;
    align-items: center;
    position: relative !important; /* Force positioning */
    flex-shrink: 0 !important; /* Prevent header from shrinking */
    z-index: 100 !important; /* Ensure header is always visible above everything */
    min-height: 60px; /* Ensure minimum height */
    box-sizing: border-box;
    width: 100%; /* Full width */
    order: -1; /* Ensure header is first in flex order */
}

.chat-widget-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.admin-status-widget {
    position: absolute;
    top: 17px;
    right: 75px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}

.status-indicator-widget {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4d9de4;
}

.status-indicator-widget.online {
    background: #28a745;
}

.status-indicator-widget.offline {
    background: #dc3545;
}

.status-text-widget {
    font-size: 11px;
    opacity: 0.9;
}

.chat-widget-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.chat-widget-close:hover {
    opacity: 0.7;
}

.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    overscroll-behavior: contain; /* Prevent scroll chaining to parent page */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.chat-widget-message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.chat-widget-message.user {
    align-items: flex-end;
}

.chat-widget-message.admin,
.chat-widget-message.ai {
    align-items: flex-start;
}

.chat-widget-message-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.chat-widget-message.user .chat-widget-message-bubble {
    background: #638ed8;
    color: white;
}

.chat-widget-message.admin .chat-widget-message-bubble {
    background: #EDEDED;
    color: black;
}

.chat-widget-message.ai .chat-widget-message-bubble {
    background: #EDEDED;
    color: black;
    border: 1px solid #EDEDED;
}

.chat-widget-message-time {
    font-size: 10px;
    color: #4d9de4;
    margin-top: 4px;
    padding: 0 4px;
}

.chat-widget-input {
    padding: 12px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.chat-widget-input form {
    display: flex;
    gap: 8px;
}

.chat-widget-input .form-control {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
}

.chat-widget-input .form-control:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.chat-widget-input .btn {
    border-radius: 50%;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .chat-widget-panel {
        width: calc(100vw - 40px);
        right: -10px;
        height: 400px;
    }
}

