/* ASSISTANT IA - floating chat widget */

.ai-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9990;
    background: var(--ink);
    color: var(--cream);
    border: none;
    padding: 12px 18px 12px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.12);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 999px;
    transition: transform .15s, background .15s, box-shadow .15s;
}
.ai-fab svg { width: 18px; height: 18px; flex-shrink: 0; }
.ai-fab:hover {
    background: var(--amber);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(217, 107, 39, 0.35), 0 3px 8px rgba(0, 0, 0, 0.15);
}
.ai-fab.open { background: var(--amber); }
.ai-fab-label { white-space: nowrap; }

@media (max-width: 600px) {
    .ai-fab { bottom: 16px; right: 16px; padding: 11px 14px 11px 11px; font-size: 12px; }
}

/* Panel */
.ai-panel {
    position: fixed;
    bottom: 88px;
    right: 24px;
    z-index: 9989;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border: 1px solid rgba(31, 29, 28, 0.12);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    animation: aiSlideUp .25s cubic-bezier(.2, .7, .3, 1);
}
@keyframes aiSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ai-panel[hidden] { display: none; }

@media (max-width: 600px) {
    .ai-panel {
        bottom: 78px;
        right: 16px;
        left: 16px;
        width: auto;
        height: 70vh;
    }
}

/* Header */
.ai-panel-head {
    background: var(--ink);
    color: var(--cream);
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.ai-panel-eyebrow {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--amber-light, #f08847);
    margin-bottom: 4px;
    font-weight: 700;
}
.ai-panel-title {
    font-family: 'Fraunces', serif;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.25;
}
.ai-panel-close {
    background: transparent;
    border: none;
    color: var(--cream);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    opacity: 0.65;
    transition: opacity .15s;
    flex-shrink: 0;
}
.ai-panel-close:hover { opacity: 1; }

/* Messages */
.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 18px 8px;
    background: var(--cream);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ai-msg {
    max-width: 85%;
    padding: 10px 14px;
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: aiMsgIn .2s ease-out;
}
@keyframes aiMsgIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.ai-msg-bot {
    background: #fff;
    color: var(--ink);
    border: 1px solid rgba(31, 29, 28, 0.08);
    align-self: flex-start;
    border-bottom-left-radius: 0;
    border-radius: 12px;
    border-bottom-left-radius: 2px;
}
.ai-msg-user {
    background: var(--amber);
    color: #fff;
    align-self: flex-end;
    border-radius: 12px;
    border-bottom-right-radius: 2px;
}
.ai-link {
    color: var(--amber);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.ai-msg-user .ai-link { color: #fff; }

/* Typing dots */
.ai-typing {
    display: inline-flex;
    gap: 4px;
    padding: 12px 14px;
}
.ai-typing span {
    width: 6px;
    height: 6px;
    background: var(--ink);
    opacity: 0.4;
    border-radius: 50%;
    animation: aiBlink 1.2s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiBlink {
    0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
    30%           { opacity: 1; transform: translateY(-3px); }
}

/* Form */
.ai-form {
    display: flex;
    gap: 6px;
    padding: 12px 14px 8px;
    background: #fff;
    border-top: 1px solid rgba(31, 29, 28, 0.08);
}
.ai-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid rgba(31, 29, 28, 0.15);
    background: #fff;
    color: var(--ink);
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    border-radius: 999px;
    outline: none;
    transition: border-color .15s;
}
.ai-input:focus { border-color: var(--amber); }
.ai-send {
    background: var(--amber);
    color: #fff;
    border: none;
    width: 38px;
    height: 38px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    border-radius: 50%;
    transition: background .15s, transform .15s;
    flex-shrink: 0;
}
.ai-send:hover { background: #c25a1f; transform: scale(1.05); }
.ai-send:disabled { opacity: 0.5; cursor: wait; }

.ai-disclaimer {
    text-align: center;
    padding: 4px 14px 10px;
    background: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    color: var(--ink);
    opacity: 0.45;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
