/* G-Linfo Chatbot for WordPress — Widget CSS */
#glinfo-chat-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Bouton flottant */
#glinfo-chat-toggle {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--amp-primary, #00a2ad);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transition: transform 0.2s, box-shadow 0.2s;
    color: #fff;
    margin-left: auto;
}
#glinfo-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
#glinfo-chat-toggle svg { width: 24px; height: 24px; }

/* Fenêtre */
#glinfo-chat-box {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    max-height: 550px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), opacity 0.2s;
}
#glinfo-chat-box.glinfo-chat-hidden {
    transform: scale(0.85);
    opacity: 0;
    pointer-events: none;
}

/* En-tête */
#glinfo-chat-header {
    background: var(--amp-primary, #00a2ad);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
#glinfo-chat-avatar {
    width: 38px; height: 38px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
#glinfo-chat-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
#glinfo-chat-subtitle { font-size: 11px; opacity: 0.9; display: flex; align-items: center; gap: 5px; }

.amp-status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    display: inline-block;
}
.amp-status-open   { background: #4ade80; box-shadow: 0 0 0 2px rgba(74,222,128,0.3); }
.amp-status-closed { background: #f87171; }

/* Bandeau horaires */
#amp-hours-banner {
    font-size: 12px;
    padding: 7px 14px;
    text-align: center;
    flex-shrink: 0;
}
#amp-hours-banner.amp-hours-open   { background: #ecfdf5; color: #166534; }
#amp-hours-banner.amp-hours-closed { background: #fef2f2; color: #991b1b; }

/* Messages */
#glinfo-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
.amp-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}
.amp-msg-bot {
    background: #f0f4f8;
    color: #1a1a2e;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}
.amp-msg-user {
    background: var(--amp-primary, #00a2ad);
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

/* Typing indicator */
.amp-typing {
    display: flex;
    gap: 5px;
    padding: 12px 14px;
    background: #f0f4f8;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    width: fit-content;
}
.amp-typing span {
    width: 7px; height: 7px;
    background: #999;
    border-radius: 50%;
    animation: ampBounce 1.2s infinite;
}
.amp-typing span:nth-child(2) { animation-delay: 0.2s; }
.amp-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ampBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* FAQ chips */
#glinfo-chat-faq {
    padding: 0 12px 10px;
    flex-shrink: 0;
}
#amp-faq-label { font-size: 11px; color: #888; margin-bottom: 6px; }
#amp-faq-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.amp-faq-chip {
    font-size: 12px;
    padding: 5px 10px;
    background: #f0f8f9;
    border: 1px solid var(--amp-primary, #00a2ad);
    color: var(--amp-primary, #00a2ad);
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: left;
    line-height: 1.3;
}
.amp-faq-chip:hover {
    background: var(--amp-primary, #00a2ad);
    color: #fff;
}
.amp-faq-chip-quote {
    background: var(--amp-primary, #00a2ad);
    color: #fff;
    border-color: var(--amp-primary, #00a2ad);
    font-weight: 600;
}
.amp-faq-chip-quote:hover { opacity: 0.85; background: var(--amp-primary, #00a2ad); }

/* Formulaire devis */
#amp-quote-form {
    padding: 14px 16px;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    max-height: 60vh;
    overflow-y: auto;
}
#amp-quote-form.glinfo-chat-hidden { display: none; }
#amp-quote-title { font-weight: 700; font-size: 14px; color: #1a1a2e; margin-bottom: 4px; }
#amp-quote-form input,
#amp-quote-form select,
#amp-quote-form textarea {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
#amp-quote-form input:focus,
#amp-quote-form select:focus,
#amp-quote-form textarea:focus { border-color: var(--amp-primary, #00a2ad); }
#amp-quote-form textarea { resize: vertical; }
#amp-quote-contact-hint {
    font-size: 11px;
    color: #888;
    margin-top: -4px;
    margin-bottom: 2px;
}
#amp-quote-error {
    font-size: 12px;
    color: #cc1818;
    background: #fef2f2;
    border-radius: 6px;
    padding: 0;
    display: none;
}
#amp-quote-error.amp-show {
    display: block;
    padding: 8px 10px;
}
.amp-field-error { border-color: #cc1818 !important; }
#amp-quote-actions { display: flex; gap: 8px; margin-top: 4px; }
.amp-btn-primary, .amp-btn-secondary {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.amp-btn-primary { background: var(--amp-primary, #00a2ad); color: #fff; }
.amp-btn-secondary { background: #f0f0f0; color: #555; }
.amp-btn-primary:hover, .amp-btn-secondary:hover { opacity: 0.85; }
.amp-btn-primary:disabled { opacity: 0.6; cursor: default; }

/* Zone saisie */
#glinfo-chat-input-area {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}
#glinfo-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 22px;
    padding: 9px 14px;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}
#glinfo-chat-input:focus { border-color: var(--amp-primary, #00a2ad); }

/* Bouton devis permanent */
#amp-quote-open {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--amp-primary, #00a2ad);
    border: none;
    cursor: pointer;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.15s;
    position: relative;
}
#amp-quote-open:hover { opacity: 0.85; transform: scale(1.05); }
#amp-quote-open::after {
    content: 'Devis';
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    font-size: 10px;
    padding: 3px 7px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}
#amp-quote-open:hover::after { opacity: 1; }

/* Bouton toggle FAQ */
#amp-faq-toggle {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid #ddd;
    cursor: pointer;
    color: #aaa;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s;
}
#amp-faq-toggle:hover,
#amp-faq-toggle.amp-faq-active { border-color: var(--amp-primary, #00a2ad); color: var(--amp-primary, #00a2ad); }

#glinfo-chat-send {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--amp-primary, #00a2ad);
    border: none;
    cursor: pointer;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}
#glinfo-chat-send:hover { opacity: 0.85; }
#glinfo-chat-send:disabled { opacity: 0.5; cursor: default; }

/* Footer */
#glinfo-chat-footer {
    text-align: center;
    font-size: 10px;
    color: #bbb;
    padding: 4px 0 8px;
}
#glinfo-chat-footer a { color: #bbb; text-decoration: none; }

/* Scrollbar */
#glinfo-chat-messages::-webkit-scrollbar { width: 4px; }
#glinfo-chat-messages::-webkit-scrollbar-track { background: transparent; }
#glinfo-chat-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

/* Mobile */
@media (max-width: 480px) {
    #glinfo-chat-box {
        width: calc(100vw - 24px);
        right: 0;
        bottom: 68px;
        max-height: 70vh;
    }
    #glinfo-chat-wrapper { right: 12px; bottom: 16px; }
}
