:root {
    
    --chat-primary-color: #FF0099;         
    --chat-primary-dark: #e6008a;          
    --chat-secondary-accent: #6600ff;      
    
    
    --chat-background-color: #000000;      
    --chat-surface-color: #111111;         
    
    
    --chat-text-color: #ffffff;            
    
    
    --chat-agent-bubble-bg: #111111;       
    --chat-user-bubble-bg: #333333;        
    --chat-agent-bubble-text: #1a1a1a;     
    
    
    --chat-border-radius: 25px;
    --chat-shadow-color: rgba(255, 255, 255, 0.1); 
    --chat-font-family: 'Inter', sans-serif;
}


        
        #chat-toggle {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 60px;
            height: 60px;
            background-color: var(--chat-primary-color);
            color: var(--chat-surface-color);
            border: none;
            border-radius: 50%;
            cursor: pointer;
            box-shadow: 0 4px 10px var(--chat-shadow-color);
            font-size: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1001; 
            transition: transform 0.3s, background-color 0.3s;
        }

        #chat-toggle:hover {
            background-color: var(--chat-primary-dark);
            transform: translateY(-3px) scale(1.10);
            border: solid 3px rgba(255, 255, 255, 0.5);
            
        }

        
        #chat-widget {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 350px;
            height:85%;
            max-height: 85%;
            background-color: var(--chat-surface-color);
            border: 2px solid #FFF;
            border-radius: var(--chat-border-radius);
            box-shadow: 0 8px 15px var(--chat-shadow-color);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            z-index: 1002; 
            transform: scale(0);
            transform-origin: bottom right;
            transition: transform 0.3s ease-out;
            font-family: var(--chat-font-family);
        }

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

        
        #chat-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 15px;
            background: linear-gradient(45deg, var(--accent-color) 5%, var(--light-accent));
            color: var(--chat-surface-color);
            font-weight: bold;
            flex-shrink: 0;
        }

        #chat-header * {
            min-width: 100px;
        }

        #chat-header span {
            text-align: center;
        }

        #chat-close {
            background: none;
            border: none;
            color: var(--chat-surface-color);
            font-size: 20px;
            cursor: pointer;
            line-height: 1;
            text-align: right;
        }
        #chat-close:hover {
            transform: translateY(3px) scale(0.98);
        }

        
        #chat-window {
            flex-grow: 1;
            padding: 15px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 10px;
            background-color: var(--chat-background-color);
            scrollbar-width: none;
            -ms-overflow-style: none;
        }

        
        .message-container {
            display: flex;
            flex-direction: column;
        }

        .message-agent {
            align-self: flex-start;
        }
        .message-agent:has(.custom-injected-widget) {
            width: 100%; /* Allows the internal widget to define its own width up to 100% */
        }

        .message-user {
            align-self: flex-end;
        }

        .message-bubble {
            padding: 10px 14px;
            border-radius: var(--chat-border-radius);
            line-height: 1.4;
            border: solid 1px rgba(164, 23, 192, 0.5);
        }

        .message-agent .message-bubble {
            background-color: var(--chat-agent-bubble-bg);
            border-bottom-left-radius: 0px;
            border-top-left-radius: 0px;
            color: var(--chat-text-color);
        }

        .message-user .message-bubble {
            background-color: var(--chat-user-bubble-bg);
            border-bottom-right-radius: 0px;
            border-top-right-radius: 0px;
            color: var(--chat-text-color);
        }
        
        
        .message-system {
            align-self: center;
            font-size: 12px;
            color: #777;
            text-align: center;
            padding: 5px 0;
        }

        
        #input-area {
            display: flex;
            padding: 10px;
            background: linear-gradient(45deg, var(--accent-color) 50%, var(--light-accent));
            border-top: 1px solid #eee;
            flex-shrink: 0;
        }

        #chat-input {
            flex-grow: 1;
            padding: 0.8rem;
            border: 1px solid #ccc;
            background-color: #2b1c25;
            border-radius: var(--chat-border-radius);
            margin-right: 8px;
            font-size: 14px;
            min-height: 20px;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }

        #send-button {
            background-color: #2b1c25;
            color: white;
            border: none;
            padding: 10px 15px;
            border-radius: var(--chat-border-radius);
            cursor: pointer;
            transition: background-color 0.2s;
            flex-shrink: 0;
            min-height: 40px;
            max-height: 50%;
            margin: auto 0px;
        }

        #send-button:hover {
            background-color: #000000;
            transform: translateY(3px) scale(0.98); box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
        }

        #send-button:disabled {
            background-color: #ccc;
            cursor: not-allowed;
        }

        
        #typing-indicator {
            display: none;
            align-items: center;
            margin-bottom: 10px;
            align-self: flex-start;
        }

        #typing-indicator div {
            background-color: #00000000;
            border-style: none;
        }

        .typing-dot {
            width: 8px;
            height: 8px;
            background-color: #aaa;
            border-radius: 50%;
            margin-left: 4px;
            animation: bounce 1.2s infinite ease-in-out;
        }

        .typing-dot:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-dot:nth-child(3) {
            animation-delay: 0.4s;
        }



        .custom-injected-widget {
    background-color: var(--chat-agent-bubble-bg);
    border: 1px solid rgba(164, 23, 192, 0.5);
    border-radius: var(--chat-border-radius);
    border-bottom-left-radius: 0px;
    padding: 10px;
    margin-top: 5px;
    color: var(--chat-text-color);
    box-sizing: border-box;
    /* Default size if not specified in payload */
    width: auto;
    max-width: 100%;
}

