/* ─── AI Chatbot Widget ─────────────────────────────────── */

.dg-chatbot-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--ds-gold, #c9a96e);
    color: var(--ds-black, #111);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(201, 169, 110, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dg-chatbot-fab:hover { transform: scale(1.1); }
.dg-chatbot-fab.active { background: #c0392b; color: #fff; }

.dg-chatbot-container {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: 9999;
    width: 380px;
    max-height: 520px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dg-chatbot-header {
    background: var(--ds-gold, #c9a96e);
    color: var(--ds-black, #111);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
}

.dg-chatbot-close {
    background: none;
    border: none;
    color: var(--ds-black, #111);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
}

.dg-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 300px;
}

.dg-chat-msg { margin-bottom: 12px; display: flex; }
.dg-chat-user { justify-content: flex-end; }
.dg-chat-model { justify-content: flex-start; }

.dg-chat-bubble {
    max-width: 80%;
    padding: 10px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.dg-chat-user .dg-chat-bubble {
    background: var(--ds-gold, #c9a96e);
    color: var(--ds-black, #111);
    border-bottom-right-radius: 4px;
}

.dg-chat-model .dg-chat-bubble {
    background: #323232;
    color: #e8e0d0;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dg-typing { display: flex; gap: 4px; padding: 14px 20px; }
.dg-typing span {
    width: 8px;
    height: 8px;
    background: var(--ds-gold, #c9a96e);
    border-radius: 50%;
    animation: dgTyping 1.2s infinite ease-in-out;
}
.dg-typing span:nth-child(2) { animation-delay: 0.2s; }
.dg-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dgTyping {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.1); }
}

.dg-chatbot-input {
    display: flex;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: #323232;
}

.dg-chatbot-input input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px 16px;
    color: #fff;
    font-size: 14px;
}

.dg-chatbot-input input:focus { outline: none; }

.dg-chatbot-input button {
    background: none;
    border: none;
    color: var(--ds-gold, #c9a96e);
    padding: 0 16px;
    font-size: 18px;
    cursor: pointer;
}

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 600px) {
    .dg-chatbot-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100% !important;
        max-width: 100% !important;
        height: 100%;
        height: -webkit-fill-available;
        max-height: 100%;
        max-height: -webkit-fill-available;
        border-radius: 0;
        border: none;
        z-index: 99999;
        overflow: hidden;
        padding-top: env(safe-area-inset-top);
        touch-action: manipulation;
    }
    .dg-chatbot-header {
        padding: 16px 16px;
        font-size: 16px;
        flex-shrink: 0;
        box-sizing: border-box;
        width: 100%;
    }
    .dg-chatbot-close {
        font-size: 28px;
        padding: 4px;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    .dg-chatbot-messages {
        min-height: 0;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    .dg-chatbot-input {
        flex-shrink: 0;
        padding-bottom: env(safe-area-inset-bottom);
        box-sizing: border-box;
        width: 100%;
    }
    .dg-chatbot-input input {
        min-width: 0;
        width: 0;
        flex: 1;
        font-size: 16px; /* prevents iOS auto-zoom on focus */
    }
    .dg-chatbot-fab {
        bottom: calc(16px + env(safe-area-inset-bottom));
        right: 16px;
    }
}

@supports (height: 100dvh) {
    @media (max-width: 600px) {
        .dg-chatbot-container {
            height: 100dvh;
            max-height: 100dvh;
        }
    }
}
