/* =========================================================
   HEV AI WIDGET — INSTITUTIONAL FIXED POSITIONING
   Authority: Floating AI Associate Tool
   Logic: Isolated Layering (z-index 999999)
   Protects the widget from footer and layout interference
   ========================================================= */

#hev-ai-associate {
    position: fixed !important; /* Force stay in place */
    top: 110px;               /* Positioned below Header */
    right: 28px;
    z-index: 999999;          /* Absolute top layer */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;      /* Click through the empty space */
}

/* ENABLE INTERACTION ONLY FOR ELEMENTS INSIDE */
#hev-ai-associate * {
    pointer-events: auto;
    box-sizing: border-box;    /* Standardizes sizing */
}

/* =========================================================
   TRIGGER BUTTON
   ========================================================= */
#hev-ai-trigger {
    width: 72px;
    height: 72px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    margin: 0;
    transition: transform 0.3s ease;
    outline: none;
}

#hev-ai-trigger img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.35));
}

#hev-ai-trigger:hover {
    transform: scale(1.08);
}

/* =========================================================
   CHAT WINDOW - ISOLATED FROM SITE FOOTER
   ========================================================= */
#hev-ai-window {
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 560px;
    margin-top: 14px;
    display: none; /* Controlled by ai-widget.js */
    flex-direction: column;
    background: #ffffff !important; /* Forces white for clarity */
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0,0,0,0.4);
    border: 1px solid rgba(0,0,0,0.1);
}

/* =========================================================
   HEADER BRANDING
   ========================================================= */
.hev-ai-header {
    /* Uses Brain Variables or Falls back to Deep Navy */
    background: var(--hev-navy-deep, #071a2c) !important; 
    color: var(--hev-green-bright, #4ade80) !important;
    padding: 16px 20px;
    font-weight: 700;
    font-size: 0.90rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

#hev-ai-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

/* =========================================================
   CHAT AREA & MESSAGES
   ========================================================= */
#hev-ai-chat {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #f4f7fa !important;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hev-ai-message {
    background: #ffffff;
    color: #1f2937;
    padding: 12px 16px;
    border-radius: 14px 14px 14px 0;
    max-width: 85%;
    font-size: 0.92rem;
    line-height: 1.5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.hev-user-msg {
    background: var(--hev-navy-deep, #071a2c);
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 14px 14px 0 14px;
    max-width: 85%;
    align-self: flex-end;
    font-size: 0.92rem;
    line-height: 1.5;
}

/* =========================================================
   INPUT FIELD AREA
   ========================================================= */
.hev-ai-input-wrap {
    display: flex;
    gap: 10px;
    padding: 16px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
}

#hev-ai-input {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    outline: none;
    font-size: 0.95rem;
}

#hev-ai-input:focus {
    border-color: #16a34a;
}

#hev-ai-send {
    padding: 12px 18px;
    border: none;
    border-radius: 10px;
    background: #16a34a; /* Institutional Green */
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

#hev-ai-send:hover {
    background: #15803d;
}

/* =========================================================
   MOBILE RESPONSIVENESS
   ========================================================= */
@media(max-width: 768px) {
    #hev-ai-associate {
        top: 85px;
        right: 15px;
    }
    #hev-ai-trigger {
        width: 62px;
        height: 62px;
    }
    #hev-ai-window {
        width: calc(100vw - 30px);
        height: 65vh; 
    }
}