/* =========================================================
   VELORA AI CHAT ASSISTANT
   static/css/chat.css
   ========================================================= */

.velora-chat {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    font-family: inherit;
}

/* =========================================================
   FLOATING BUTTON
   ========================================================= */

.velora-chat-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 150px;
    padding: 11px 16px 11px 11px;
    border: 0;
    border-radius: 999px;
    background: #111827;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.20);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.velora-chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.25);
}

.velora-chat-toggle:active {
    transform: translateY(0);
}

.velora-chat-toggle:focus-visible,
.velora-chat-close:focus-visible,
.velora-chat-send:focus-visible,
.velora-chat-suggestion:focus-visible {
    outline: 3px solid rgba(17, 24, 39, 0.25);
    outline-offset: 3px;
}

/* AI icon */

.velora-chat-ai-icon,
.velora-chat-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: #ffffff;
    color: #111827;
    font-weight: 800;
}

.velora-chat-ai-icon {
    width: 38px;
    height: 38px;
    font-size: 16px;
}

.velora-chat-toggle-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
}

.velora-chat-toggle-text strong {
    font-size: 14px;
    font-weight: 700;
}

.velora-chat-toggle-text small {
    margin-top: 3px;
    font-size: 11px;
    opacity: 0.7;
}

/* =========================================================
   CHAT PANEL
   ========================================================= */

.velora-chat-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 390px;
    height: min(650px, calc(100vh - 48px));

    display: flex;
    flex-direction: column;

    overflow: hidden;
    border: 1px solid rgba(17, 24, 39, 0.10);
    border-radius: 22px;
    background: #ffffff;

    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.20),
        0 5px 20px rgba(0, 0, 0, 0.08);

    animation: veloraChatOpen 0.2s ease-out;
}

/*
   VERY IMPORTANT:
   hidden attribute must always hide the panel.
   This prevents other CSS files from forcing it open.
*/

.velora-chat-panel[hidden] {
    display: none !important;
}

@keyframes veloraChatOpen {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =========================================================
   HEADER
   ========================================================= */

.velora-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    min-height: 70px;
    padding: 14px 16px;

    background: #111827;
    color: #ffffff;
}

.velora-chat-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.velora-chat-brand > div:last-child {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.velora-chat-avatar {
    width: 42px;
    height: 42px;
    font-size: 17px;
}

.velora-chat-avatar.small {
    width: 30px;
    height: 30px;
    font-size: 12px;
}

.velora-chat-brand strong {
    font-size: 15px;
    font-weight: 750;
}

.velora-chat-status {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    font-size: 11px;
    opacity: 0.75;
}

.velora-chat-status i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
}

.velora-chat-close {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 36px;
    height: 36px;
    padding: 0;

    border: 0;
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;

    font-size: 25px;
    line-height: 1;

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.velora-chat-close:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: rotate(4deg);
}

/* =========================================================
   MESSAGE AREA
   ========================================================= */

.velora-chat-messages {
    flex: 1;
    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    padding: 18px 15px;

    background: #f8fafc;

    scroll-behavior: smooth;
}

.velora-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.velora-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.velora-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(17, 24, 39, 0.18);
    border-radius: 20px;
}

/* =========================================================
   MESSAGE ROW
   ========================================================= */

.velora-chat-message-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 14px;
}

.velora-chat-message-row.user {
    justify-content: flex-end;
}

/* =========================================================
   BUBBLES
   ========================================================= */

