/* ==========================================================================
   Widget Chatbot — Hôtel Idou Anfa  |  Design Luxury Moderne
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600&family=DM+Sans:wght@300;400;500&display=swap');

#iac-chat-widget {
    --gold:       #b7995d;
    --gold-dark:  #927b52;
    --gold-light: #d4b87a;
    --gold-glow:  rgba(183, 153, 93, 0.35);
    --dark:       #1e1a14;
    --dark-2:     #2d2519;
    --bg:         #f8f6f1;
    --white:      #ffffff;
    --text:       #2d2519;
    --text-soft:  #8a7a62;
    --font-title: 'Cormorant Garamond', Georgia, serif;
    --font-ui:    'DM Sans', system-ui, sans-serif;
    font-family: var(--font-ui);
}

/* ── Bouton flottant ──────────────────────────────────────────────── */
#iac-chat-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(145deg, var(--gold-light), var(--gold-dark));
    color: #fff;
    font-size: 22px;
    box-shadow: 0 4px 20px var(--gold-glow), 0 2px 8px rgba(0,0,0,0.2);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), box-shadow 0.2s;
}

#iac-chat-toggle::before {
    content: '';
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    opacity: 0;
    animation: iac-pulse-ring 2.8s cubic-bezier(0.22,1,0.36,1) infinite;
}

#iac-chat-toggle:hover {
    transform: scale(1.09);
    box-shadow: 0 6px 28px var(--gold-glow), 0 3px 12px rgba(0,0,0,0.22);
}

#iac-chat-widget.iac-open #iac-chat-toggle::before { animation: none; opacity: 0; }
#iac-chat-toggle .iac-icon-close                   { display: none; }
#iac-chat-widget.iac-open #iac-chat-toggle .iac-icon-open  { display: none; }
#iac-chat-widget.iac-open #iac-chat-toggle .iac-icon-close { display: inline-block; }

@keyframes iac-pulse-ring {
    0%   { transform: scale(0.9); opacity: 0.7; }
    70%  { transform: scale(1.2); opacity: 0; }
    100% { opacity: 0; }
}

/* ── Badge ────────────────────────────────────────────────────────── */
#iac-chat-badge {
    position: absolute;
    top: -3px; right: -3px;
    background: #e05c4a;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    text-align: center;
    padding: 0 4px;
    box-shadow: 0 0 0 2.5px #fff;
    animation: iac-pop 0.4s cubic-bezier(.34,1.56,.64,1);
}

@keyframes iac-pop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

/* ── Fenêtre de chat ──────────────────────────────────────────────── */
#iac-chat-window {
    position: fixed;
    right: 24px;
    bottom: 96px;
    width: 370px;
    max-width: calc(100vw - 32px);
    height: 545px;
    max-height: calc(100vh - 140px);
    background: var(--white);
    border-radius: 22px;
    box-shadow: 0 24px 64px rgba(30,26,20,0.22), 0 4px 16px rgba(183,153,93,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99998;
    opacity: 0;
    transform: translateY(22px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.25s cubic-bezier(.34,1.56,.64,1);
}

#iac-chat-widget.iac-open #iac-chat-window {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ── Header ───────────────────────────────────────────────────────── */
#iac-chat-header {
    background: linear-gradient(140deg, var(--dark) 0%, var(--dark-2) 100%);
    color: #fff;
    padding: 16px 14px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    position: relative;
}

#iac-chat-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--gold) 50%, transparent 100%);
}

.iac-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--gold-light), var(--gold-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: -0.5px;
    color: #fff;
    box-shadow: 0 2px 10px rgba(183,153,93,0.45);
}

.iac-title-block { flex: 1; min-width: 0; }

.iac-title {
    font-family: var(--font-title);
    font-weight: 600;
    font-size: 17px;
    line-height: 1.2;
    letter-spacing: 0.04em;
}

.iac-subtitle {
    font-size: 11.5px;
    opacity: 0.68;
    line-height: 1.3;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.iac-online-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 7px #4ade80;
    flex-shrink: 0;
    animation: iac-dot-pulse 2.2s ease-in-out infinite;
}

