/* app/addons/dacenergy_chatbot/static/widget.css */
#dce-chatbot { position: fixed; bottom: 24px; right: 24px; z-index: 99999; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#dce-chatbot * { box-sizing: border-box; }
.dce-bubble { width: 60px; height: 60px; border-radius: 50%; background: var(--dce-color, #2563eb); cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.15); display: flex; align-items: center; justify-content: center; transition: transform .2s; }
.dce-bubble:hover { transform: scale(1.05); }
.dce-bubble svg { width: 28px; height: 28px; fill: #fff; }
.dce-window { position: fixed; bottom: 100px; right: 24px; width: 380px; height: 600px; max-height: calc(100vh - 120px); background: #fff; border-radius: 12px; box-shadow: 0 12px 48px rgba(0,0,0,.18); display: none; flex-direction: column; overflow: hidden; }
.dce-window.dce-open { display: flex; }
/* Lock background page scroll when chat is open (prevents iOS bleed-through) */
body.dce-chat-open { overflow: hidden !important; position: fixed !important; width: 100% !important; top: 0 !important; left: 0 !important; right: 0 !important; touch-action: none; }
/* Searching indicator (shown during tool calls) */
.dce-searching { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #f1f5f9; border-radius: 14px; align-self: flex-start; color: #475569; font-size: 13px; max-width: 80%; }
.dce-searching .dce-spinner { width: 14px; height: 14px; border: 2px solid #cbd5e1; border-top-color: #2563eb; border-radius: 50%; animation: dce-spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes dce-spin { to { transform: rotate(360deg); } }
/* Make sure input row never collapses */
.dce-input-row { flex-shrink: 0; }
.dce-header { flex-shrink: 0; }
/* Mobile / touch devices — full-screen WhatsApp-style chat */
@media (max-width: 768px), (pointer: coarse) {
    #dce-chatbot { bottom: 88px !important; right: 16px !important; }
    .dce-bubble { width: 52px !important; height: 52px !important; }
    .dce-bubble svg { width: 24px !important; height: 24px !important; }
    .dce-window {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        transform: none !important;
    }
    .dce-window.dce-open { z-index: 2147483647 !important; }
    .dce-close { font-size: 32px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; padding: 0; }
    .dce-header { padding: 14px 12px; padding-top: max(14px, env(safe-area-inset-top)); }
    .dce-messages { padding: 12px; }
    .dce-input-row { padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}
.dce-header { padding: 16px; background: var(--dce-color, #2563eb); color: #fff; display: flex; justify-content: space-between; align-items: center; }
.dce-header-title { font-weight: 600; }
.dce-header-status { font-size: 12px; opacity: .85; }
.dce-close { background: transparent; border: none; color: #fff; font-size: 24px; cursor: pointer; line-height: 1; }
.dce-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: #f8f9fb; }
.dce-msg { max-width: 80%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; word-wrap: break-word; white-space: pre-wrap; }
.dce-msg-user { background: var(--dce-color, #2563eb); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.dce-msg-bot { background: #fff; color: #1a1a1a; align-self: flex-start; border-bottom-left-radius: 4px; border: 1px solid #e5e7eb; }
.dce-msg-tool { background: #fef3c7; color: #92400e; font-size: 12px; align-self: center; padding: 4px 10px; border-radius: 10px; }
.dce-product-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px; margin-top: 6px; display: flex; gap: 10px; }
.dce-product-card img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; }
.dce-product-card .dce-pc-info { flex: 1; }
.dce-product-card .dce-pc-name { font-weight: 600; font-size: 13px; margin: 0 0 4px; }
.dce-product-card .dce-pc-price { font-weight: 700; color: var(--dce-color, #2563eb); font-size: 14px; }
.dce-product-card a { color: var(--dce-color, #2563eb); text-decoration: none; font-size: 12px; }
.dce-quick-actions { padding: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.dce-quick-actions button { background: #fff; border: 1px solid #d1d5db; padding: 6px 12px; border-radius: 16px; font-size: 12px; cursor: pointer; }
.dce-quick-actions button:hover { background: #f3f4f6; }
.dce-input-row { display: flex; padding: 12px; border-top: 1px solid #e5e7eb; gap: 8px; align-items: flex-end; overflow: hidden; width: 100%; box-sizing: border-box; }
.dce-input-row textarea { flex: 1 1 auto; min-width: 0; max-width: 100%; resize: none; border: 1px solid #d1d5db; border-radius: 18px; padding: 8px 14px; font-size: 16px; font-family: inherit; max-height: 80px; box-sizing: border-box; }
.dce-input-row button { background: var(--dce-color, #2563eb); color: #fff; border: none; border-radius: 50%; width: 40px; height: 40px; min-width: 40px; cursor: pointer; flex: 0 0 40px; box-sizing: border-box; padding: 0; display: flex; align-items: center; justify-content: center; }
.dce-input-row button:disabled { opacity: .5; cursor: not-allowed; }
.dce-footer { font-size: 11px; color: #6b7280; text-align: center; padding: 6px; }
.dce-footer a { color: #6b7280; }
.dce-consent { position: absolute; inset: 0; background: rgba(255,255,255,.98); z-index: 10; padding: 24px; display: flex; flex-direction: column; justify-content: center; }
.dce-consent h3 { margin: 0 0 12px; }
.dce-consent p { font-size: 13px; line-height: 1.5; color: #374151; margin-bottom: 16px; }
.dce-consent-buttons { display: flex; gap: 8px; }
.dce-consent-buttons button { flex: 1; padding: 10px; border-radius: 8px; border: none; cursor: pointer; font-weight: 600; }
.dce-consent-accept { background: var(--dce-color, #2563eb); color: #fff; }
.dce-consent-refuse { background: #f3f4f6; color: #374151; }
.dce-typing { display: inline-block; }
.dce-typing span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #9ca3af; margin: 0 2px; animation: dce-bounce 1.2s infinite; }
.dce-typing span:nth-child(2) { animation-delay: .2s; } .dce-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes dce-bounce { 0%, 80%, 100% { transform: scale(.6); } 40% { transform: scale(1); } }
