/* Chatbot Widget Styles - DaonPay Premium Theme */
:root {
    /* Premium Blue Palette */
    --cb-primary: #1a237e; /* Deep Indigo - Premium */
    --cb-primary-hover: #283593;
    --cb-accent: #e8eaf6;  /* Very Light Indigo */
    --cb-bg: #ffffff;
    --cb-text: #1e293b;    /* Slate 800 */
    --cb-text-light: #64748b; /* Slate 500 */
    --cb-header-text: #ffffff;
    --cb-radius: 20px;
    --cb-shadow: 0 10px 40px rgba(0,0,0,0.15);
    --cb-border: #f1f5f9;
}

/* Floating Button */
#cb-trigger {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: var(--cb-primary);
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(26, 35, 126, 0.4);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#cb-trigger:hover {
    transform: scale(1.05);
    background: var(--cb-primary-hover);
    box-shadow: 0 6px 20px rgba(26, 35, 126, 0.5);
}

#cb-trigger i {
    font-size: 32px;
    color: white;
    transition: transform 0.3s;
}

#cb-trigger.cb-open {
    background: var(--cb-bg);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transform: rotate(90deg);
}

#cb-trigger.cb-open i {
    color: var(--cb-text); 
}

/* Chat Window */
#cb-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background: var(--cb-bg);
    border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid rgba(0,0,0,0.05);
}

#cb-window.cb-active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Mobile Styling */
@media (max-width: 480px) {
    #cb-window {
        bottom: 85px;
        right: 15px;
        width: calc(100% - 30px);
        height: auto;
        max-height: 70vh;
        border-radius: 15px;
        z-index: 10000;
        box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    }
    #cb-trigger.cb-open {
        z-index: 10001;
        bottom: 20px;
        right: 20px;
    }
    #cb-trigger {
        bottom: 15px;
        right: 15px;
        width: 55px;
        height: 55px;
    }
    #cb-trigger i {
        font-size: 26px;
    }
}

/* Header */
.cb-header {
    background: linear-gradient(135deg, #1a237e, #3949ab); /* Deep Blue Gradient */
    padding: 24px;
    color: var(--cb-header-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cb-title h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
}

.cb-title p {
    margin: 4px 0 0;
    font-size: 14px;
    opacity: 0.9;
    color: rgba(255,255,255,0.9);
}

.cb-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.cb-close:hover {
    background: rgba(255,255,255,0.4);
    transform: rotate(90deg);
}

/* Message Area */
.cb-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: #f8fafc; /* Very light cool gray */
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Bubbles */
.cb-message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 18px; /* Softer roundness */
    font-size: 15px;
    line-height: 1.6;
    position: relative;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.cb-bot {
    align-self: flex-start;
    background: white;
    color: var(--cb-text);
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
}

.cb-user {
    align-self: flex-end;
    background: var(--cb-primary);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 5px rgba(26, 35, 126, 0.2);
}

.cb-bot.greeting {
    white-space: pre-line;
}

/* Options Container */
.cb-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 5px;
    width: 100%;
}

.cb-option-btn {
    background: white;
    border: 1px solid #e2e8f0;
    color: var(--cb-primary);
    padding: 14px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s;
    text-align: center;
    width: 100%;
}

.cb-option-btn:hover {
    background: var(--cb-accent);
    border-color: #c5cae9;
    transform: translateY(-2px);
}

/* Input Form inside Chat */
.cb-form {
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid #f1f5f9;
}

.cb-input, .cb-textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
    background: #f8fafc;
    color: var(--cb-text);
    font-family: inherit;
    box-sizing: border-box; /* Fix overflow */
}

.cb-textarea {
    resize: none;
    height: 80px;
}

.cb-input:focus, .cb-textarea:focus {
    border-color: var(--cb-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
}

.cb-input.cb-error-shake {
    animation: cb-shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
    border-color: #ef4444; /* Red 500 */
    background: #fef2f2;
}

/* Error Toast inside Chat */
.cb-error-toast {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #ef4444;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10000;
    pointer-events: none;
    white-space: nowrap;
}

.cb-error-toast.cb-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@keyframes cb-shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.cb-submit-btn {
    background: var(--cb-primary);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 16px;
    transition: all 0.2s;
    margin-top: 5px;
}

.cb-submit-btn:hover {
    background: var(--cb-primary-hover);
    box-shadow: 0 4px 12px rgba(26, 35, 126, 0.3);
}

.cb-submit-btn.cb-sent {
    background: #10b981; /* Emerald 500 - Success Green */
    cursor: default;
    box-shadow: none;
    pointer-events: none; /* Disable hover/click */
}

/* Scrollbar */
.cb-messages::-webkit-scrollbar {
    width: 6px;
}
.cb-messages::-webkit-scrollbar-track {
    background: transparent;
}
.cb-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Animations */
@keyframes cb-pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(26, 35, 126, 0.7);
        border-color: var(--cb-primary);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(26, 35, 126, 0);
        border-color: var(--cb-primary-hover);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(26, 35, 126, 0);
        border-color: rgba(0,0,0,0.1);
    }
}

.cb-highlight {
    animation: cb-pulse-glow 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
