/**
 * Hydrock AI Chatbot — QuikChat shell + Hydrock theme
 * QuikChat itself is BSD-2-Clause and is loaded by chatbot.js from the
 * official documented CDN build. Backend/plugin logic is not styled here.
 */

#hydrock-chatbot-root,
#hydrock-chatbot-root * {
    box-sizing: border-box;
}

#hydrock-chatbot-root {
    position: fixed !important;
    right: 24px !important;
    bottom: 24px !important;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    z-index: 2147483647 !important;
    isolation: isolate;
    color-scheme: light !important;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Launcher */
#hydrock-chatbot-root .hydrock-qc-launcher {
    position: relative !important;
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    min-height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: #0b93d5 !important;
    color: #fff !important;
    box-shadow: 0 14px 38px rgba(11, 34, 57, .26) !important;
    cursor: pointer !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease !important;
}

#hydrock-chatbot-root .hydrock-qc-launcher:hover {
    transform: translateY(-2px) !important;
    background: #078ac4 !important;
    box-shadow: 0 17px 42px rgba(11, 34, 57, .31) !important;
}

#hydrock-chatbot-root .hydrock-qc-launcher.is-open {
    transform: scale(.96) !important;
}

#hydrock-chatbot-root .hydrock-qc-launcher-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #fff;
}

/* Panel */
#hydrock-chatbot-root .hydrock-qc-panel {
    position: absolute !important;
    right: 0 !important;
    bottom: 76px !important;
    left: auto !important;
    top: auto !important;
    width: 420px !important;
    max-width: calc(100vw - 32px) !important;
    height: min(650px, calc(100vh - 118px)) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background: #fff !important;
    border: 1px solid #e4e9ee !important;
    border-radius: 22px !important;
    box-shadow: 0 28px 78px rgba(11, 34, 57, .20) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateY(12px) scale(.985) !important;
    transform-origin: bottom right !important;
    transition: opacity .2s ease, visibility .2s ease, transform .2s ease !important;
}

#hydrock-chatbot-root .hydrock-qc-panel.is-open {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: translateY(0) scale(1) !important;
}

/* Header */
#hydrock-chatbot-root .hydrock-qc-header {
    flex: 0 0 auto;
    min-height: 76px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: #fff !important;
    border-bottom: 1px solid #edf0f3;
}

#hydrock-chatbot-root .hydrock-qc-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 11px;
}

#hydrock-chatbot-root .hydrock-qc-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: #e9f6fc;
    color: #078ac4;
}

#hydrock-chatbot-root .hydrock-qc-brand-copy {
    min-width: 0;
}

#hydrock-chatbot-root .hydrock-qc-title {
    color: #172033 !important;
    font-size: 15px !important;
    line-height: 1.25 !important;
    font-weight: 750 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 245px;
}

#hydrock-chatbot-root .hydrock-qc-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    color: #778492 !important;
    font-size: 11.5px !important;
    line-height: 1 !important;
}

#hydrock-chatbot-root .hydrock-qc-status span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
}

#hydrock-chatbot-root .hydrock-qc-header-actions {
    display: flex;
    gap: 4px;
}

#hydrock-chatbot-root .hydrock-qc-icon-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: transparent !important;
    color: #667482 !important;
    box-shadow: none !important;
    cursor: pointer !important;
}

#hydrock-chatbot-root .hydrock-qc-icon-btn:hover {
    background: #f1f5f8 !important;
    color: #172033 !important;
}

/* Main chat area */
#hydrock-chatbot-root .hydrock-qc-main {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: #f5f7f9 !important;
}

#hydrock-chatbot-root .hydrock-qc-host {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .15s ease;
}

#hydrock-chatbot-root .hydrock-qc-host.is-ready {
    opacity: 1;
}

/* QuikChat layout overrides. The library's base UI remains in control. */
#hydrock-chatbot-root .hydrock-qc-host > * {
    height: 100% !important;
    max-height: 100% !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

#hydrock-chatbot-root .hydrock-qc-host .quikchat-title-area {
    display: none !important;
}

#hydrock-chatbot-root .hydrock-qc-host .quikchat-messages-area {
    background: #f5f7f9 !important;
    color: #172033 !important;
    padding: 18px 16px 102px !important;
    scrollbar-width: thin;
    scrollbar-color: #cbd5dd transparent;
}

#hydrock-chatbot-root .hydrock-qc-host .quikchat-message,
#hydrock-chatbot-root .hydrock-qc-host [class*="quikchat-message"] {
    font-family: inherit !important;
    font-size: 14px !important;
    line-height: 1.55 !important;
}

/* Message rows must remain transparent.
   The visible bubble background belongs ONLY to .quikchat-message-content. */
