/* ========================================
   Healthcare Chatbot Pro — Frontend Styles
   ======================================== */

#hc-bot-container {
    position: fixed !important;
    bottom: 20px !important;
    z-index: 999999 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

#hc-bot-container.hc-pos-right { right: 20px !important; left: auto !important; }
#hc-bot-container.hc-pos-left  { left:  20px !important; right: auto !important; }

/* ---------- Greeting Bubble ---------- */
#hc-greeting-bubble {
    position: absolute;
    bottom: 80px;
    background: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    font-size: 14px;
    color: #333;
    width: 220px;
    line-height: 1.4;
    z-index: 1000000;
    cursor: pointer;
    animation: hcBubbleIn 0.3s ease-out;
}
#hc-bot-container.hc-pos-right #hc-greeting-bubble { right: 0; }
#hc-bot-container.hc-pos-left  #hc-greeting-bubble { left: 0; }

#hc-greeting-bubble .hc-arrow {
    position: absolute;
    bottom: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #fff;
}
#hc-bot-container.hc-pos-right #hc-greeting-bubble .hc-arrow { right: 25px; }
#hc-bot-container.hc-pos-left  #hc-greeting-bubble .hc-arrow { left: 25px; }

@keyframes hcBubbleIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

/* ---------- Launcher ---------- */
#hc-bot-launcher {
    width: 60px !important;
    height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    transition: transform 0.3s !important;
}
#hc-bot-launcher:hover { transform: scale(1.1) !important; }

#hc-bot-launcher.hc-style-circle { border-radius: 50% !important; }
#hc-bot-launcher.hc-style-square { border-radius: 12px !important; }

/* ---------- Chat Window (relative anchor for absolute-positioned children) ---------- */
#hc-bot-window {
    display: none;
    width: 370px;
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
}
#hc-bot-window[style*="display: block"],
#hc-bot-window[style*="display:block"] { display: block !important; }

/* ---------- Header (absolute top) ---------- */
#hc-bot-header {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 68px;
    padding: 14px 16px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    z-index: 2;
}
.hc-header-info { display: flex; align-items: center; gap: 12px; }
.hc-header-avatar { width: 38px; height: 38px; border-radius: 50%; background: #fff; object-fit: cover; }
.hc-header-name { font-weight: 600; font-size: 15px; }
.hc-header-status { font-size: 11px; opacity: 0.9; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.hc-status-dot { width: 8px; height: 8px; background: #4caf50; border-radius: 50%; display: inline-block; }

#hc-bot-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
}
#hc-bot-close:hover { opacity: 1; }

/* ---------- Messages (ONLY scrollable region) ---------- */
#hc-bot-messages {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    bottom: 72px;
    overflow-y: auto !important;
    overflow-x: hidden;
    padding: 20px;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
}
#hc-bot-messages::-webkit-scrollbar { width: 6px; }
#hc-bot-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.hc-msg {
    padding: 10px 14px;
    border-radius: 18px;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}
.hc-msg.bot  { background: #eee; color: #333; align-self: flex-start; border-bottom-left-radius: 4px; }
.hc-msg.user { color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }

.hc-system-notice {
    text-align: center;
    font-size: 11px;
    color: #2271b1;
    background: #e6f2ff;
    padding: 8px;
    border-radius: 6px;
    font-weight: 600;
    margin: 4px 20%;
}

#hc-typing-indicator {
    display: none;
    align-self: flex-start;
    background: #eee;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}
#hc-typing-indicator span {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #999;
    border-radius: 50%;
    margin: 0 2px;
    animation: hcTyping 1.4s infinite ease-in-out;
}
#hc-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
#hc-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes hcTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ---------- Input Area (ABSOLUTE BOTTOM — LOCKED) ---------- */
#hc-bot-input-area {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 72px;
    padding: 12px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    background: #fff;
    box-sizing: border-box;
    z-index: 2;
}
#hc-bot-input {
    flex: 1;
    border: 1px solid #ddd;
    padding: 10px 15px;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
}
#hc-bot-input:focus { border-color: #2271b1; }
#hc-bot-send {
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    flex-shrink: 0;
}
#hc-bot-send:hover { opacity: 0.9; }

/* ---------- Forms (pinned, cover input area) ---------- */
#hc-prechat-form, #hc-lead-capture-form {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px;
    background: #fff;
    box-sizing: border-box;
    overflow-y: auto;
    z-index: 3;
}
#hc-prechat-form h3, #hc-lead-capture-form h3 { margin: 0 0 8px 0; color: #333; font-size: 17px; }
#hc-prechat-form p, #hc-lead-capture-form p { margin: 0 0 15px 0; font-size: 13px; color: #666; }

#hc-prechat-form input,
#hc-lead-capture-form input {
    width: 100%;
    margin-bottom: 10px;
    padding: 11px 13px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 14px;
}

#hc-btn-start, #hc-btn-submit-lead {
    width: 100%;
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
}
#hc-btn-start:hover, #hc-btn-submit-lead:hover { opacity: 0.9; }
#hc-btn-start:disabled, #hc-btn-submit-lead:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    #hc-bot-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 120px);
    }
}