/* Msaidizi wa AI (Gemini) — kitufe juu ya WhatsApp + dirisha la mazungumzo */
.ai-fab {
    position: fixed;
    right: 30px;
    bottom: 104px;
    width: 60px;
    height: 60px;
    border: 0;
    border-radius: 50%;
    background: #111;
    color: #F2B705;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    z-index: 10000;
    transition: transform 0.25s ease;
}

.ai-fab:hover { transform: scale(1.08); }

.ai-panel {
    position: fixed;
    right: 30px;
    bottom: 176px;
    width: min(440px, calc(100vw - 32px));
    height: min(600px, calc(100dvh - 210px));
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.98);
    transition: opacity 0.2s ease, transform 0.25s ease, visibility 0.2s;
}

.ai-panel.open { opacity: 1; visibility: visible; transform: none; }

.ai-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: #111;
    color: #fff;
}

.ai-head strong { display: block; font-size: 15px; }
.ai-head small { color: #F2B705; font-size: 12px; }
.ai-brand { display: flex; align-items: center; gap: 11px; }
.ai-brand-logo { width: 42px; height: 42px; padding: 5px; border-radius: 14px; object-fit: contain; background: #fff; }
.ai-close { border: 0; background: transparent; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }

.ai-log {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f5f5f7;
}

.ai-msg {
    max-width: 86%;
    padding: 10px 13px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ai-msg.bot { align-self: flex-start; background: #fff; color: #111; border-bottom-left-radius: 4px; }
.ai-msg.me { align-self: flex-end; background: #111; color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.typing { opacity: 0.6; font-style: italic; }
.ai-msg.typing::after {
    display: inline-block;
    width: 18px;
    margin-left: 8px;
    color: #b38300;
    content: "•••";
    letter-spacing: 2px;
    animation: aiTyping 1s ease-in-out infinite;
}

@keyframes aiTyping {
    0%, 100% { opacity: .35; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-2px); }
}

.ai-download {
    display: inline-flex;
    margin-top: 9px;
    padding: 7px 11px;
    border-radius: 999px;
    background: #fbf3dd;
    color: #725600;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.ai-download:hover { background: #f4e4b7; }

.ai-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid rgba(0, 0, 0, 0.08); background: #fff; }

.ai-form input {
    flex: 1;
    min-width: 0;
    height: 42px;
    padding: 0 14px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 999px;
    font-size: 14px;
    outline: none;
}

.ai-form input:focus { border-color: #F2B705; }

.ai-form button {
    height: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: #F2B705;
    color: #111;
    font-weight: 700;
    cursor: pointer;
}

.ai-form button:disabled { opacity: 0.5; cursor: wait; }

.ai-contact-area { padding: 0 10px 10px; background: #fff; }

.ai-contact-toggle {
    display: block;
    margin: 0 auto;
    padding: 3px 8px;
    border: 0;
    background: transparent;
    color: #555;
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
}

.ai-contact-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    padding-top: 9px;
}

.ai-contact-form[hidden] { display: none; }

.ai-contact-form input,
.ai-contact-form textarea {
    width: 100%;
    min-width: 0;
    padding: 9px 11px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    font: inherit;
    font-size: 13px;
    outline: none;
}

.ai-contact-form input:focus,
.ai-contact-form textarea:focus { border-color: #F2B705; }

.ai-contact-form textarea { grid-column: 1 / -1; resize: vertical; }

.ai-contact-form button {
    grid-column: 1 / -1;
    min-height: 38px;
    border: 0;
    border-radius: 999px;
    background: #F2B705;
    color: #111;
    font-weight: 700;
    cursor: pointer;
}

.ai-contact-form button:disabled { opacity: 0.5; cursor: wait; }

@media (max-width: 520px) {
    .ai-fab { right: 16px; bottom: 90px; width: 52px; height: 52px; }
    .ai-panel { right: 16px; bottom: 152px; height: min(540px, calc(100dvh - 180px)); }
}