.velora-chat-bubble {
    max-width: 82%;
    padding: 11px 13px;

    border-radius: 16px;

    font-size: 13px;
    line-height: 1.55;

    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.velora-chat-bubble.bot {
    border-top-left-radius: 5px;
    background: #ffffff;
    color: #1f2937;

    border: 1px solid rgba(17, 24, 39, 0.07);

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.velora-chat-bubble.user {
    border-top-right-radius: 5px;
    background: #111827;
    color: #ffffff;
}

.velora-chat-bubble strong {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
}

.velora-chat-bubble p {
    margin: 7px 0;
}

.velora-chat-bubble p:last-child {
    margin-bottom: 0;
}

/* =========================================================
   SUGGESTIONS
   ========================================================= */

.velora-chat-suggestions {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 10px;
}

.velora-chat-suggestion {
    width: 100%;
    padding: 9px 10px;

    border: 1px solid rgba(17, 24, 39, 0.10);
    border-radius: 10px;

    background: #ffffff;
    color: #1f2937;

    text-align: left;
    font: inherit;
    font-size: 12px;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.velora-chat-suggestion:hover {
    background: #f1f5f9;
    border-color: rgba(17, 24, 39, 0.20);
    transform: translateX(2px);
}

/* =========================================================
   RESULT CARDS
   ========================================================= */

.velora-chat-results {
    display: flex;
    flex-direction: column;
    gap: 8px;

    width: calc(100% - 38px);
    margin: 0 0 14px 38px;
}

.velora-chat-card {
    display: block;

    padding: 11px 12px;

    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: 12px;

    background: #ffffff;
    color: inherit;

    text-decoration: none;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.velora-chat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.velora-chat-card-title {
    display: block;

    margin-bottom: 4px;

    color: #111827;
    font-size: 13px;
    font-weight: 700;
}

.velora-chat-card-meta {
    display: block;

    color: #64748b;
    font-size: 11px;
}

/* =========================================================
   TYPING INDICATOR
   ========================================================= */

.velora-chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;

    width: fit-content;
    margin: 0 15px 8px 47px;
    padding: 9px 12px;

    border-radius: 14px;
    background: #ffffff;
    border: 1px solid rgba(17, 24, 39, 0.07);
}

.velora-chat-typing[hidden] {
    display: none !important;
}

.velora-chat-typing span {
    width: 5px;
    height: 5px;

    border-radius: 50%;
    background: #64748b;

    animation: veloraTyping 1.2s infinite ease-in-out;
}

.velora-chat-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.velora-chat-typing span:nth-child(3) {
    animation-delay: 0.30s;
}

@keyframes veloraTyping {
    0%,
    60%,
    100% {
        opacity: 0.3;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

/* =========================================================
   INPUT AREA
   ========================================================= */

.velora-chat-form {
    padding: 12px 13px 11px;

    background: #ffffff;
    border-top: 1px solid rgba(17, 24, 39, 0.08);
}

.velora-chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;

    padding: 5px 5px 5px 13px;

    border: 1px solid rgba(17, 24, 39, 0.13);
    border-radius: 15px;

    background: #f8fafc;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.velora-chat-input-wrapper:focus-within {
    border-color: rgba(17, 24, 39, 0.35);
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.05);
}

.velora-chat-input-wrapper input {
    flex: 1;
    min-width: 0;

    border: 0;
    outline: 0;

    background: transparent;
    color: #111827;

    font: inherit;
    font-size: 13px;
}

.velora-chat-input-wrapper input::placeholder {
    color: #94a3b8;
}

.velora-chat-send {
    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    width: 38px;
    height: 38px;

    border: 0;
    border-radius: 11px;

    background: #111827;
    color: #ffffff;

    cursor: pointer;

    font-size: 16px;

    transition:
        transform 0.2s ease,
        background 0.2s ease;
}

.velora-chat-send:hover {
    transform: translateY(-1px);
    background: #1f2937;
}

.velora-chat-send:active {
    transform: translateY(0);
}

.velora-chat-disclaimer {
    display: block;

    margin-top: 7px;

    color: #94a3b8;
    font-size: 9px;
    text-align: center;
}

/* =========================================================
   INLINE LINKS
   ========================================================= */

.velora-chat-inline-link {
    color: #2563eb;
    font-weight: 700;
    text-decoration: underline;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

    .velora-chat {
        right: 12px;
        bottom: 12px;
        left: 12px;
    }

    .velora-chat-toggle {
        margin-left: auto;
    }

    .velora-chat-panel {
        right: 0;
        bottom: 0;

        width: min(100%, 390px);
        height: min(680px, calc(100vh - 24px));

        border-radius: 20px;
    }
}

@media (max-width: 420px) {

    .velora-chat {
        right: 8px;
        bottom: 8px;
        left: 8px;
    }

    .velora-chat-toggle {
        min-width: auto;
        padding-right: 12px;
    }

    .velora-chat-toggle-text small {
        display: none;
    }

    .velora-chat-panel {
        width: 100%;
        height: calc(100vh - 16px);
        border-radius: 18px;
    }

    .velora-chat-bubble {
        max-width: 86%;
    }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .velora-chat-panel,
    .velora-chat-toggle,
    .velora-chat-close,
    .velora-chat-send,
    .velora-chat-suggestion,
    .velora-chat-card {
        animation: none;
        transition: none;
    }

}


/* VELORA mobile assistant launcher: compact, non-blocking icon */
@media (max-width:600px) { .velora-chat { right:12px; bottom:max(12px,env(safe-area-inset-bottom)); left:auto; width:auto; z-index:1000; pointer-events:none; } .velora-chat-toggle,.velora-chat-panel { pointer-events:auto; } .velora-chat-toggle { width:48px; height:48px; min-width:48px; padding:0; border-radius:50%; justify-content:center; } .velora-chat-toggle-text { display:none !important; } .velora-chat-panel { left:auto; right:0; width:min(390px,calc(100vw - 24px)); height:min(680px,calc(100dvh - 96px - env(safe-area-inset-bottom))); max-height:calc(100dvh - 96px - env(safe-area-inset-bottom)); } }
@media (max-width:420px) { .velora-chat { right:10px; bottom:max(10px,env(safe-area-inset-bottom)); } .velora-chat-toggle { width:44px; height:44px; min-width:44px; } .velora-chat-panel { width:calc(100vw - 20px); height:min(680px,calc(100dvh - 84px - env(safe-area-inset-bottom))); max-height:calc(100dvh - 84px - env(safe-area-inset-bottom)); } }
