/*
 * ELC Mart AI Assistant — chat widget styles.
 */
/* Lazy loading: the widget starts hidden and is revealed by chat-widget.js after
   the visitor-dependent delay (6s first-time / 4s returning). A hidden element
   costs nothing for paint/layout, so this has no performance impact of its own —
   it's what stops the icon from appearing before its delay is up. */
.elc-ai-lazy-hidden { display: none !important; }

#elc-ai-widget-container { position:fixed; bottom:115px; right:25px; z-index:99999; font-family:sans-serif; }
#elc-ai-chat-icon { width:60px; height:60px; background:#0073aa; color:#fff; border-radius:50%; display:flex; align-items:center; justify-content:center; cursor:pointer; box-shadow:0 4px 12px rgba(0,0,0,0.2); }
#elc-ai-chat-box { position:absolute; bottom:75px; right:0; width:360px; height:520px; background:#fff; border-radius:12px; box-shadow:0 8px 24px rgba(0,0,0,0.15); display:flex; flex-direction:column; overflow:hidden; }
#elc-ai-header {
    background: linear-gradient(135deg, #0073aa, #005f8a);
    color: #fff;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 2px 6px rgba(0,0,0,0.12);
}
#elc-ai-header-agent { display: flex; align-items: center; gap: 7px; min-width: 0; }
#elc-ai-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: block;
    flex-shrink: 0;
    object-fit: cover;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
    animation: elc-avatar-bob 2.6s ease-in-out infinite; /* keyframes defined once in chat-style.css, loaded first */
}
#elc-ai-title {
    font-weight: 700;
    font-size: 13.5px;
    line-height: 1;
    letter-spacing: 0.1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#elc-ai-header-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ecc71;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.25);
}
#elc-ai-header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
#elc-ai-lang-select {
    font-size: 12px;
    padding: 3px 4px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.12);
    color: #fff;
}
#elc-ai-lang-select option { color: #1f2d3d; }
#elc-ai-close-btn { background:none; border:none; color:#fff; font-size:20px; cursor:pointer; }
#elc-ai-reset-btn { background:none; border:none; color:#fff; font-size:16px; cursor:pointer; opacity:0.85; padding:0 4px; }
#elc-ai-reset-btn:hover { opacity:1; }
#elc-ai-quick-actions { display:flex; gap:5px; padding:8px; background:#f8f9fa; flex-wrap:wrap; align-items:center; }
#elc-ai-more-actions { display:none; gap:5px; padding:0 8px 8px 8px; background:#f8f9fa; flex-wrap:wrap; }
.elc-quick-btn { font-size:11px; background:#fff; border:1px solid #ccc; padding:4px 8px; border-radius:4px; cursor:pointer; }
.elc-quick-btn:hover { background:#f1f1f1; }
#elc-ai-menu-toggle { font-size:11px; background:#0073aa; color:#fff; border:none; padding:4px 10px; border-radius:4px; cursor:pointer; }
#elc-ai-messages { flex:1; padding:12px; overflow-y:auto; background:#fdfdfd; display:flex; flex-direction:column; }
.elc-msg { padding:8px 12px; border-radius:8px; max-width:85%; margin-bottom:8px; line-height:1.4; }
.bot-msg { background:#e2e8f0; align-self:flex-start; }
.user-msg { background:#0073aa; color:#fff; align-self:flex-end; }
.elc-suggestions { display:flex; flex-wrap:wrap; gap:5px; margin:-4px 0 8px 0; align-self:flex-start; max-width:90%; }
.tts-btn { background:none; border:none; cursor:pointer; font-size:12px; color:#0073aa; display:block; margin-top:4px; }
#elc-ai-upload-box { padding:10px; background:#fff3cd; display:none; }
#elc-ai-input-area { display:flex; padding:10px; border-top:1px solid #eee; align-items:center; }
#elc-ai-user-input { flex:1; padding:8px; border:1px solid #ccc; border-radius:4px; font-size:16px; } /* 16px prevents iOS auto-zoom on focus */
#elc-ai-mic-btn { background:#fff; color:#0073aa; border:1px solid #ccc; border-radius:50%; width:38px; height:38px; min-width:38px; margin-left:5px; cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:16px; }
#elc-ai-mic-btn:hover { background:#f1f1f1; }
#elc-ai-mic-btn.listening { background:#e53935; color:#fff; border-color:#e53935; animation:elc-pulse 1s infinite; }
@keyframes elc-pulse { 0%{ box-shadow:0 0 0 0 rgba(229,57,53,0.5); } 100%{ box-shadow:0 0 0 8px rgba(229,57,53,0); } }
#elc-ai-send-btn { background:#0073aa; color:#fff; border:none; padding:0 14px; height:38px; border-radius:4px; margin-left:5px; cursor:pointer; flex-shrink:0; }
.elc-mic-status { font-size:11px; color:#e53935; padding:0 8px 6px 8px; display:none; }

/* Input debounce (server-load protection): the box and buttons are disabled from
   the moment a message is sent until the reply has finished rendering. */
#elc-ai-user-input:disabled { background:#f3f4f6; color:#9aa1ab; cursor:not-allowed; }
#elc-ai-send-btn:disabled, #elc-ai-mic-btn:disabled { opacity:0.5; cursor:not-allowed; }

/* WhatsApp technical-expert handoff button. */
.elc-handoff-wrap { align-self:flex-start; max-width:90%; margin:-4px 0 8px 0; }
.elc-handoff-btn {
    display:inline-flex;
    align-items:center;
    gap:6px;
    background:linear-gradient(135deg, #25D366, #128C7E);
    color:#fff;
    text-decoration:none;
    font-size:12.5px;
    font-weight:600;
    padding:9px 14px;
    border-radius:999px;
    box-shadow:0 3px 10px rgba(18,140,126,0.35);
    transition:transform 0.15s ease, box-shadow 0.15s ease;
}
.elc-handoff-btn:hover { transform:translateY(-1px); box-shadow:0 5px 14px rgba(18,140,126,0.45); color:#fff; }
.elc-handoff-btn:active { transform:translateY(0); }

/* Product listing cards (search results and smart alternatives). */
.elc-product-card { display:flex; align-items:flex-start; gap:8px; background:#fff; border:1px solid #e2e8f0; border-radius:8px; padding:8px; margin-bottom:8px; }
.elc-product-thumb { width:48px; height:48px; object-fit:cover; border-radius:6px; flex-shrink:0; background:#f1f1f1; }
.elc-product-info { font-size:12.5px; line-height:1.5; }
.elc-product-info a { color:#0073aa; }

/* Reply feedback (thumbs up/down). */
.elc-feedback-row { display:flex; align-items:center; gap:6px; align-self:flex-start; margin:-4px 0 10px 4px; }
.elc-feedback-btn { background:none; border:none; cursor:pointer; font-size:14px; opacity:0.55; padding:2px 4px; border-radius:4px; }
.elc-feedback-btn:hover { opacity:1; background:#eef1f4; }
.elc-feedback-btn:disabled { cursor:default; }
.elc-feedback-btn.elc-feedback-selected { opacity:1; background:#e2e8f0; }
.elc-feedback-thanks { font-size:11px; color:#667085; display:none; }

/* --- Mobile layout: fluid width/height instead of a fixed 360x520 box --- */
@media (max-width: 480px) {
    #elc-ai-widget-container { bottom:104px; right:14px; }
    #elc-ai-chat-icon { width:52px; height:52px; }
    #elc-ai-chat-box {
        position:fixed;
        left:10px; right:10px; bottom:78px;
        width:auto;
        height:min(75vh, 520px);
        max-height:calc(100vh - 100px);
    }
    #elc-ai-messages { -webkit-overflow-scrolling:touch; }
    .elc-msg { max-width:92%; }
    #elc-ai-quick-actions, #elc-ai-more-actions { padding:6px; }
    .elc-quick-btn { font-size:12px; padding:6px 9px; }
    #elc-ai-input-area { padding:8px; }
}
