/* =============================================
   IFA Chatbot
   ============================================= */

.ifa-chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c9a227, #e6c85a);
    color: #0a1230;
    border: none;
    box-shadow: 0 10px 30px -8px rgba(201, 162, 39, 0.6);
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
}

.ifa-chat-launcher:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 16px 40px -10px rgba(201, 162, 39, 0.8);
}

.ifa-chat-launcher::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent, rgba(201, 162, 39, 0.7), transparent);
    animation: ifaChatSpin 4s linear infinite;
    z-index: -1;
    opacity: 0.7;
}

@keyframes ifaChatSpin {
    to { transform: rotate(360deg); }
}

.ifa-chat-launcher .ifa-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    border-radius: 9px;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
}

.ifa-chat-launcher.is-open .ifa-chat-badge { display: none; }

/* Tooltip bubble "Posez-moi vos questions ici" */
.ifa-chat-tooltip {
    position: absolute;
    right: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    color: #0a1230;
    padding: 10px 32px 10px 14px;
    border-radius: 14px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 10px 30px -8px rgba(10, 18, 48, 0.35), 0 0 0 1px rgba(201, 162, 39, 0.3);
    pointer-events: auto;
    animation: ifaTooltipBounce 2.5s ease-in-out infinite;
    cursor: pointer;
}

.ifa-chat-tooltip::after {
    content: '';
    position: absolute;
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 8px solid #fff;
    filter: drop-shadow(1px 0 0 rgba(201, 162, 39, 0.3));
}

.ifa-chat-tooltip-close {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(10, 18, 48, 0.08);
    color: #0a1230;
    font-size: 0.9rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 400;
    transition: background 0.2s ease;
}

.ifa-chat-tooltip-close:hover {
    background: rgba(10, 18, 48, 0.18);
}

@keyframes ifaTooltipBounce {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    50% { transform: translateY(-50%) translateX(-6px); }
}

.ifa-chat-launcher.is-open .ifa-chat-tooltip,
.ifa-chat-launcher.tooltip-dismissed .ifa-chat-tooltip {
    display: none;
}

@media (max-width: 480px) {
    .ifa-chat-tooltip {
        font-size: 0.75rem;
        padding: 8px 28px 8px 12px;
        right: calc(100% + 10px);
    }
}

/* Panel */
.ifa-chat-panel {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: calc(100vh - 140px);
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 30px 80px -20px rgba(10, 18, 48, 0.35), 0 0 0 1px rgba(201, 162, 39, 0.15);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Montserrat', sans-serif;
    transform: translateY(20px) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.ifa-chat-panel.is-open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Header */
.ifa-chat-header {
    padding: 16px 18px;
    background: linear-gradient(135deg, #0a1230, #1a2a5e);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(201, 162, 39, 0.25);
    position: relative;
}

.ifa-chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #c9a227, transparent);
}

.ifa-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c9a227, #e6c85a);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0a1230;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
}

.ifa-chat-header-text {
    flex: 1;
    min-width: 0;
}

.ifa-chat-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}

.ifa-chat-status {
    font-size: 0.72rem;
    opacity: 0.75;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.ifa-chat-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.7);
}

.ifa-chat-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.ifa-chat-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Messages */
.ifa-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fafbfd;
    scroll-behavior: smooth;
}

.ifa-chat-messages::-webkit-scrollbar { width: 6px; }
.ifa-chat-messages::-webkit-scrollbar-track { background: transparent; }
.ifa-chat-messages::-webkit-scrollbar-thumb { background: rgba(26, 42, 94, 0.2); border-radius: 3px; }

.ifa-msg {
    max-width: 85%;
    padding: 10px 14px;
    font-size: 0.88rem;
    line-height: 1.5;
    border-radius: 14px;
    animation: ifaMsgIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    word-wrap: break-word;
}

@keyframes ifaMsgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ifa-msg.bot {
    align-self: flex-start;
    background: #fff;
    color: #1a2a5e;
    border: 1px solid rgba(26, 42, 94, 0.08);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(10, 18, 48, 0.04);
}

.ifa-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #1a2a5e, #0a1230);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px -2px rgba(10, 18, 48, 0.3);
}

.ifa-msg strong { color: #c9a227; }
.ifa-msg.user strong { color: #e6c85a; }
.ifa-msg a { color: #c9a227; text-decoration: underline; }

.ifa-msg-disclaimer {
    font-size: 0.72rem;
    color: #5d6b82;
    font-style: italic;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(26, 42, 94, 0.15);
    line-height: 1.4;
}

/* Typing indicator */
.ifa-typing {
    align-self: flex-start;
    background: #fff;
    padding: 12px 16px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(26, 42, 94, 0.08);
    display: flex;
    gap: 4px;
}

.ifa-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #1a2a5e;
    opacity: 0.4;
    animation: ifaTypingBounce 1.2s infinite ease-in-out;
}

.ifa-typing span:nth-child(2) { animation-delay: 0.2s; }
.ifa-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ifaTypingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Chips (suggested questions) */
.ifa-chat-chips {
    padding: 8px 14px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ifa-chip {
    background: #fff;
    color: #1a2a5e;
    border: 1px solid rgba(201, 162, 39, 0.4);
    padding: 6px 12px;
    border-radius: 18px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    font-weight: 500;
}

.ifa-chip:hover {
    background: linear-gradient(135deg, #c9a227, #e6c85a);
    color: #0a1230;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -4px rgba(201, 162, 39, 0.6);
}

/* Input */
.ifa-chat-input {
    padding: 12px 14px;
    border-top: 1px solid rgba(26, 42, 94, 0.08);
    background: #fff;
    display: flex;
    gap: 8px;
    align-items: center;
}

.ifa-chat-input input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid rgba(26, 42, 94, 0.1);
    border-radius: 22px;
    font-family: inherit;
    font-size: 0.88rem;
    color: #1a2a5e;
    background: #fafbfd;
    outline: none;
    transition: all 0.2s ease;
}

.ifa-chat-input input::placeholder { color: #94a3b8; }

.ifa-chat-input input:focus {
    border-color: #c9a227;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.12);
}

.ifa-chat-send {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #c9a227, #e6c85a);
    color: #0a1230;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.25s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px -4px rgba(201, 162, 39, 0.5);
}

.ifa-chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px -4px rgba(201, 162, 39, 0.7);
}

.ifa-chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Mobile */
@media (max-width: 480px) {
    .ifa-chat-panel {
        width: calc(100vw - 16px);
        right: 8px;
        bottom: 90px;
        height: calc(100vh - 110px);
        border-radius: 14px;
    }
    .ifa-chat-launcher {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }
}
