/* KD Custom Chat Embed Styles */
#kdcce-chat-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    pointer-events: none;
}

#kdcce-chat-container * {
    box-sizing: border-box;
}

.kdcce-widget-container {
    position: relative;
    pointer-events: auto;
}

.kdcce-chat-toggle-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #007bff;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.kdcce-chat-toggle-button:hover {
    background-color: #0056b3;
    transform: scale(1.05);
}

.kdcce-chat-toggle-button svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.kdcce-chat-window {
    width: 360px;
    max-height: 600px;
    height: 70vh;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease;
    position: absolute;
    bottom: calc(100% + 15px);
    right: 0;
    transform-origin: bottom right;
}

.kdcce-chat-window.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

.kdcce-chat-header {
    background-color: #007bff;
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.kdcce-chat-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.kdcce-chat-header button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    line-height: 0;
}

.kdcce-chat-header button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.kdcce-chat-header button svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.kdcce-chat-messages {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    background-color: #f8f9fa;
}

.kdcce-message-bubble {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    margin-bottom: 0.75rem;
    word-wrap: break-word;
    line-height: 1.4;
    clear: both;
}

.kdcce-message-bubble.user {
    background-color: #007bff;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 0.25rem;
    float: right;
}

.kdcce-message-bubble.bot {
    background-color: #e9ecef;
    color: #343a40;
    margin-right: auto;
    border-bottom-left-radius: 0.25rem;
    float: left;
}

.kdcce-message-bubble.loading {
    font-style: italic;
}

.kdcce-message-bubble a {
    color: #0056b3;
    text-decoration: underline;
}

.kdcce-message-bubble.user a {
    color: #ffffff;
    font-weight: bold;
}

.kdcce-chat-input-area {
    display: flex;
    padding: 1rem;
    border-top: 1px solid #e2e8f0;
    background-color: white;
    flex-shrink: 0;
}

.kdcce-chat-input-area input {
    flex-grow: 1;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.kdcce-chat-input-area input:focus {
    border-color: #007bff;
}

.kdcce-chat-input-area button {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem;
    margin-left: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kdcce-chat-input-area button:hover {
    background-color: #0056b3;
}

.kdcce-chat-input-area button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

@media (max-width: 480px) {
    #kdcce-chat-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
        top: 10px;
        pointer-events: none;
    }

    .kdcce-widget-container {
        position: absolute;
        bottom: 0;
        right: 0;
        pointer-events: auto;
    }

    .kdcce-chat-window {
        position: fixed;
        top: 10px;
        right: 10px;
        bottom: 80px;
        left: 10px;
        width: auto;
        height: auto;
    }

    .kdcce-chat-toggle-button {
        position: absolute;
        bottom: 0;
        right: 0;
    }
}