/* Hybrid Chatbot Widget Styles */
/* Combining Structure with Dark Glassmorphism */

:root {
    /* MK Dreza Inspired Dark Theme Colors */
    --cb-primary: #A4863D;
    --cb-primary-dark: #8A7031;
    --cb-primary-glow: rgba(164, 134, 61, 0.4);
    --cb-primary-alpha: rgba(164, 134, 61, 0.8);
    
    /* Deep Dark Glass */
    --cb-bg-base: rgba(10, 10, 10, 0.85); /* Deep dark blue/black */
    --cb-bg-off: rgba(255, 255, 255, 0.05); /* Subtle inner element background */
    --cb-text-main: #ffffff;
    --cb-text-muted: rgba(255, 255, 255, 0.6);
    --cb-border: rgba(255, 255, 255, 0.1);
    
    /* Layout & Styling */
    --cb-font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --cb-shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);
    --cb-radius-lg: 20px;
    --cb-radius-md: 12px;
    --cb-radius-sm: 8px;
    
    /* Z-Index */
    --cb-z-toggle: 10000;
    --cb-z-container: 10001;
}

/* --- Floating Toggle Button (Pulsing Neon Style) --- */
.chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #A4863D; /* Solid Dark Goldenrod */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: var(--cb-z-toggle);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    background: #8A7031; /* Darker Goldenrod hover */
    box-shadow: 0 6px 25px rgba(164, 134, 61, 0.5);
}

.chatbot-toggle.pulse {
    animation: cb-pulse 2s infinite;
}

@keyframes cb-pulse {
    0% { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); }
    50% { box-shadow: 0 4px 30px var(--cb-primary-glow); }
    100% { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); }
}

.chatbot-badge {
    position: absolute;
    top: 0px;
    right: 0px;
    background: #ef4444; 
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--cb-font);
    border: 2px solid var(--cb-bg-base);
}

/* --- Chat Container (Spring Animation) --- */
.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 140px);
    background: var(--cb-bg-base);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-lg);
    box-shadow: var(--cb-shadow-lg);
    
    /* THE MAGIC ANIMATION BITS */
    transform: scale(0);
    transform-origin: bottom right; /* Anchors the shrink/grow to the toggle button */
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease; /* Added a slight bounce effect */
    opacity: 0;
    pointer-events: none;
    
    z-index: var(--cb-z-container);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: var(--cb-font);
    color: var(--cb-text-main);
}

/* If your JS uses .active instead of .open, change this class name to match! */
.chatbot-container.open, 
.chatbot-container.active {
    transform: scale(1);
    opacity: 1;
    pointer-events: all;
}
/* --- Header --- */
.chatbot-header {
    background: rgba(164, 134, 61, 0.15); /* Tinted transparent orange */
    border-bottom: 1px solid var(--cb-border);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chatbot-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(164, 134, 61, 0.2);
    border: 1px solid rgba(164, 134, 61, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    color: var(--cb-primary);
}

.chatbot-name {
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
}

.chatbot-status {
    font-size: 12px;
    font-weight: 500;
    color: var(--cb-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-close {
    background: transparent;
    border: none;
    color: var(--cb-text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--cb-radius-sm);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* --- Messages Area --- */
.chatbot-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: transparent; /* Let the container's glassmorphism show through */
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatbot-messages::-webkit-scrollbar { width: 6px; }
.chatbot-messages::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.02); }
.chatbot-messages::-webkit-scrollbar-thumb { background: rgba(164, 134, 61, 0.3); border-radius: 10px; }
.chatbot-messages::-webkit-scrollbar-thumb:hover { background: rgba(164, 134, 61, 0.6); }

/* --- Message Bubbles --- */
.chatbot-message {
    display: flex;
    flex-direction: column;
    animation: cb-messageAppear 0.3s ease;
}

@keyframes cb-messageAppear {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chatbot-message-bubble {
    padding: 14px 18px;
    border-radius: var(--cb-radius-md);
    max-width: 85%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.5;
}

.chatbot-message-user { align-items: flex-end; }
.chatbot-message-user .chatbot-message-bubble {
    background: rgba(164, 134, 61, 0.85);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(164, 134, 61, 0.2);
}

.chatbot-message-bot { align-items: flex-start; }
.chatbot-message-bot .chatbot-message-bubble {
    background: var(--cb-bg-off);
    color: var(--cb-text-main);
    border: 1px solid var(--cb-border);
    border-bottom-left-radius: 4px;
}

.chatbot-message-time {
    font-size: 11px;
    color: var(--cb-text-muted);
    margin-top: 6px;
    padding: 0 4px;
}

/* --- Links & Service Recommendations --- */
.chatbot-message strong {
    color: var(--cb-primary);
}

.chatbot-link {
    color: var(--cb-primary);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dotted var(--cb-primary);
    transition: color 0.2s;
}

.chatbot-link:hover {
    color: var(--cb-primary-dark);
}

.chatbot-link.btn-chatbot-primary {
    background: var(--cb-primary-alpha);
    color: var(--cb-text-main) !important;
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-block;
    margin-top: 8px;
    border: none;
    text-decoration: none;
}

.service-recommendations {
    margin-top: 10px;
    padding: 10px;
    background: rgba(164, 134, 61, 0.1);
    border-radius: 8px;
    border-left: 3px solid var(--cb-primary);
}

.service-recommendations ul {
    margin: 5px 0;
    padding-left: 20px;
}

.service-recommendations li {
    margin-bottom: 5px;
    color: var(--cb-primary);
}

/* --- MK Dreza Typing Indicator --- */
.chatbot-typing-indicator {
    display: flex;
    gap: 6px;
    padding: 14px 18px;
    background: var(--cb-bg-off);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-md);
    border-bottom-left-radius: 4px;
    width: fit-content;
    animation: cb-messageAppear 0.3s ease;
}

.chatbot-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--cb-primary);
    border-radius: 50%;
    animation: cb-typingBounce 1.4s infinite ease-in-out both;
}

