#chatkit-container {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    box-sizing: border-box;
    contain: layout style paint;
}

#chatkit-container.open {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Close control — top-left to avoid overlapping ChatKit chrome on the right */
#chatkit-close-button {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 20;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

#chatkit-close-button:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#chatkit-close-button:focus-visible {
    outline: 2px solid #eab308;
    outline-offset: 2px;
}

#chatkit-close-button svg {
    width: 22px;
    height: 22px;
    fill: #1a1a1a;
}

/* Ensure ChatKit widget fills container */
#chatkit-container openai-chatkit {
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

/* Toggle button */
#chat-toggle-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    min-width: 200px;
    height: 70px;
    padding: 12px 16px;
    border-radius: 12px;
    background: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#chat-toggle-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

#chat-toggle-button:active {
    transform: translateY(0);
}

/* Robot icon container */
#chat-toggle-button .robot-icon-container {
    position: relative;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
}

/* Robot icon circle */
#chat-toggle-button .robot-icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #157535;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Robot icon SVG */
#chat-toggle-button .robot-icon-circle svg {
    width: 32px;
    height: 32px;
    fill: white;
}

/* Online status indicator */
#chat-toggle-button .online-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #4CAF50;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Text content */
#chat-toggle-button .button-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-width: 0;
}

#chat-toggle-button .button-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.2;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

#chat-toggle-button .button-status {
    font-size: 13px;
    font-weight: 400;
    color: #666;
    line-height: 1.2;
    margin: 2px 0 0 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Hide old chat/close icons */
#chat-toggle-button .chat-icon,
#chat-toggle-button .close-icon {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    #chatkit-container {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        top: 10px;
        bottom: 83px;
        right: 10px;
        left: 10px;
        height: auto;
        max-height: none;
    }

    #chatkit-close-button {
        top: 8px;
        left: 8px;
        width: 38px;
        height: 38px;
    }

    #chatkit-close-button svg {
        width: 20px;
        height: 20px;
    }
    
    #chat-toggle-button {
        bottom: 15px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        min-width: 180px;
        height: 64px;
        padding: 10px 14px;
        z-index: 1002;
        position: fixed;
    }
    
    #chat-toggle-button:hover {
        transform: translateX(-50%) translateY(-2px);
    }
    
    #chat-toggle-button:active {
        transform: translateX(-50%);
    }
    
    #chat-toggle-button .robot-icon-container {
        width: 44px;
        height: 44px;
    }
    
    #chat-toggle-button .robot-icon-circle {
        width: 44px;
        height: 44px;
    }
    
    #chat-toggle-button .robot-icon-circle svg {
        width: 28px;
        height: 28px;
    }
    
    #chat-toggle-button .button-title {
        font-size: 15px;
    }
    
    #chat-toggle-button .button-status {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    #chatkit-container {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        top: 8px;
        bottom: 76px;
        right: 8px;
        left: 8px;
        height: auto;
        max-height: none;
    }

    #chatkit-close-button {
        top: 6px;
        left: 6px;
        width: 36px;
        height: 36px;
    }

    #chatkit-close-button svg {
        width: 18px;
        height: 18px;
    }
    
    #chat-toggle-button {
        bottom: 12px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        min-width: 160px;
        height: 60px;
        padding: 8px 12px;
        z-index: 1002;
        position: fixed;
    }
    
    #chat-toggle-button:hover {
        transform: translateX(-50%) translateY(-2px);
    }
    
    #chat-toggle-button:active {
        transform: translateX(-50%);
    }
    
    #chat-toggle-button .robot-icon-container {
        width: 40px;
        height: 40px;
    }
    
    #chat-toggle-button .robot-icon-circle {
        width: 40px;
        height: 40px;
    }
    
    #chat-toggle-button .robot-icon-circle svg {
        width: 24px;
        height: 24px;
    }
    
    #chat-toggle-button .button-title {
        font-size: 14px;
    }
    
    #chat-toggle-button .button-status {
        font-size: 11px;
    }
}