/* ════ Campour AI — Widget Chat CSS ════ */

/* ── Order Card ── */
.cai-order-card {
    margin: 8px 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(41,61,28,.15);
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    animation: campySlideIn .3s ease;
}
.cai-order-header {
    background: linear-gradient(135deg, #293d1c, #54af48);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 16px;
    text-align: center;
}
.cai-order-body {
    background: #f8fdf7;
    padding: 12px 16px;
}
.cai-order-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #e8f5e5;
}
.cai-order-row:last-child { border-bottom: none; }
.cai-order-row span { color: #666; font-size: 12px; }
.cai-order-row strong { color: #293d1c; text-align: right; max-width: 55%; }
.cai-order-actions {
    padding: 12px 16px;
    background: #fff;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.cai-order-wa {
    flex: 1;
    background: #25D366;
    color: #fff !important;
    text-align: center;
    padding: 10px;
    border-radius: 22px;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none !important;
    transition: background .2s;
}
.cai-order-wa:hover { background: #1da851; }
.cai-order-book {
    flex: 1;
    background: #fff;
    color: #293d1c !important;
    text-align: center;
    padding: 10px;
    border-radius: 22px;
    font-weight: 600;
    font-size: 12px;
    text-decoration: none !important;
    border: 2px solid #54af48;
    transition: background .2s;
}
.cai-order-book:hover { background: #f0faf0; }
.cai-order-note {
    background: #f0faf0;
    color: #54af48;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    padding: 8px;
}

/* ── Animations ── */
@keyframes campySlideIn {
    from { opacity:0; transform: translateY(10px); }
    to   { opacity:1; transform: translateY(0); }
}
@keyframes campyPulseBtn {
    0%,100% { box-shadow: 0 4px 20px rgba(84,175,72,.45); }
    50%      { box-shadow: 0 4px 32px rgba(84,175,72,.8), 0 0 0 8px rgba(84,175,72,.15); }
}
@keyframes campyBlink {
    0%,100% { opacity:1; }
    50%      { opacity:.4; }
}
@keyframes campyDot {
    0%,80%,100% { transform: scale(.7); opacity:.5; }
    40%          { transform: scale(1);  opacity:1; }
}

/* ── Bouton flottant ── */
#campy-ai-btn {
    position: fixed;
    bottom: 90px;
    right: 24px;
    z-index: 99990;
    width: 58px;
    height: 58px;
    background: linear-gradient(135deg, #54af48, #293d1c);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(84,175,72,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    transition: transform .2s, box-shadow .2s;
    animation: campyPulseBtn 2.5s ease-in-out 3;
}
#campy-ai-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(84,175,72,.6);
}
.campy-ai-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e63946;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Montserrat', sans-serif;
}

/* ── Fenêtre chat ── */
#campy-ai-window {
    position: fixed;
    bottom: 160px;
    right: 24px;
    z-index: 99991;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 200px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 12px 48px rgba(41,61,28,.18), 0 2px 12px rgba(0,0,0,.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.85) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .25s ease;
    font-family: 'Montserrat', sans-serif;
}
#campy-ai-window.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* ── Header ── */
.cai-header {
    background: linear-gradient(135deg, #293d1c, #54af48);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.cai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.cai-header-info { flex: 1; }
.cai-header-name { color: #fff; font-weight: 700; font-size: 14px; }
.cai-header-sub  { color: rgba(255,255,255,.7); font-size: 11px; }
.cai-header-dot  {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #7dff6b;
    border-radius: 50%;
    margin-right: 4px;
    animation: campyBlink 2s infinite;
}
.cai-new-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.6);
    font-size: 15px;
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
    transition: transform .3s, color .2s;
}
.cai-new-btn:hover { color: #fff; transform: rotate(180deg); }
.cai-close-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.7);
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.cai-close-btn:hover { color: #fff; }

/* ── Messages ── */
.cai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
.cai-messages::-webkit-scrollbar { width: 4px; }
.cai-messages::-webkit-scrollbar-thumb { background: #d0e8cc; border-radius: 2px; }

.cai-msg {
    display: flex;
    flex-direction: column;
    max-width: 82%;
}
.cai-msg.user  { align-self: flex-end; align-items: flex-end; }
.cai-msg.model { align-self: flex-start; align-items: flex-start; }

.cai-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}
.cai-msg.user  .cai-bubble {
    background: linear-gradient(135deg, #54af48, #3d8c33);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.cai-msg.model .cai-bubble {
    background: #f4f7f2;
    color: #293d1c;
    border-bottom-left-radius: 4px;
    border: 1px solid #e0ead8;
}
.cai-msg-time {
    font-size: 10px;
    color: #aaa;
    margin-top: 3px;
    padding: 0 4px;
}

/* ── Typing indicator ── */
.cai-typing .cai-bubble {
    background: #f4f7f2;
    padding: 12px 16px;
    border: 1px solid #e0ead8;
}
.cai-typing-dots { display: flex; gap: 5px; align-items: center; }
.cai-typing-dots span {
    width: 7px;
    height: 7px;
    background: #54af48;
    border-radius: 50%;
    animation: campyDot 1.2s infinite;
}
.cai-typing-dots span:nth-child(2) { animation-delay: .2s; }
.cai-typing-dots span:nth-child(3) { animation-delay: .4s; }

/* ── Footer / input ── */
.cai-footer {
    padding: 10px 12px;
    border-top: 1px solid #eef2ec;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
    background: #fff;
}
.cai-input {
    flex: 1;
    border: 1.5px solid #d0e8cc;
    border-radius: 22px;
    padding: 10px 14px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 100px;
    overflow-y: auto;
    transition: border-color .2s;
    line-height: 1.4;
}
.cai-input:focus { border-color: #54af48; }
.cai-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #54af48, #3d8c33);
    border: none;
    cursor: pointer;
    color: #fff;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform .15s;
}
.cai-send-btn:hover { transform: scale(1.1); }
.cai-send-btn:disabled { opacity: .5; cursor: default; transform: none; }

/* ── Quick suggestions ── */
.cai-suggestions {
    padding: 0 12px 10px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.cai-sugg-btn {
    background: #f0faf0;
    border: 1px solid #c8e6c0;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 11px;
    color: #293d1c;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, border-color .15s;
    white-space: nowrap;
}
.cai-sugg-btn:hover { background: #e0f5d8; border-color: #54af48; }

/* Chips dynamiques — légèrement différentes visuellement */
.cai-chip-dynamic {
    background: #fff;
    border-color: #54af48;
    color: #293d1c;
    font-weight: 500;
}
.cai-chip-dynamic:hover { background: #f0faf0; }

/* ── RTL (darija) ── */
.cai-bubble[dir="rtl"] {
    text-align: right;
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
}

/* ── Mobile ── */
@media (max-width: 480px) {
    #campy-ai-window {
        right: 8px;
        width: calc(100vw - 16px);
        bottom: 140px;
        height: 60vh;
    }
    #campy-ai-btn {
        right: 16px;
        bottom: 80px;
    }
}
