/* ===== Mini AI Chat — flat minimal ===== */
.ai-chat-root {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 12000;
    font-family: 'Montserrat', sans-serif;
}

.ai-chat-toggle {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: #0099cc;
    color: #fff;
    font-size: 1.35rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.ai-chat-toggle:hover {
    background: #0077aa;
}

.ai-chat-toggle.is-open {
    background: #003344;
}

.ai-chat-panel {
    position: absolute;
    right: 0;
    bottom: 70px;
    width: min(360px, calc(100vw - 24px));
    height: min(520px, calc(100vh - 120px));
    background: #fff;
    border: 1px solid #e6eef2;
    border-radius: 10px;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.ai-chat-panel.is-open {
    display: flex;
}

.ai-chat-header {
    background: #003344;
    color: #fff;
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.ai-chat-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
}

.ai-chat-header p {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    opacity: 0.8;
    font-weight: 500;
}

.ai-chat-close {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.9rem;
    background: #f5f9fb;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ai-msg {
    max-width: 90%;
    padding: 0.7rem 0.85rem;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-msg--bot {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e6eef2;
    color: #003344;
}

.ai-msg--user {
    align-self: flex-end;
    background: #0099cc;
    color: #fff;
}

.ai-msg--error {
    align-self: stretch;
    background: #fff5f5;
    border: 1px solid #fecaca;
    color: #991b1b;
    max-width: 100%;
}

.ai-msg--typing {
    opacity: 0.7;
    font-style: italic;
}

.ai-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 0.9rem 0.65rem;
    background: #f5f9fb;
}

.ai-chip {
    border: 1px solid #c5d8e0;
    background: #fff;
    color: #003344;
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.ai-chip:hover {
    border-color: #0099cc;
    color: #0099cc;
}

.ai-chat-form {
    display: flex;
    gap: 0.45rem;
    padding: 0.75rem;
    border-top: 1px solid #e6eef2;
    background: #fff;
}

.ai-chat-form textarea {
    flex: 1;
    resize: none;
    min-height: 42px;
    max-height: 90px;
    border: 1px solid #e6eef2;
    border-radius: 6px;
    padding: 0.6rem 0.7rem;
    font: inherit;
    font-size: 0.875rem;
    color: #003344;
    outline: none;
}

.ai-chat-form textarea:focus {
    border-color: #0099cc;
}

.ai-chat-send {
    border: none;
    border-radius: 6px;
    background: #0099cc;
    color: #fff;
    width: 42px;
    min-width: 42px;
    cursor: pointer;
    font-size: 1rem;
}

.ai-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-chat-send:hover:not(:disabled) {
    background: #0077aa;
}

@media (max-width: 480px) {
    .ai-chat-root {
        right: 12px;
        bottom: 12px;
    }

    .ai-chat-panel {
        width: calc(100vw - 24px);
        height: min(70vh, 560px);
        bottom: 66px;
    }

    .ai-chat-toggle {
        width: 52px;
        height: 52px;
    }
}

/* Keep back-to-top clear of chat FAB */
.back-to-top {
    right: 20px !important;
    bottom: 90px !important;
}

@media (max-width: 480px) {
    .back-to-top {
        right: 12px !important;
        bottom: 80px !important;
    }
}
