/* SDI Chatbot Widget Styles — Brand Colors */

/* Floating Button */
.sdi-chatbot-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0b2a6f, #1287d6);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(11, 42, 111, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999998;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sdi-chatbot-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(11, 42, 111, 0.5);
}

.sdi-chatbot-btn svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.sdi-chatbot-btn .sdi-close-icon {
    display: none;
}

.sdi-chatbot-btn.active .sdi-chat-icon {
    display: none;
}

.sdi-chatbot-btn.active .sdi-close-icon {
    display: block;
}

.sdi-chatbot-btn .sdi-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    display: none;
}

.sdi-chatbot-btn .sdi-badge.show {
    display: block;
}

/* Pulse animation */
@keyframes sdi-pulse {
    0% { box-shadow: 0 0 0 0 rgba(18, 135, 214, 0.5); }
    70% { box-shadow: 0 0 0 15px rgba(18, 135, 214, 0); }
    100% { box-shadow: 0 0 0 0 rgba(18, 135, 214, 0); }
}

.sdi-chatbot-btn.pulse {
    animation: sdi-pulse 2s infinite;
}

/* Chat Window */
.sdi-chatbot-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0);
    transform-origin: bottom right;
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.sdi-chatbot-window.open {
    transform: scale(1);
    opacity: 1;
}

/* Header */
.sdi-chatbot-header {
    background: linear-gradient(135deg, #071a4d, #0b2a6f);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

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

.sdi-chatbot-header .sdi-avatar img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.sdi-chatbot-header .sdi-avatar .sdi-avatar-icon {
    font-size: 20px;
}

.sdi-chatbot-header .sdi-info {
    flex: 1;
}

.sdi-chatbot-header .sdi-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.sdi-chatbot-header .sdi-subtitle {
    font-size: 12px;
    opacity: 0.75;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sdi-chatbot-header .sdi-subtitle::before {
    content: '';
    width: 7px;
    height: 7px;
    background: #22c55e;
    border-radius: 50%;
    display: inline-block;
}

/* Messages Area */
.sdi-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
    scroll-behavior: smooth;
}

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

.sdi-chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

/* Message Bubbles */
.sdi-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: sdi-msg-in 0.3s ease;
}

@keyframes sdi-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.sdi-msg.bot {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.sdi-msg.user {
    background: linear-gradient(135deg, #0b2a6f, #1287d6);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.sdi-msg.bot strong,
.sdi-msg.bot b {
    color: #0b2a6f;
}

.sdi-msg.bot a {
    color: #1287d6;
    text-decoration: underline;
}

/* Typing Indicator */
.sdi-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    max-width: 60px;
}

.sdi-typing span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: sdi-bounce 1.4s infinite ease-in-out;
}

.sdi-typing span:nth-child(1) { animation-delay: 0s; }
.sdi-typing span:nth-child(2) { animation-delay: 0.2s; }
.sdi-typing span:nth-child(3) { animation-delay: 0.4s; }

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

/* Input Area */
.sdi-chatbot-input {
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.sdi-chatbot-input input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.sdi-chatbot-input input:focus {
    border-color: #1287d6;
}

.sdi-chatbot-input input::placeholder {
    color: #94a3b8;
}

.sdi-chatbot-input button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0b2a6f, #1287d6);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}

.sdi-chatbot-input button:hover {
    transform: scale(1.05);
}

.sdi-chatbot-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.sdi-chatbot-input button svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* Lead Capture Form */
.sdi-lead-form {
    display: none;
    padding: 16px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.sdi-lead-form.active {
    display: block;
}

.sdi-lead-form h3 {
    font-size: 15px;
    font-weight: 600;
    color: #071a4d;
    margin: 0 0 12px 0;
}

.sdi-lead-form input,
.sdi-lead-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 8px;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.sdi-lead-form input:focus,
.sdi-lead-form textarea:focus {
    border-color: #1287d6;
}

.sdi-lead-form textarea {
    resize: vertical;
    min-height: 60px;
}

.sdi-lead-form .sdi-lead-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.sdi-lead-form .sdi-btn-submit {
    flex: 1;
    padding: 10px;
    background: linear-gradient(135deg, #0b2a6f, #1287d6);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
    font-family: inherit;
}

.sdi-lead-form .sdi-btn-submit:hover {
    opacity: 0.9;
}

.sdi-lead-form .sdi-btn-cancel {
    padding: 10px 16px;
    background: #f1f5f9;
    color: #64748b;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}

.sdi-lead-form .sdi-btn-cancel:hover {
    background: #e2e8f0;
}

/* Error message */
.sdi-msg.error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

/* === Quick Action Chips (inline in chat) === */
.sdi-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 4px 0;
}

.sdi-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    border: 1.5px solid #c2d3f4;
    border-radius: 20px;
    background: #fff;
    color: #0b2a6f;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sdi-chip:hover {
    background: #e5edfa;
    border-color: #1287d6;
    color: #1287d6;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(18, 135, 214, 0.2);
}

.sdi-chip:active {
    transform: translateY(0);
}

.sdi-chip-emoji {
    font-size: 15px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .sdi-chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        top: auto;
        width: 100%;
        height: 85vh;
        border-radius: 20px 20px 0 0;
        transform-origin: bottom center;
    }

    .sdi-chatbot-btn {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }

    .sdi-chips {
        gap: 6px;
    }
    .sdi-chip {
        font-size: 12px;
        padding: 7px 12px;
    }
}

@media (max-width: 360px) {
    .sdi-chatbot-window {
        height: 90vh;
    }
    .sdi-chatbot-header .sdi-title { font-size: 14px; }
    .sdi-chip { font-size: 11px; padding: 6px 10px; }
}

/* Quiz option chips */
.sdi-quiz-options {
    padding-left: 0;
}
.sdi-quiz-options .sdi-chip {
    background: #f3f6fd;
    border-color: #c2d3f4;
    color: #0b2a6f;
    font-weight: 500;
}
.sdi-quiz-options .sdi-chip:hover {
    background: #0b2a6f;
    border-color: #0b2a6f;
    color: #fff;
    box-shadow: 0 2px 10px rgba(11, 42, 111, 0.3);
}

/* Hot lead nudge chip */
.sdi-chip-hot {
    background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
    border-color: #f59e0b !important;
    color: #92400e !important;
    font-weight: 700 !important;
}
.sdi-chip-hot:hover {
    background: linear-gradient(135deg, #fde68a, #fbbf24) !important;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3) !important;
}
