/* Body scroll lock */
body.chatbox-panel-open {
    overflow: hidden !important;
}

/* Base button styles */
.bot button {
    color: inherit;
    background: transparent;
    border: 0;
    outline: 0 !important;
    cursor: pointer;
}

/* Floating buttons */
.bot button.chatbox-open,
.bot button.chatbox-close {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
    color: #fff;
    background-color: #444;
    border-radius: 50%;
    box-shadow: 12px 15px 20px 0 rgba(46, 61, 73, 0.15);
    z-index: 9999;
}

.bot button.chatbox-close {
    display: none;
}

/* Textarea */
.bot textarea {
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 0 8px;
    height: 24px;
    font-family: inherit;
    font-size: 16px;
    line-height: 24px;
    color: #888;
    border: 0;
    outline: 0 !important;
    resize: none;
    overflow: hidden;
}

.bot textarea::placeholder {
    color: #888;
}

.bot textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f5f5f5;
}

.bot button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Container */
.chatbox-container {
    position: fixed;
    display: none;
    flex-direction: column;
    width: 377px;
    background-color: #fff;
    box-shadow: 5px 5px 25px 0 rgba(46, 61, 73, 0.2);
    z-index: 9999;
}

/* Popup mode */
.chatbox-container.chatbox-popup {
    bottom: 84px;
    right: 16px;
    border-radius: 16px;
}

.chatbox-container.chatbox-popup .chatbox-header {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}
.chatbox-container.chatbox-popup .chatbox-header-title {
    padding-left: 0.5rem;
}
.chatbox-container.chatbox-popup .chatbox-footer {
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.chatbox-container.chatbox-popup .chatbox-avatar {
    font-size: 4rem;
    margin-top: -32px;
    background-color: #fbba03;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
}

.chatbox-container.chatbox-popup .chatbox-main {
    max-height: 400px;
}

.chatbox-container.chatbox-popup .chatbox-minimize {
    display: none !important;
}

/* Panel mode */
.chatbox-container.chatbox-panel {
    top: 0;
    right: 0;
    bottom: 0;
    border-radius: 0;
}

.chatbox-container.chatbox-panel .chatbox-avatar {
    font-size: 3rem;
    margin-top: 0;
    background: transparent;
    border: none;
}

.chatbox-container.chatbox-panel .chatbox-main {
    flex: 1 1 auto;
}

.chatbox-container.chatbox-panel .chatbox-header,
.chatbox-container.chatbox-panel .chatbox-footer {
    flex: 0 0 auto;
}

.chatbox-container.chatbox-panel .chatbox-maximize {
    display: none !important;
}

/* Header */
.chatbox-header {
    display: flex;
    align-items: center;
    padding: 16px;
    color: #fff;
    background-color: #fbba03;
}

.chatbox-avatar-wrapper {
    flex: 0 0 60px;
}

.chatbox-header-title {
    flex: 1;
}

.chatbox-header-title h1 {
    margin: 0;
    font-size: 16px;
    line-height: 1;
}

.chatbox-status {
    display: block;
    font-size: 12px;
    margin-top: 4px;
}

.chatbox-header-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Main content */
.chatbox-main {
    display: flex;
    flex-direction: column;
    padding: 32px 16px;
    overflow-y: auto;
    overflow-x: hidden;
    color: #888;
    text-align: center;
}

/* Footer */
.chatbox-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid #ddd;
}

.chatbox-footer textarea {
    flex: 1;
}

.chatbox-send-btn {
    padding: 4px;
    transition: transform 0.2s ease;
}

.chatbox-send-btn:hover {
    transform: scale(1.1);
}

.chatbox-send-btn:active {
    transform: scale(0.95);
}

.chatbox-send-btn i {
    color: #888;
    transition: color 0.2s ease;
}

.chatbox-send-btn:hover i {
    color: #fbba03;
}

/* Messages */
.chatbox-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 8px 0;
}

.chatbox-welcome-message {
    text-align: center;
    color: #888;
    padding: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.chatbox-message {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
    animation: fadeIn 0.3s ease-in;
}

.chatbox-message-user {
    align-self: flex-end;
    background-color: #fbba03;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chatbox-message-bot {
    align-self: flex-start;
    background-color: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typing indicator */
.chatbox-typing-indicator {
    display: none;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.chatbox-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #888;
    animation: typing 1.4s infinite ease-in-out;
}

.chatbox-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.chatbox-typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Scrollbar */
.chatbox-main::-webkit-scrollbar {
    width: 6px;
}

.chatbox-main::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chatbox-main::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.chatbox-main::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive */
@media (max-width: 480px) {
    .chatbox-container.chatbox-popup {
        width: calc(100% - 32px);
        right: 16px;
        left: 16px;
    }

    .chatbox-container.chatbox-panel {
        width: 100%;
    }

    .chatbox-message {
        max-width: 85%;
    }
}