#hydrock-chatbot-root .hydrock-qc-host .quikchat-message,
#hydrock-chatbot-root .hydrock-qc-host .quikchat-role-assistant,
#hydrock-chatbot-root .hydrock-qc-host .quikchat-role-user,
#hydrock-chatbot-root .hydrock-qc-host .quikchat-align-left,
#hydrock-chatbot-root .hydrock-qc-host .quikchat-align-right {
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
}

/* Do not show QuikChat sender labels above each bubble.
   Header already identifies the assistant, so "Hydrock AI Assistant" / "You"
   are intentionally hidden inside the conversation. */
#hydrock-chatbot-root .hydrock-qc-host .quikchat-user-label {
    display: none !important;
}

/* Common single-bubble layout */
#hydrock-chatbot-root .hydrock-qc-host .quikchat-message {
    padding: 0 !important;
    margin: 0 0 15px !important;
}

#hydrock-chatbot-root .hydrock-qc-host .quikchat-message-content {
    display: block !important;
    width: max-content !important;
    max-width: 85% !important;
    box-shadow: none !important;
    border: 0 !important;
    white-space: pre-wrap !important;
    overflow-wrap: anywhere !important;
}

/* Hydrock Support-style AI message */
#hydrock-chatbot-root .hydrock-qc-host .quikchat-role-assistant .quikchat-message-content,
#hydrock-chatbot-root .hydrock-qc-host .quikchat-align-left.quikchat-role-assistant .quikchat-message-content {
    background: #ecf1f6 !important;
    color: #333333 !important;
    padding: 14px 16px !important;
    border-radius: 14px !important;
    margin-right: auto !important;
    margin-left: 0 !important;
    line-height: 1.6 !important;
    font-size: 14px !important;
    text-align: left !important;
}

/* Hydrock Support-style user message */
#hydrock-chatbot-root .hydrock-qc-host .quikchat-role-user .quikchat-message-content,
#hydrock-chatbot-root .hydrock-qc-host .quikchat-align-right.quikchat-role-user .quikchat-message-content {
    background: #0083c3 !important;
    color: #ffffff !important;
    padding: 12px 16px !important;
    border-radius: 14px !important;
    margin-left: auto !important;
    margin-right: 0 !important;
    line-height: 1.5 !important;
    font-size: 14px !important;
    text-align: right !important;
}

#hydrock-chatbot-root .hydrock-qc-host .quikchat-input-area {
    min-height: 74px !important;
    padding: 10px 12px !important;
    gap: 9px !important;
    background: #fff !important;
    border-top: 1px solid #e5eaee !important;
}

#hydrock-chatbot-root .hydrock-qc-host .quikchat-input-area textarea,
#hydrock-chatbot-root .hydrock-qc-host .quikchat-input-area input {
    min-height: 50px !important;
    max-height: 105px !important;
    padding: 13px 14px !important;
    border: 1px solid #dfe5ea !important;
    border-radius: 14px !important;
    outline: none !important;
    box-shadow: none !important;
    background: #f1f4f6 !important;
    color: #172033 !important;
    font-family: inherit !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
}

#hydrock-chatbot-root .hydrock-qc-host .quikchat-input-area textarea:focus,
#hydrock-chatbot-root .hydrock-qc-host .quikchat-input-area input:focus {
    border-color: #9dd4ef !important;
    box-shadow: 0 0 0 3px rgba(11,147,213,.08) !important;
}

#hydrock-chatbot-root .hydrock-qc-host .quikchat-input-send-btn {
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: #0b93d5 !important;
    color: #fff !important;
    font-size: 22px !important;
    line-height: 1 !important;
    box-shadow: none !important;
    cursor: pointer !important;
}

#hydrock-chatbot-root .hydrock-qc-host .quikchat-input-send-btn:hover {
    background: #078ac4 !important;
}

/* Quick actions — compact Hydrock Support-style pills above composer */
#hydrock-chatbot-root .hydrock-qc-quick-actions {
    position: absolute;
    z-index: 8;
    left: 0;
    right: 0;
    bottom: 73px;
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 9px 13px 10px;
    background: rgba(255,255,255,.97);
    border-top: 1px solid #e9edf0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

#hydrock-chatbot-root .hydrock-qc-quick-actions::-webkit-scrollbar {
    display: none;
}

#hydrock-chatbot-root .hydrock-qc-quick-actions.is-hidden {
    display: none;
}

