/* Zarosis AI Chatbot - frontend styles */
.zaic-root {
    --zaic-primary: #2271b1;
    --zaic-bg: #ffffff;
    --zaic-text: #1a1a1a;
    --zaic-muted: #6b7280;
    --zaic-border: #e5e7eb;
    --zaic-bot-bg: #f3f4f6;
    --zaic-chip-bg: #ffffff;
    --zaic-chip-border: #d4d8de;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--zaic-text);
    box-sizing: border-box;
}
.zaic-root *,
.zaic-root *::before,
.zaic-root *::after { box-sizing: border-box; }

/* Floating bubble */
.zaic-mode-floating .zaic-bubble {
    position: fixed;
    right: 20px;
    bottom: 80px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--zaic-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}
.zaic-mode-floating .zaic-bubble:hover { transform: scale(1.05); }

/* Window */
.zaic-window {
    background: var(--zaic-bg);
    border: 1px solid var(--zaic-border);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    display: none;
    flex-direction: column;
}
.zaic-mode-floating .zaic-window {
    position: fixed;
    right: 20px;
    bottom: 150px;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 180px);
    z-index: 999999;
}
.zaic-mode-inline .zaic-window {
    position: relative;
    width: 100%;
    max-width: 640px;
    height: 520px;
    margin: 1em auto;
    display: flex;
}
.zaic-root.zaic-open .zaic-window { display: flex; }

/* Header */
.zaic-header {
    background: var(--zaic-primary);
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
}
.zaic-title { font-size: 15px; }
.zaic-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

/* Messages */
.zaic-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #fafafa;
}
.zaic-msg {
    max-width: 90%;
    padding: 9px 12px;
    margin-bottom: 8px;
    border-radius: 12px;
    line-height: 1.45;
    font-size: 14px;
    word-wrap: break-word;
}
.zaic-msg-bot {
    background: var(--zaic-bot-bg);
    color: var(--zaic-text);
    border-bottom-left-radius: 4px;
    white-space: pre-wrap;
}
.zaic-msg-answer {
    background: var(--zaic-bot-bg);
    color: var(--zaic-text);
    border-bottom-left-radius: 4px;
    white-space: normal;
}
.zaic-msg-answer p:first-child { margin-top: 0; }
.zaic-msg-answer p:last-child  { margin-bottom: 0; }
.zaic-msg-answer a {
    color: var(--zaic-primary);
    text-decoration: underline;
    word-break: break-word;
}
.zaic-msg-user {
    background: var(--zaic-primary);
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}
.zaic-msg-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}
.zaic-msg-typing span {
    width: 6px;
    height: 6px;
    background: var(--zaic-muted);
    border-radius: 50%;
    animation: zaic-blink 1.2s infinite both;
}
.zaic-msg-typing span:nth-child(2) { animation-delay: 0.2s; }
.zaic-msg-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes zaic-blink {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}

/* Question chips */
.zaic-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 10px;
}
.zaic-chip {
    background: var(--zaic-chip-bg);
    color: var(--zaic-primary);
    border: 1px solid var(--zaic-chip-border);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 13px;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
    font-family: inherit;
    text-align: left;
}
.zaic-chip:hover {
    background: var(--zaic-primary);
    color: #fff;
    border-color: var(--zaic-primary);
}
.zaic-chip:focus-visible {
    outline: 2px solid var(--zaic-primary);
    outline-offset: 2px;
}

/* Form */
.zaic-form {
    display: flex;
    border-top: 1px solid var(--zaic-border);
    background: #fff;
    padding: 8px;
    gap: 6px;
}
.zaic-input {
    flex: 1;
    border: 1px solid var(--zaic-border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    outline: none;
    background: #fff;
    color: var(--zaic-text);
}
.zaic-input:focus { border-color: var(--zaic-primary); }
.zaic-send {
    background: var(--zaic-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.zaic-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* Mobile */
@media (max-width: 480px) {
    .zaic-mode-floating .zaic-window {
        right: 10px;
        left: 10px;
        bottom: 144px;
        width: auto;
        max-width: none;
    }
}