@keyframes iac-dot-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.45; }
}

#iac-chat-close {
    background: rgba(255,255,255,0.09);
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

#iac-chat-close:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* ── Zone messages ────────────────────────────────────────────────── */
#iac-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg);
    scroll-behavior: smooth;
}

#iac-chat-messages::-webkit-scrollbar { width: 4px; }
#iac-chat-messages::-webkit-scrollbar-track { background: transparent; }
#iac-chat-messages::-webkit-scrollbar-thumb { background: #d6c9b0; border-radius: 4px; }

/* ── Bulles de message ────────────────────────────────────────────── */
.iac-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.52;
    white-space: pre-wrap;
    word-wrap: break-word;
    animation: iac-msg-in 0.22s cubic-bezier(.34,1.4,.64,1) both;
}

@keyframes iac-msg-in {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.iac-msg-bot {
    align-self: flex-start;
    background: var(--white);
    color: var(--text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 10px rgba(30,26,20,0.08);
}

.iac-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 12px rgba(146,123,82,0.38);
}

.iac-msg-error {
    align-self: flex-start;
    background: #fff5f5;
    color: #a33a2c;
    border: 1px solid #fcd5ce;
    border-radius: 14px;
    font-size: 13px;
}

/* ── Typing indicator ────────────────────────────────────────────── */
.iac-typing {
    align-self: flex-start;
    display: flex;
    gap: 5px;
    padding: 13px 16px;
    background: var(--white);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 10px rgba(30,26,20,0.08);
    animation: iac-msg-in 0.22s both;
}

.iac-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gold);
    opacity: 0.45;
    animation: iac-bounce 1.3s infinite ease-in-out;
}

.iac-typing span:nth-child(2) { animation-delay: 0.18s; }
.iac-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes iac-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40%           { transform: translateY(-6px); opacity: 1; }
}

/* ── Quick replies ───────────────────────────────────────────────── */
.iac-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 4px 0 6px;
    animation: iac-msg-in 0.3s 0.12s both;
}

.iac-qr-btn {
    background: var(--white);
    color: var(--gold-dark);
    border: 1.5px solid var(--gold);
    border-radius: 22px;
    padding: 6px 14px;
    font-size: 12.5px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.12s, box-shadow 0.12s;
    font-family: var(--font-ui);
    line-height: 1.3;
}

.iac-qr-btn:hover {
    background: var(--gold);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--gold-glow);
}

/* ── Zone de saisie ─────────────────────────────────────────────── */
#iac-chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid #ede8df;
    flex-shrink: 0;
    background: var(--white);
}

#iac-chat-input {
    flex: 1;
    border: 1.5px solid #e0d8cb;
    border-radius: 24px;
    padding: 9px 16px;
    font-size: 13.5px;
    outline: none;
    color: var(--text);
    background: var(--bg);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    font-family: var(--font-ui);
}

#iac-chat-input::placeholder { color: #b0a48c; }

#iac-chat-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(183,153,93,0.13);
    background: #fff;
}

#iac-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, var(--gold-light), var(--gold-dark));
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    box-shadow: 0 2px 10px rgba(183,153,93,0.38);
}

#iac-chat-send:not(:disabled):hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(183,153,93,0.55);
}

#iac-chat-send:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
}

/* ── Footer ─────────────────────────────────────────────────────── */
#iac-chat-footer {
    text-align: center;
    font-family: var(--font-title);
    font-size: 12px;
    font-weight: 500;
    color: #c4b89a;
    padding: 0 0 9px;
    background: var(--white);
    letter-spacing: 0.08em;
    flex-shrink: 0;
}

/* ── Responsive mobile ───────────────────────────────────────────── */
@media (max-width: 480px) {
    #iac-chat-window {
        right: 12px; left: 12px;
        width: auto; bottom: 84px;
        height: calc(100vh - 114px);
        border-radius: 18px;
    }
    #iac-chat-toggle { right: 16px; bottom: 16px; }
}
