.chatbot-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.chatbot-launcher {
    min-width: 160px;
    height: 56px;
    padding: 0 20px;
    border-radius: 28px;
    background: var(--chatbot-color, #8F4B8E);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.chatbot-launcher.has-gradient {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
}

.chatbot-launcher-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.chatbot-launcher-text {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}

/* Text position variants */
.chatbot-launcher.position-left {
    flex-direction: row-reverse;
}

.chatbot-launcher.position-right {
    flex-direction: row;
}

.chatbot-launcher:hover {
    transform: scale(1.05);
}

.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 520px;
    background: #f4f4f4;
    border-radius: 24px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s, transform 0.3s;
}

.chatbot-window.hidden {
    display: none;
    opacity: 0;
    transform: translateY(20px);
}

.chatbot-header {
    background: var(--chatbot-color, #8F4B8E);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
}

.chatbot-header.has-gradient {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
}

.chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    overflow: hidden;
    flex-shrink: 0;
}

.chatbot-avatar-text {
    color: white;
}

.chatbot-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chatbot-title-area h3 {
    margin: 0 0 2px 0;
    font-size: 16px;
    color: white;
    font-weight: 600;
}

.chatbot-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: #4ade80;
    border-radius: 50%;
    display: inline-block;
}

#chatbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
}
#chatbot-close:hover { opacity: 1; }

.chatbot-messages {
    flex: 1;
    padding: 20px 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.chat-message.assistant {
    align-self: flex-start;
    background: white;
    color: #333;
    border-top-left-radius: 4px;
}

.chat-message.user {
    align-self: flex-end;
    background: var(--chatbot-color, #8F4B8E);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.chat-action-btn {
    display: inline-block;
    background: transparent;
    border: 1px solid var(--chatbot-color, #8F4B8E);
    color: var(--chatbot-color, #8F4B8E);
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.chat-action-btn:hover {
    background: var(--chatbot-color, #8F4B8E);
    color: white;
}

.chatbot-input-area {
    padding: 15px;
    padding-bottom: max(15px, env(safe-area-inset-bottom));
    background: white;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid #ddd;
}

.chatbot-input-area input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--chatbot-color, #8F4B8E);
    border-radius: 20px;
    outline: none;
    font-size: 16px; /* 16px disables iOS Safari automatic zooming on focus */
}

.chatbot-input-area button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--chatbot-color, #8F4B8E);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.typing-indicator {
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-top-left-radius: 4px;
    width: fit-content;
    display: none;
    align-self: flex-start;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #ccc;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@media (max-width: 480px) {
    .chatbot-widget-container {
        bottom: 15px;
        right: 15px;
    }
    .chatbot-window {
        width: calc(100vw - 30px);
        max-width: 350px;
        height: 60vh;
        max-height: 500px;
        bottom: 70px;
        right: 0;
        left: auto;
        top: auto;
        border-radius: 24px;
        position: absolute;
        z-index: 1000000;
    }
    .chatbot-header {
        border-top-left-radius: 24px;
        border-top-right-radius: 24px;
        padding-top: 15px;
    }
    .chatbot-input-area {
        padding-bottom: 15px;
    }
}