.injected-body {
    width: 100%;
}





        @keyframes bounce {
            0%, 80%, 100% {
                transform: translateY(0);
            }
            40% {
                transform: translateY(-5px);
            }
        }

        
        
        
        .quick-replies-container {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            padding: 5px 0;
            margin-bottom: 5px; 
        }
        .quick-reply-button {
            background-color: var(--chat-surface-color);
            color: var(--chat-primary-color);
            border: 1px solid var(--chat-primary-color);
            padding: 8px 12px;
            border-radius: 20px;
            cursor: pointer;
            transition: background-color 0.2s;
            font-size: 14px;
        }
        .quick-reply-button:hover:not(:disabled) {
            background-color: var(--chat-primary-color);
            color: var(--chat-surface-color);
        }
        .quick-reply-button:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        
        .submission-form {
            background-color: var(--chat-surface-color);
            padding: 15px;
            border-radius: var(--chat-border-radius);
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
            margin-bottom: 10px;
        }
        .submission-form label {
            display: block;
            margin-top: 10px;
            margin-bottom: 5px;
            font-size: 13px;
            font-weight: bold;
        }
        .submission-form input[type="text"],
        .submission-form textarea {
            width: calc(100% - 22px);
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: var(--chat-border-radius);
            box-sizing: content-box;
            font-size: 14px;
        }
        .submission-form textarea {
            resize: vertical;
            min-height: 60px;
        }
        .submission-form button[type="submit"] {
            margin-top: 15px;
            width: 100%;
            background-color: var(--chat-primary-color);
            color: white;
            border: none;
            padding: 10px;
            border-radius: var(--chat-border-radius);
            cursor: pointer;
        }
        .submission-form button[type="submit"]:hover {
            background-color: var(--chat-primary-dark);
        }

        
        .accordion-container {
            margin-bottom: 10px; 
        }
        .accordion-header {
            background-color: var(--chat-primary-color);
            color: var(--chat-text-color);
            padding: 10px 14px;
            cursor: pointer;
            border-radius: var(--chat-border-radius);
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-weight: bold;
        }
        .accordion-content {
            padding: 10px 14px;
            display: none;
            background-color: var(--chat-surface-color);
            border: 1px solid #eee;
            border-top: none;
            overflow: hidden;
            max-height: 0;
            transition: max-height 0.3s ease-in-out;
            border-bottom-left-radius: var(--chat-border-radius);
            border-bottom-right-radius: var(--chat-border-radius);
            white-space: pre-wrap;
        }
        .accordion-content.open {
            max-height: 500px; 
            border-top: 1px solid #eee;
            display: block;
        }
        .accordion-arrow {
            transition: transform 0.3s;
        }
        .accordion-header.open .accordion-arrow {
            transform: rotate(90deg);
        }

        
        .handoff-button {
            margin: 5px 0 15px 0;
            width: 100%;
            background-color: #FF5722; 
            color: white;
            border: none;
            padding: 12px;
            border-radius: var(--chat-border-radius);
            cursor: pointer;
            transition: background-color 0.2s;
        }
        .handoff-button:hover {
            background-color: #E64A19;
        }

        
        .human-mode-status {
            padding: 10px;
            text-align: center;
            background-color: #fff3e0;
            color: #f57c00;
            font-weight: bold;
            border-top: 1px solid #ffcc80;
            font-size: 14px;
        }

        
        #end-chat-button {
            background: none;
            border: none;
            color: var(--chat-surface-color);
            font-size: 14px;
            cursor: pointer;
            text-align: left;
        }

        #end-chat-button:hover {
            text-decoration: underline;
            transform: translateY(3px) scale(0.98);
        }

        
        @media (max-width: 400px) {
            #chat-widget {
                width: calc(100% - 40px);
                right: 0px;
                left: 0px;
                margin: 0 20px;
            }
        }
