/* Main Chatbot Styles */
#cb-bubble {
    position: fixed;
    bottom: var(--cb-bottom);
    width: 60px;
    height: 60px;
    background-color: var(--cb-color);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999999;
    color: #fff;
    transition: transform 0.2s;
}

#cb-bubble:hover {
    transform: scale(1.05);
}

#cb-bubble svg {
    width: 32px;
    height: 32px;
}

#cb-window {
    position: fixed;
    bottom: calc(var(--cb-bottom) + 75px);
    width: 360px;
    max-width: calc(100% - 40px);
    height: 550px;
    max-height: 80vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999999;
    font-family: sans-serif;
}

.cb-header {
    background: var(--cb-color);
    color: #fff;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.cb-title {
    font-weight: bold;
}

.cb-close {
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

#cb-end-chat {
    display: none;
    /* Hidden by default until chat starts */
    font-size: 12px;
    cursor: pointer;
    margin-right: 10px;
    border: 1px solid #fff;
    padding: 2px 8px;
    border-radius: 4px;
}

#cb-welcome {
    padding: 30px;
}

.cb-field {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
}

.cb-btn {
    width: 100%;
    padding: 12px;
    background: var(--cb-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

#cb-chat-area {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    background: #f9fafb;
    height: 100%;
    min-height: 0;
    position: relative;
}

#cb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    padding-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cb-msg {
    max-width: 80%;
    padding: 10px;
    border-radius: 10px;
    font-size: 14px;
    word-wrap: break-word;
    line-height: 1.4;
}

.cb-msg img {
    max-width: 150px !important;
    max-height: 150px !important;
    width: auto !important;
    height: auto !important;
    border-radius: 5px;
    display: block;
    margin: 5px 0;
}

.cb-msg p {
    margin: 0 0 5px 0;
}

.cb-msg strong {
    font-weight: bold;
}

.cb-msg.user {
    align-self: flex-end;
    background: var(--cb-color);
    color: #fff;
    border-bottom-right-radius: 2px;
}

.cb-msg.bot {
    align-self: flex-start;
    background: #e5e7eb;
    color: #333;
    border-bottom-left-radius: 2px;
}

.cb-msg.sys {
    align-self: center;
    background: transparent;
    color: #888;
    font-size: 12px;
    text-align: center;
}

#cb-live-banner {
    background: #fffbeb;
    color: #92400e;
    padding: 8px;
    font-size: 12px;
    text-align: center;
    border-top: 1px solid #fcd34d;
    display: none;
    flex-shrink: 0;
}

#cb-live-banner a {
    color: #d97706;
    font-weight: bold;
}

.cb-input-area {
    padding: 10px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

#cb-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
}

#cb-send-btn {
    background: var(--cb-color);
    color: #fff;
    border: none;
    padding: 0 15px;
    border-radius: 20px;
    cursor: pointer;
}

#cb-rating-view span {
    font-size: 30px;
    color: #ddd;
    transition: color 0.1s;
}

#cb-rating-view span:hover,
#cb-rating-view span.hovered {
    color: #fbbf24;
}

/* Modal Styles */
#cb-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.cb-modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    width: 80%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cb-modal-btns {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

#cb-modal-yes {
    background: var(--cb-color);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

#cb-modal-no {
    background: #e5e7eb;
    color: #333;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
}

@media (max-width: 480px) {
    #cb-window {
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        border-radius: 0;
    }
}