/* Dreams & Designs - Chatbot Widget Styles (lightweight, no framework) */

#dd-chatbot-root { position: relative; }

/* Toggle button - sits below #scroll-to-top, right-aligned to it */
.dd-chat-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--color-primary, #d63384);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 997;
    transition: transform 0.2s ease;
}
.dd-chat-toggle:hover { transform: scale(1.06); }

.dd-chat-panel {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.98);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    z-index: 996;
}
.dd-chat-panel--open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.dd-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--color-primary, #d63384), #b02a6f);
    color: #fff;
    flex-shrink: 0;
}
.dd-chat-header-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.dd-chat-header-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
}
.dd-chat-header-title { font-weight: 600; font-size: 14.5px; line-height: 1.25; color: #fff; }
.dd-chat-header-status { font-size: 11.5px; opacity: 0.85; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.dd-chat-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; display: inline-block; }
.dd-chat-lang, .dd-chat-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 11.5px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.dd-chat-lang:hover, .dd-chat-close:hover { background: rgba(255,255,255,0.32); }

/* Body / messages */
.dd-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f7f5f8;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.dd-chat-row { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.dd-chat-row--bot { justify-content: flex-start; }
.dd-chat-row--user { justify-content: flex-end; }
.dd-chat-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--color-primary, #d63384);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; flex-shrink: 0;
}
.dd-chat-bubble-wrap { max-width: 78%; display: flex; flex-direction: column; }
.dd-chat-row--user .dd-chat-bubble-wrap { align-items: flex-end; }
.dd-chat-bubble {
    padding: 9px 13px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
}
.dd-chat-bubble--bot {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.dd-chat-bubble--user {
    background: var(--color-primary, #d63384);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.dd-chat-bubble p { margin: 0 0 6px; }
.dd-chat-bubble p:last-child { margin-bottom: 0; }
.dd-chat-time { font-size: 10px; color: #999; margin-top: 3px; padding: 0 4px; }
.dd-chat-row--user .dd-chat-time { text-align: right; }

/* Typing indicator */
.dd-chat-typing { display: flex; align-items: center; gap: 4px; padding: 12px 14px; }
.dd-chat-typing span {
    width: 6px; height: 6px; border-radius: 50%;
    background: #bbb;
    display: inline-block;
    animation: dd-chat-blink 1.2s infinite ease-in-out;
}
.dd-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.dd-chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dd-chat-blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

/* Action chips */
.dd-chat-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 34px; }
.dd-chat-chip {
    background: #fff;
    border: 1.5px solid var(--color-primary, #d63384);
    color: var(--color-primary, #d63384);
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 12.5px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.dd-chat-chip:hover { background: var(--color-primary, #d63384); color: #fff; }
.dd-chat-chip--ghost { border-style: dashed; opacity: 0.85; }
.dd-chat-chip--wa { border-color: #25D366; color: #128C46; }
.dd-chat-chip--wa:hover { background: #25D366; color: #fff; }
.dd-chat-link { padding-left: 34px; display: inline-block; color: var(--color-primary, #d63384); font-size: 12.5px; text-decoration: underline; }

/* Lead capture card */
.dd-chat-leadcard {
    margin-left: 34px;
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dd-chat-input-field {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
}
.dd-chat-input-field:focus { outline: none; border-color: var(--color-primary, #d63384); }
.dd-chat-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.dd-chat-leadcard-actions { display: flex; gap: 8px; margin-top: 2px; }
.dd-chat-btn-primary {
    background: var(--color-primary, #d63384);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 12.5px;
    cursor: pointer;
    flex: 1;
}
.dd-chat-skip {
    background: none;
    border: 1px solid #ddd;
    color: #666;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    cursor: pointer;
}

/* Footer input */
.dd-chat-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
}
.dd-chat-textinput {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 22px;
    padding: 10px 16px;
    font-size: 13.5px;
    outline: none;
}
.dd-chat-textinput:focus { border-color: var(--color-primary, #d63384); }
.dd-chat-textinput:disabled { background: #f5f5f5; }
.dd-chat-send {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--color-primary, #d63384);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.dd-chat-send:disabled { background: #ccc; cursor: not-allowed; }

@media (max-width: 480px) {
    .dd-chat-panel { width: calc(100vw - 24px); right: 12px; bottom: 90px; height: 70vh; }
    .dd-chat-toggle { right: 16px; bottom: 16px; width: 54px; height: 54px; font-size: 21px; }
}