.chatbot-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.chatbot-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes cb-typingBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* --- MK Dreza Quick Replies --- */
.chatbot-quick-replies {
    display: flex;
    gap: 8px;
    padding-top: 8px;
    flex-wrap: wrap;
}

.chatbot-quick-reply {
    padding: 8px 16px;
    background: rgba(164, 134, 61, 0.1);
    border: 1px solid rgba(164, 134, 61, 0.4);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--cb-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--cb-font);
}

.chatbot-quick-reply:hover {
    background: rgba(164, 134, 61, 0.25);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(164, 134, 61, 0.15);
}

/* --- Input Area --- */
.chatbot-input-area {
    padding: 16px 24px;
    background: rgba(10, 10, 10, 0.95); /* Solid base for input to ensure readability */
    border-top: 1px solid var(--cb-border);
}

.chatbot-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: border-color 0.3s ease;
}

.chatbot-input-wrapper:focus-within {
    border-color: rgba(164, 134, 61, 0.6);
}

.chatbot-input-wrapper input {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    font-size: 14px;
    color: white;
    font-family: var(--cb-font);
    outline: none;
}

.chatbot-input-wrapper input::placeholder {
    color: var(--cb-text-muted);
}

.chatbot-send {
    width: 36px;
    height: 36px;
    border: none;
    background: #A4863D; /* Solid Dark Goldenrod */
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send:hover {
    background: #8A7031; /* Darker Goldenrod hover */
    transform: scale(1.05);
}

/* --- Inline Quote Form Overrides --- */
.chatbot-quote-form input:focus, 
.chatbot-quote-form textarea:focus {
    border-color: #A4863D !important;
    box-shadow: 0 0 0 2px rgba(164, 134, 61, 0.4) !important;
}

.chatbot-quote-form button {
    background: #A4863D !important;
}

.chatbot-quote-form button:hover:not(:disabled) {
    background: #8A7031 !important;
    box-shadow: 0 4px 15px rgba(164, 134, 61, 0.4) !important;
}

/* --- Overrides for Multi-Select Checkboxes --- */
.cb-dropdown[open] {
    border-color: #A4863D !important;
}

.cb-dropdown-content input[type="checkbox"] {
    accent-color: #A4863D !important;
}

.bs-trigger-chat:hover .bs-checkbox {
    border-color: #A4863D !important;
}

/* --- Responsive Design --- */
@media (max-width: 480px) {
    .chatbot-container {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
}