/* ============================================================
   TXIKI — Chatbot widget Nive Adour
   ============================================================ */

.na-txiki {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    font-family: 'Manrope', sans-serif;
    --txiki-gold: #C9A84C;
    --txiki-black: #1A1A1A;
    --txiki-cream: #FBF9F6;
}

/* ============================================================
   BOUTON FLOTTANT
   ============================================================ */
.na-txiki-toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px 14px 18px;
    background: var(--txiki-black);
    color: var(--txiki-cream);
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    transition: all 0.3s ease;
    overflow: visible;
}
.na-txiki-toggle:hover {
    background: var(--txiki-gold);
    color: var(--txiki-black);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(201,168,76,0.4);
}
.na-txiki-toggle .na-txiki-icon-close { display: none; }
.na-txiki.is-open .na-txiki-toggle .na-txiki-icon-open { display: none; }
.na-txiki.is-open .na-txiki-toggle .na-txiki-icon-close { display: inline-flex; align-items: center; }
.na-txiki-label { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 17px; font-weight: 500; }

.na-txiki-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--txiki-gold);
    color: var(--txiki-black);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.na-txiki.is-open .na-txiki-badge { display: none; }

.na-txiki-toggle.is-pulsing {
    animation: txikiPulse 1.5s ease-in-out 0s 2;
}
@keyframes txikiPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); box-shadow: 0 12px 32px rgba(201,168,76,0.5); }
}

/* ============================================================
   FENÊTRE CONVERSATION
   ============================================================ */
.na-txiki-window {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: var(--txiki-cream);
    border-radius: 16px;
    box-shadow: 0 24px 56px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    pointer-events: none;
    transition: all 0.32s cubic-bezier(.4,0,.2,1);
}
.na-txiki.is-open .na-txiki-window {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.na-txiki-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: var(--txiki-black);
    color: var(--txiki-cream);
    position: relative;
}
.na-txiki-avatar {
    width: 42px;
    height: 42px;
    background: var(--txiki-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--txiki-black);
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 700;
    font-size: 22px;
    flex-shrink: 0;
}
.na-txiki-headinfo { flex: 1; min-width: 0; }
.na-txiki-headinfo h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 18px;
    margin: 0;
    color: var(--txiki-cream);
    font-weight: 600;
}
.na-txiki-headinfo p {
    margin: 2px 0 0;
    font-size: 11px;
    color: rgba(251,249,246,0.7);
    letter-spacing: 0.02em;
}
.na-txiki-online {
    color: #4ADE80;
    font-weight: 600;
}
.na-txiki-online::before {
    content: '●';
    margin-right: 4px;
    animation: txikiBlink 2.4s ease-in-out infinite;
}
@keyframes txikiBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.na-txiki-close-btn {
    background: none;
    border: 0;
    color: rgba(251,249,246,0.7);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
}
.na-txiki-close-btn:hover { color: var(--txiki-cream); background: rgba(251,249,246,0.1); }

/* Messages */
.na-txiki-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--txiki-cream);
}
.na-txiki-messages::-webkit-scrollbar { width: 6px; }
.na-txiki-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }

.na-txiki-msg {
    max-width: 82%;
    padding: 11px 15px;
    font-size: 14px;
    line-height: 1.55;
    border-radius: 18px;
    word-wrap: break-word;
    animation: txikiMsgIn 0.32s cubic-bezier(.2,.6,.2,1);
}
@keyframes txikiMsgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.na-txiki-msg-bot {
    background: white;
    color: var(--txiki-black);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.na-txiki-msg-bot a {
    color: var(--txiki-gold);
    font-weight: 600;
    text-decoration: underline;
}
.na-txiki-msg-bot a:hover { color: var(--txiki-black); }

.na-txiki-msg-user {
    background: var(--txiki-black);
    color: var(--txiki-cream);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.na-txiki-typing {
    display: inline-flex;
    gap: 4px;
    padding: 14px 16px;
}
.na-txiki-typing span {
    width: 7px;
    height: 7px;
    background: rgba(26,26,26,0.4);
    border-radius: 50%;
    animation: txikiBounce 1.2s ease-in-out infinite;
}
.na-txiki-typing span:nth-child(2) { animation-delay: 0.15s; }
.na-txiki-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes txikiBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Escalation form (dans bulle bot) */
.na-txiki-escalation {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.na-txiki-escalation input {
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    transition: border-color 0.2s;
}
.na-txiki-escalation input:focus {
    outline: none;
    border-color: var(--txiki-gold);
}
.na-txiki-esc-btn {
    padding: 10px 14px;
    background: var(--txiki-gold);
    color: var(--txiki-black);
    border: 0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.na-txiki-esc-btn:hover { background: #B69536; }
.na-txiki-escalation small {
    color: rgba(0,0,0,0.55);
    font-size: 11px;
    text-align: center;
    margin-top: 4px;
}
.na-txiki-escalation small a { color: var(--txiki-gold); font-weight: 600; }

/* Suggestions chips */
.na-txiki-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 18px 14px;
    background: var(--txiki-cream);
}
.na-txiki-suggestions:empty { padding-top: 0; padding-bottom: 0; }
.na-txiki-sugg {
    background: white;
    border: 1px solid #E8E4DC;
    color: var(--txiki-black);
    padding: 8px 14px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.na-txiki-sugg:hover {
    background: var(--txiki-gold);
    border-color: var(--txiki-gold);
    color: var(--txiki-black);
    transform: translateY(-1px);
}

/* Input form */
.na-txiki-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: white;
    border-top: 1px solid #E8E4DC;
}
.na-txiki-form input {
    flex: 1;
    padding: 10px 14px;
    border: 0;
    background: var(--txiki-cream);
    border-radius: 999px;
    font-family: inherit;
    font-size: 14px;
    color: var(--txiki-black);
}
.na-txiki-form input:focus { outline: 2px solid var(--txiki-gold); outline-offset: 0; }
.na-txiki-form button {
    width: 38px;
    height: 38px;
    background: var(--txiki-black);
    color: var(--txiki-cream);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.na-txiki-form button:hover { background: var(--txiki-gold); color: var(--txiki-black); transform: scale(1.06); }

/* Footer */
.na-txiki-footer {
    padding: 8px 14px;
    text-align: center;
    background: white;
    border-top: 1px solid #F5F3EE;
}
.na-txiki-footer small { color: rgba(0,0,0,0.4); font-size: 10px; letter-spacing: 0.03em; }
.na-txiki-footer a { color: var(--txiki-gold); font-weight: 600; }

/* Mobile responsive */
@media (max-width: 560px) {
    .na-txiki {
        bottom: 14px;
        right: 14px;
    }
    .na-txiki-window {
        width: calc(100vw - 28px);
        height: calc(100vh - 110px);
        max-height: 560px;
        bottom: 70px;
        right: 0;
        border-radius: 14px;
    }
    .na-txiki-toggle { padding: 12px 18px 12px 16px; }
    .na-txiki-label { font-size: 15px; }
}
