/* VARIABLES */
:root {
    --cb-primary: #FFC727; /* Sera écrasé par PHP */
    --cb-text: #333;
    --cb-bg: #fff;
    --cb-bot-bg: #f4f4f4;
    --cb-user-text: #fff;
    --cb-radius: 5px;
    --cb-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* TYPING ANIMATION */
.cb-typing {
    margin: 10px 15px;
    font-style: italic;
    color: #aaa;
    display: flex;
    gap: 3px;
}
.cb-typing span {
    animation: cb-blink 1.4s infinite both;
    font-size: 24px;
    line-height: 10px;
}
.cb-typing span:nth-child(2) { animation-delay: 0.2s; }
.cb-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cb-blink {
    0% { opacity: 0.2; }
    20% { opacity: 1; }
    100% { opacity: 0.2; }
}

/* BULLE */
#cb-bubble {
    position: fixed; bottom: 30px; right: 30px;
    width: 60px; height: 60px;
    background: var(--cb-primary);
    border-radius: 50%; color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 999999;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: transform 0.3s, background 0.3s;
}
#cb-bubble:hover { transform: scale(1.1); }

/* FENÊTRE */
#cb-window {
    position: fixed; bottom: 30px; right: 30px;
    width: 380px; height: 600px; max-height: 80vh;
    background: #fff; border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow);
    display: none; flex-direction: column;
    z-index: 999999; overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    opacity: 0; transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}
#cb-window.active { opacity: 1; transform: translateY(0); }

/* HEADER */
#cb-header {
    background: var(--cb-primary); color: #fff;
    padding: 20px; display: flex; justify-content: space-between;
    align-items: center;
}
#cb-title { font-weight: 700; font-size: 18px; }
#cb-status { font-size: 12px; opacity: 0.9; }
#cb-close { background:none; border:none; color:rgba(255,255,255,0.8); font-size:24px; cursor:pointer; transition: color 0.2s; }
#cb-close:hover { color: #fff; }

/* MESSAGES */
#cb-messages {
    flex: 1; padding: 20px; overflow-y: auto;
    background: #fff; display: flex; flex-direction: column; gap: 15px;
    scrollbar-width: thin;
}
.cb-msg {
    max-width: 85%; padding: 12px 16px;
    border-radius: 5px; font-size: 15px; line-height: 1.5; word-wrap: break-word;
}
.cb-msg.bot { background: var(--cb-bot-bg); color: var(--cb-text); align-self: flex-start; border-bottom-left-radius: 4px; }
.cb-msg.user { background: var(--cb-primary); color: var(--cb-user-text); align-self: flex-end; border-bottom-right-radius: 4px; }

/* --- NOUVEAU : BOUTONS RAPIDES --- */
.cb-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
    margin-bottom: 15px;
    align-self: flex-start; /* Aligné à gauche comme le bot */
}

.cb-quick-btn {
    background: #fff;
    border: 1px solid var(--cb-primary);
    color: var(--cb-primary);
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.cb-quick-btn:hover {
    background: var(--cb-primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* INPUT */
#cb-input-area {
    padding: 15px; border-top: 1px solid #eee;
    background: #fff; display: flex; align-items: center; gap: 10px;
}
#cb-input {
    flex: 1; padding: 12px 15px; border: 1px solid #ddd;
    border-radius: 5px; outline: none; font-size: 16px; transition: border-color 0.2s;
}
#cb-input:focus { border-color: var(--cb-primary); }
#cb-send {
    background: var(--cb-primary); color: #fff;
    border: none; width: 45px; height: 45px; border-radius: 50%;
    cursor: pointer; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    padding: 0px !important; transition: transform 0.2s;
}
#cb-send:hover { transform: scale(1.1); }
#cb-clip { font-size: 24px; cursor: pointer; color: #999; transition: color 0.3s; padding: 5px; }
#cb-clip:hover { color: var(--cb-primary); }

#cb-confetti { position: absolute; top:0; left:0; width:100%; height:100%; pointer-events:none; display:none; }

/* MOBILE */
@media (max-width: 768px) {
    #cb-window {
        bottom: 0; right: 0; width: 100%; height: 100%; max-height: 100%;
        border-radius: 0; margin: 0; top: 0; left: 0;
    }
    #cb-header { padding-top: env(safe-area-inset-top); border-radius: 0; }
    #cb-input-area { padding-bottom: env(safe-area-inset-bottom); }
    #cb-bubble { bottom: 20px; right: 20px; }
}