/* Big Day Events Chatbot */
:root {
    --bdc-accent: #6366f1;
    --bdc-bg: #ffffff;
    --bdc-surface: #f8f9fb;
    --bdc-text: #1e1e2e;
    --bdc-text-muted: #6b7280;
    --bdc-border: #e5e7eb;
    --bdc-radius: 16px;
    --bdc-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Container */
#bdc-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Trigger Button */
#bdc-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: var(--bdc-accent);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

#bdc-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}

#bdc-trigger svg {
    width: 28px;
    height: 28px;
    transition: transform 0.3s ease, opacity 0.2s ease;
}

#bdc-trigger .bdc-icon-close {
    position: absolute;
    transform: rotate(90deg) scale(0);
    opacity: 0;
}

#bdc-trigger.bdc-open .bdc-icon-chat {
    transform: rotate(-90deg) scale(0);
    opacity: 0;
}

#bdc-trigger.bdc-open .bdc-icon-close {
    transform: rotate(0deg) scale(1);
    opacity: 1;
}

/* Pulse ring */
#bdc-trigger::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--bdc-accent);
    opacity: 0;
    animation: bdc-pulse 2.5s ease-out infinite;
}

#bdc-trigger.bdc-open::before {
    animation: none;
    opacity: 0;
}

@keyframes bdc-pulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* Modern Greeting Bubble */
.bdc-greeting-bubble {
    position: absolute;
    bottom: 72px;
    right: 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--bdc-bg);
    padding: 14px 16px;
    border-radius: 16px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    animation: bdc-slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: normal;
    width: 260px;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.bdc-greeting-bubble:hover {
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.18), 0 3px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

@keyframes bdc-slideUp {
    from { opacity: 0; transform: translateY(12px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.bdc-greeting-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bdc-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.bdc-greeting-dot svg {
    width: 15px;
    height: 15px;
}

.bdc-greeting-content {
    flex: 1;
    min-width: 0;
}

.bdc-greeting-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--bdc-accent);
    margin-bottom: 3px;
}

.bdc-greeting-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--bdc-text);
    line-height: 1.4;
}

.bdc-greeting-close {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: var(--bdc-text-muted);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
    margin: -4px -4px 0 0;
}

.bdc-greeting-close:hover {
    background: var(--bdc-surface);
    color: var(--bdc-text);
}

.bdc-greeting-close svg {
    width: 14px;
    height: 14px;
}

@media (max-width: 480px) {
    .bdc-greeting-bubble {
        right: -12px;
        width: 240px;
    }
}

/* Chat Window */
#bdc-window {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: var(--bdc-bg);
    border-radius: var(--bdc-radius);
    box-shadow: var(--bdc-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#bdc-window.bdc-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Body container */
#bdc-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* Header */
.bdc-header {
    background: var(--bdc-accent);
    color: #fff;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.bdc-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bdc-header-avatar svg {
    width: 22px;
    height: 22px;
}

.bdc-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.bdc-header-info p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.85;
}

/* Messages */
.bdc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.bdc-messages::-webkit-scrollbar {
    width: 4px;
}

.bdc-messages::-webkit-scrollbar-thumb {
    background: var(--bdc-border);
    border-radius: 2px;
}

.bdc-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    animation: bdc-fadeIn 0.25s ease;
    word-wrap: break-word;
}

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

.bdc-msg-assistant {
    align-self: flex-start;
    background: var(--bdc-surface);
    color: var(--bdc-text);
    border-bottom-left-radius: 4px;
}

.bdc-msg-user {
    align-self: flex-end;
    background: var(--bdc-accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.bdc-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
    background: var(--bdc-surface);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}

.bdc-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bdc-text-muted);
    animation: bdc-bounce 1.2s ease-in-out infinite;
}

.bdc-typing span:nth-child(2) { animation-delay: 0.15s; }
.bdc-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bdc-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Input area */
.bdc-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--bdc-border);
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
    flex-grow: 0;
    background: var(--bdc-bg);
}

.bdc-input-area textarea {
    flex: 1;
    border: 1px solid var(--bdc-border);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 100px;
    line-height: 1.4;
    background: var(--bdc-surface);
    color: var(--bdc-text);
    transition: border-color 0.2s;
}

.bdc-input-area textarea:focus {
    border-color: var(--bdc-accent);
}

.bdc-input-area textarea::placeholder {
    color: var(--bdc-text-muted);
}

.bdc-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bdc-accent);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}

.bdc-send-btn:hover {
    filter: brightness(1.1);
}

.bdc-send-btn:active {
    transform: scale(0.94);
}

.bdc-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bdc-send-btn svg {
    width: 18px;
    height: 18px;
}

/* Lead capture form */
.bdc-lead-form {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    overflow-y: auto;
}

.bdc-lead-form h4 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
    color: var(--bdc-text);
}

.bdc-lead-form p {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--bdc-text-muted);
}

.bdc-lead-form input,
.bdc-lead-form select,
.bdc-lead-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--bdc-border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: var(--bdc-surface);
    color: var(--bdc-text);
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.bdc-lead-form input:focus,
.bdc-lead-form select:focus,
.bdc-lead-form textarea:focus {
    border-color: var(--bdc-accent);
}

.bdc-lead-form textarea {
    resize: none;
    height: 60px;
}

.bdc-lead-submit {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: var(--bdc-accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s;
    margin-top: 4px;
}

.bdc-lead-submit:hover {
    filter: brightness(1.1);
}

.bdc-lead-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.bdc-skip-btn {
    background: none;
    border: none;
    color: var(--bdc-text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 4px;
    text-align: center;
}

.bdc-skip-btn:hover {
    color: var(--bdc-text);
}

/* Quick actions */
.bdc-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 12px;
    flex-shrink: 0;
}

.bdc-quick-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--bdc-border);
    background: var(--bdc-bg);
    color: var(--bdc-text);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.bdc-quick-btn:hover {
    background: var(--bdc-accent);
    color: #fff;
    border-color: var(--bdc-accent);
}

/* Branding */
.bdc-branding {
    text-align: center;
    padding: 6px;
    font-size: 11px;
    color: var(--bdc-text-muted);
    flex-shrink: 0;
}

/* Message text formatting */
.bdc-msg-assistant strong {
    font-weight: 600;
}

.bdc-msg-assistant br {
    display: block;
    content: '';
    margin-top: 4px;
}

/* Mobile */
@media (max-width: 480px) {
    #bdc-widget {
        bottom: 12px;
        right: 12px;
    }

    #bdc-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        height: 100dvh;
        max-height: 100%;
        max-height: 100dvh;
        border-radius: 0;
        z-index: 999999;
    }

    /* Keep header pinned when keyboard opens */
    #bdc-window .bdc-header {
        position: sticky;
        top: 0;
        z-index: 10;
    }

    #bdc-trigger {
        width: 54px;
        height: 54px;
    }

    .bdc-msg {
        max-width: 90%;
    }

    /* Prevent body scroll when chat is open */
    body.bdc-chat-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    #bdc-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        bottom: 68px;
        right: 0;
        border-radius: 12px;
    }
}
