/* ═══════════════════════════════════════════
   WC ChatBot AI v2.0 — Frontend CSS
   ═══════════════════════════════════════════ */

/* ── BULLE ── */
#wcbot-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99999;
    box-shadow: 0 4px 15px rgba(0,0,0,.3);
    transition: transform .3s, box-shadow .3s;
    background: var(--wcbot-color, #2271b1);
}
#wcbot-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
#wcbot-bubble img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}
#wcbot-bubble .wcbot-bubble-icon {
    font-size: 24px;
}
#wcbot-bubble.wcbot-pulse {
    animation: wcbot-pulse 2s infinite;
}

/* ── FENÊTRE ── */
#wcbot-win {
    display: none;
    position: fixed;
    bottom: 85px;
    right: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,.2);
    z-index: 99999;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    animation: wcbot-slide-up .3s ease;
}

/* ── HEADER ── */
#wcbot-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: var(--wcbot-color, #2271b1);
    color: #fff;
}
#wcbot-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
#wcbot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,.3);
}
#wcbot-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
#wcbot-title-text {
    font-weight: 600;
    font-size: 14px;
}
#wcbot-status {
    font-size: 11px;
    opacity: .8;
    display: flex;
    align-items: center;
    gap: 4px;
}
#wcbot-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
    animation: wcbot-blink 2s infinite;
}
#wcbot-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background .2s;
}
#wcbot-close:hover {
    background: rgba(255,255,255,.2);
}

/* ── MESSAGES ── */
#wcbot-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}
#wcbot-msgs::-webkit-scrollbar {
    width: 4px;
}
#wcbot-msgs::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* Message bulle */
.wcbot-msg {
    padding: 10px 14px;
    border-radius: 16px;
    max-width: 85%;
    line-height: 1.4;
    word-wrap: break-word;
    animation: wcbot-msg-in .3s ease;
}
.wcbot-msg-bot {
    background: #f0f0f0;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.wcbot-msg-user {
    background: var(--wcbot-color, #2271b1);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.wcbot-msg-time {
    font-size: 10px;
    opacity: .5;
    margin-top: 4px;
    text-align: right;
}

/* ── TYPING INDICATOR ── */
#wcbot-typing {
    background: #f0f0f0;
    padding: 12px 16px;
    border-radius: 16px;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
}
#wcbot-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    display: inline-block;
    animation: wcbot-typing-dot 1.4s infinite;
}
#wcbot-typing span:nth-child(2) { animation-delay: .2s; }
#wcbot-typing span:nth-child(3) { animation-delay: .4s; }

/* ── QUICK REPLIES ── */
#wcbot-quick {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: #f8f8f8;
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
#wcbot-quick::-webkit-scrollbar {
    display: none;
}
.wcbot-quick-btn {
    white-space: nowrap;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .2s, border-color .2s;
}
.wcbot-quick-btn:hover {
    background: var(--wcbot-color, #2271b1);
    color: #fff;
    border-color: var(--wcbot-color, #2271b1);
}

/* ── INPUT ── */
#wcbot-input-area {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    background: #fff;
    align-items: center;
}
#wcbot-inp {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
}
#wcbot-inp:focus {
    border-color: var(--wcbot-color, #2271b1);
}
#wcbot-mic-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all .2s;
    flex-shrink: 0;
}
#wcbot-mic-btn:hover {
    background: #f0f0f0;
}
#wcbot-mic-btn.wcbot-listening {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
    animation: wcbot-pulse-red 1s infinite;
}
#wcbot-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--wcbot-color, #2271b1);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: opacity .2s;
    flex-shrink: 0;
}
#wcbot-send-btn:hover {
    opacity: .85;
}

/* ── EMAIL CAPTURE ── */
#wcbot-email-capture {
    padding: 12px;
    background: #fffbeb;
    border-top: 1px solid #fcd34d;
    flex-shrink: 0;
    display: none;
}
#wcbot-email-capture p {
    margin: 0 0 8px;
    font-size: 13px;
    color: #92400e;
}
#wcbot-email-capture input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}
#wcbot-email-capture button {
    margin-top: 6px;
    width: 100%;
    padding: 8px;
    background: var(--wcbot-color, #2271b1);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}
#wcbot-email-capture .wcbot-email-skip {
    background: none;
    color: #999;
    font-size: 11px;
    margin-top: 4px;
}

/* ── ÉVALUATION ── */
#wcbot-rating {
    padding: 8px 12px;
    text-align: center;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    display: none;
}
#wcbot-rating span {
    font-size: 12px;
    color: #666;
}
.wcbot-rate-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    margin: 4px 4px 0;
    transition: transform .2s, background .2s;
}
.wcbot-rate-btn:hover {
    transform: scale(1.2);
    background: #f0f0f0;
}

/* ── BOUTON SON MESSAGE ── */
.wcbot-sound-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    opacity: .4;
    padding: 2px 4px;
    margin-left: 4px;
    transition: opacity .2s;
    vertical-align: middle;
}
.wcbot-sound-btn:hover {
    opacity: 1;
}

/* ── ANIMATIONS ── */
@keyframes wcbot-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34,113,177,.4); }
    50% { box-shadow: 0 0 0 12px rgba(34,113,177,0); }
}
@keyframes wcbot-pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
    50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}
@keyframes wcbot-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes wcbot-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes wcbot-typing-dot {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}
@keyframes wcbot-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: .4; }
}

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
    #wcbot-win {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    #wcbot-bubble {
        bottom: 16px;
        right: 16px;
    }
}

/* ── MODE SOMBRE ── */
.wcbot-dark #wcbot-win {
    background: #1a1a2e;
    color: #e0e0e0;
}
.wcbot-dark #wcbot-msgs {
    background: #1a1a2e;
}
.wcbot-dark .wcbot-msg-bot {
    background: #2d2d44;
    color: #e0e0e0;
}
.wcbot-dark #wcbot-quick {
    background: #16213e;
}
.wcbot-dark .wcbot-quick-btn {
    background: #2d2d44;
    border-color: #444;
    color: #e0e0e0;
}
.wcbot-dark #wcbot-input-area {
    background: #1a1a2e;
    border-color: #333;
}
.wcbot-dark #wcbot-inp {
    background: #2d2d44;
    border-color: #444;
    color: #e0e0e0;
}
.wcbot-dark #wcbot-mic-btn {
    background: #2d2d44;
    border-color: #444;
}
.wcbot-dark #wcbot-typing {
    background: #2d2d44;
}