#hydrock-chatbot-root .hydrock-qc-quick-actions button {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 36px !important;
    padding: 8px 13px !important;
    margin: 0 !important;
    border: 1px solid #d9e0e6 !important;
    border-radius: 999px !important;
    background: #fff !important;
    color: #273747 !important;
    font-family: inherit !important;
    font-size: 12px !important;
    line-height: 1.15 !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    box-shadow: none !important;
    cursor: pointer !important;
    transition: color .15s ease, border-color .15s ease, background .15s ease !important;
}

#hydrock-chatbot-root .hydrock-qc-quick-actions button:hover {
    color: #078ac4 !important;
    border-color: #9bd2ec !important;
    background: #f5fbfe !important;
}

/* Loading */
#hydrock-chatbot-root .hydrock-qc-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: #f5f7f9;
    color: #687786;
    font-size: 12px;
    z-index: 10;
}

#hydrock-chatbot-root .hydrock-qc-loading.is-hidden {
    display: none;
}

#hydrock-chatbot-root .hydrock-qc-loading span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #0b93d5;
    animation: hydrockQcPulse 1s infinite ease-in-out;
}

#hydrock-chatbot-root .hydrock-qc-loading span:nth-child(2) { animation-delay: .12s; }
#hydrock-chatbot-root .hydrock-qc-loading span:nth-child(3) { animation-delay: .24s; }
#hydrock-chatbot-root .hydrock-qc-loading strong { margin-left: 6px; font-weight: 600; }

#hydrock-chatbot-root .hydrock-qc-loading.is-error {
    flex-direction: column;
    text-align: center;
    padding: 32px;
    color: #8a2d2d;
}

#hydrock-chatbot-root .hydrock-qc-loading.is-error span {
    width: auto;
    height: auto;
    border-radius: 0;
    background: transparent;
    animation: none;
    color: #687786;
}

@keyframes hydrockQcPulse {
    0%, 60%, 100% { transform: translateY(0); opacity: .4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Footer */
#hydrock-chatbot-root .hydrock-qc-footer {
    flex: 0 0 auto;
    min-height: 27px;
    padding: 7px 12px 8px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    background: #fff;
    border-top: 1px solid #f0f2f4;
    color: #8a96a1;
    text-align: center;
    font-size: 9.5px;
    line-height: 1.2;
}

@media (max-width: 600px) {
    #hydrock-chatbot-root {
        right: 14px !important;
        bottom: 14px !important;
    }

    #hydrock-chatbot-root .hydrock-qc-launcher {
        width: 56px !important;
        height: 56px !important;
        min-width: 56px !important;
        min-height: 56px !important;
    }

    #hydrock-chatbot-root .hydrock-qc-panel {
        position: fixed !important;
        left: 10px !important;
        right: 10px !important;
        bottom: 80px !important;
        top: auto !important;
        width: auto !important;
        max-width: none !important;
        height: min(680px, calc(100dvh - 94px)) !important;
        border-radius: 20px !important;
        transform-origin: bottom center !important;
    }

    #hydrock-chatbot-root .hydrock-qc-title {
        max-width: 190px;
    }

    #hydrock-chatbot-root .hydrock-qc-host .quikchat-messages-area {
        padding-left: 12px !important;
        padding-right: 12px !important;
        padding-bottom: 104px !important;
    }

    #hydrock-chatbot-root .hydrock-qc-quick-actions {
        padding-left: 10px;
        padding-right: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #hydrock-chatbot-root *,
    #hydrock-chatbot-root *::before,
    #hydrock-chatbot-root *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}


/* v1.1.1: prevent QuikChat modern-theme defaults from creating any
   additional/secondary visual bubble layer. */
#hydrock-chatbot-root .hydrock-qc-host .quikchat-theme-modern .quikchat-message {
    background: transparent !important;
}

#hydrock-chatbot-root .hydrock-qc-host .quikchat-theme-modern .quikchat-user-label {
    display: none !important;
}

#hydrock-chatbot-root .hydrock-qc-host .quikchat-theme-modern .quikchat-align-left .quikchat-message-content {
    background: #ecf1f6 !important;
    color: #333333 !important;
    padding: 14px 16px !important;
    border-radius: 14px !important;
}

#hydrock-chatbot-root .hydrock-qc-host .quikchat-theme-modern .quikchat-align-right .quikchat-message-content {
    background: #0083c3 !important;
    color: #ffffff !important;
    padding: 12px 16px !important;
    border-radius: 14px !important;
}


/* v1.1.6 critical placement safety */
html body #hydrock-chatbot-root {
    position: fixed !important;
    right: 24px !important;
    bottom: 24px !important;
    left: auto !important;
    top: auto !important;
    z-index: 2147483647 !important;
}

html body #hydrock-chatbot-root .hydrock-qc-panel:not(.is-open) {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

html body #hydrock-chatbot-root .hydrock-qc-panel.is-open {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}
