:root {
    --fawaid-bg-gradient: linear-gradient(135deg, #08090E, #10111A);
    --fawaid-bubble-gradient: linear-gradient(135deg, #B5B3D5 0%, #C0C9E8 35%, #AAAED0 70%, #7F8DB8 100%);
    --fawaid-bot-msg: linear-gradient(135deg, #11121A 0%, #171927 55%, #0B0C12 100%);
    --fawaid-user-msg: linear-gradient(135deg, #2B2D46 0%, #454A78 70%, #202235 100%);
    --fawaid-text: #F8F7F2;
    --fawaid-border: rgba(181, 179, 213, 0.35);
    --fawaid-font-body: var(--font-body, sans-serif);
    --fawaid-font-heading: var(--font-heading, sans-serif);
    --fawaid-font-arabic: var(--font-arabic, sans-serif);
}

#fawaid-chat-widget { position: fixed; bottom: 24px; left: 24px; z-index: 9999; font-family: var(--fawaid-font-body); }
#fawaid-chat-bubble { position: relative; overflow: hidden; width: 58px; height: 58px; display: flex; justify-content: center; align-items: center; border-radius: 12px; padding: 0; border: 1px solid transparent; background-image: linear-gradient(#050505, #050505), var(--fawaid-bubble-gradient); -webkit-background-clip: padding-box, border-box; background-clip: padding-box, border-box; background-origin: padding-box, border-box; background-size: 100% 100%, 200% 200%; background-position: center center, 0% 0%; color: #C0C9E8; box-shadow: 0 0 15px rgba(216, 179, 193, .08); cursor: pointer; pointer-events: auto !important; touch-action: manipulation; transition: transform .25s cubic-bezier(.16, 1, .3, 1), color .25s ease, box-shadow .25s ease; }
#fawaid-chat-bubble:hover { transform: translateY(-4px); color: #FFF; background-position: center center, 100% 100%; box-shadow: 0 8px 25px rgba(216, 179, 193, .25), 0 0 12px rgba(234, 169, 194, .3); }
#fawaid-chat-bubble::before { content: ""; position: absolute; inset: 2px; border: 1px solid rgba(216, 179, 193, .1); border-radius: 9px; pointer-events: none; }
#fawaid-chat-bubble::after { content: ""; position: absolute; top: -50%; left: -150%; width: 200%; height: 200%; background: linear-gradient(45deg, transparent 45%, rgba(255, 255, 255, .2) 50%, transparent 55%); transition: left .75s ease; pointer-events: none; }
#fawaid-chat-bubble:hover::after { left: 100%; }
#fawaid-chat-bubble svg { width: 36px; height: 36px; stroke: currentColor; fill: none; transition: transform .4s cubic-bezier(.16, 1, .3, 1); }
#fawaid-chat-bubble:hover svg { transform: scale(1.08); }
#fawaid-chat-box { width: 340px; height: 470px; background-image: linear-gradient(#08090E, #08090E), var(--fawaid-bubble-gradient); background-origin: border-box; background-clip: padding-box, border-box; border: 1px solid transparent; border-radius: 12px; box-shadow: 0 12px 35px rgba(0, 0, 0, .45), 0 2px 8px rgba(43, 45, 70, .25), 0 0 25px rgba(181, 179, 213, .08); display: flex; flex-direction: column; overflow: hidden; position: absolute; bottom: 72px; left: 0; }
#fawaid-chat-box::before { content: ""; position: absolute; inset: 0; border-radius: 12px; padding: 1px; background: linear-gradient(135deg, #B5B3D5, #C0C9E8, #AAAED0, #7F8DB8, #B5B3D5); background-size: 300% 300%; animation: fawaidBorderMove 8s ease infinite; pointer-events: none; z-index: 0; }
#fawaid-chat-box > * { position: relative; z-index: 1; }
#fawaid-chat-header { position: relative; background: linear-gradient(135deg, #050505 0%, #12131C 50%, #050505 100%); color: var(--fawaid-text); padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; font-family: var(--fawaid-font-heading); font-size: 16px; font-weight: 700; border-bottom: 1px solid rgba(216, 179, 193, .15); box-shadow: 0 4px 15px rgba(0, 0, 0, .3); }
#fawaid-chat-header::after { content: ""; position: absolute; bottom: 0; left: 0; width: 100%; height: 1px; background: linear-gradient(90deg, transparent 0%, #B5B3D5 35%, #C0C9E8 70%, transparent 100%); opacity: .65; }
#fawaid-chat-header span:last-child { font-family: var(--fawaid-font-body); color: #C0C9E8; font-size: 22px; line-height: 1; cursor: pointer; transition: color .3s ease, transform .3s ease; }
#fawaid-chat-header span:last-child:hover { color: #FFF; transform: scale(1.15) rotate(90deg); }
#fawaid-chat-messages { flex: 1; padding: 15px 13px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; font-family: var(--fawaid-font-body); font-size: 15px; background: radial-gradient(circle at top, rgba(181, 179, 213, .06), transparent 45%), #08090E; }
#fawaid-chat-messages::-webkit-scrollbar { width: 5px; }
#fawaid-chat-messages::-webkit-scrollbar-track { background: #050505; }
#fawaid-chat-messages::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #B5B3D5, #C0C9E8, #7F8DB8); border-radius: 10px; }
.fawaid-msg { position: relative; padding: 10px 14px; border-radius: 9px; max-width: 85%; word-break: break-word; white-space: pre-wrap; line-height: 1.5; font-family: var(--fawaid-font-body); font-size: 14px; display: flex; flex-direction: column; box-shadow: 0 3px 12px rgba(0, 0, 0, .18); transition: transform .25s ease, box-shadow .25s ease; margin-bottom: 8px; color: var(--fawaid-text); }
.fawaid-msg:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.fawaid-msg.bot { background: var(--fawaid-bot-msg); align-self: flex-start; align-items: flex-start; border: 1px solid var(--fawaid-border); border-top-left-radius: 3px; }
.fawaid-msg.bot::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(180deg, #B5B3D5, #C0C9E8, #7F8DB8); border-radius: 2px; box-shadow: 0 0 8px rgba(181, 179, 213, .35); }
.fawaid-msg.user { background: var(--fawaid-user-msg); align-self: flex-end; align-items: flex-end; border: 1px solid var(--fawaid-border); border-top-right-radius: 3px; box-shadow: 0 4px 15px rgba(0, 0, 0, .25), 0 0 8px rgba(181, 179, 213, .04); }
.fawaid-status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; position: relative; background: #4ADE80; box-shadow: 0 0 8px rgba(74, 222, 128, .8); margin-right: 8px; }
.fawaid-ticks { font-size: 11px; margin-left: 5px; color: #9CA3AF; transition: color .3s ease; }
.fawaid-ticks.read { color: #4ADE80; }
#fawaid-chat-input-area { display: flex; align-items: center; border-top: 1px solid var(--fawaid-border); padding: 10px; background: linear-gradient(135deg, #08090E, #10111A); }
#fawaid-chat-input { flex: 1; min-width: 0; border: 1px solid var(--fawaid-border); background: #10111A; color: var(--fawaid-text); padding: 10px; border-radius: 6px;  font-family: var(--fawaid-font-body); font-size: 14px; }
#fawaid-chat-input::placeholder { color: rgba(192, 201, 232, .55); }
#fawaid-chat-input:focus { outline: none; border-color: var(--fawaid-border); box-shadow: none; }
#fawaid-send-btn { position: relative; overflow: hidden; background-image: linear-gradient(#050505, #050505), var(--fawaid-bubble-gradient); background-clip: padding-box, border-box; background-origin: padding-box, border-box; background-size: 100% 100%, 200% 200%; background-position: center center, 0% 0%; color: #C0C9E8; border: 1px solid transparent; padding: 10px 15px; margin-left: 8px; border-radius: 6px; cursor: pointer; font-family: var(--fawaid-font-body); font-size: 14px; font-weight: 700; transition: transform .3s ease, color .3s ease, background-position .5s ease; }
#fawaid-send-btn:hover { transform: translateY(-2px); color: #FFF; background-position: center center, 100% 100%; }
#fawaid-chat-end-area { padding: 8px; background: #050505; text-align: center; border-top: 1px solid var(--fawaid-border); }
#fawaid-end-btn { width: 100%; padding: 6px 12px; background: transparent; color: #B5B3D5; border: 1px solid var(--fawaid-border); border-radius: 6px; cursor: pointer; font-family: var(--fawaid-font-body); font-size: 12px; font-weight: 600; transition: color .3s ease, background .3s ease, border-color .3s ease; }
#fawaid-end-btn:hover { color: #FFF; background: linear-gradient(135deg, rgba(181, 179, 213, .08), rgba(192, 201, 232, .05)); border-color: #B5B3D5; }

/* Support RTL (Arabe) */
#fawaid-chat-box[dir="rtl"], #fawaid-chat-box[style*="rtl"] { font-family: var(--fawaid-font-arabic); }
#fawaid-chat-box[dir="rtl"] .fawaid-status-dot { margin-right: 0; margin-left: 8px; }
#fawaid-chat-box[dir="rtl"] #fawaid-send-btn { margin-left: 0; margin-right: 8px; }
#fawaid-chat-box[dir="rtl"] .fawaid-msg.bot { border-top-left-radius: 9px; border-top-right-radius: 3px; align-items: flex-start; }
#fawaid-chat-box[dir="rtl"] .fawaid-msg.user { border-top-right-radius: 9px; border-top-left-radius: 3px; align-items: flex-end; }

@keyframes fawaidBorderMove { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

/* Responsive Mobile Complet */
@media screen and (max-width: 600px) {
    #fawaid-chat-widget { left: 15px; bottom: 15px; }
    #fawaid-chat-bubble { width: 52px; height: 52px; border-radius: 50%; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); z-index: 999998; }
    #fawaid-chat-box { position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100% !important; height: 100% !important; max-width: 100% !important; max-height: 100% !important; border-radius: 0 !important; margin: 0; z-index: 999999; display: flex; flex-direction: column; }
    #fawaid-chat-header { padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top)); }
    #fawaid-chat-messages { flex: 1; padding: 12px; -webkit-overflow-scrolling: touch; }
    .fawaid-msg { font-size: 15px; max-width: 86%; }
    #fawaid-chat-input-area { padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
    #fawaid-chat-input { font-size: 16px !important; padding: 10px 12px; }
    #fawaid-send-btn { min-width: 44px; min-height: 44px; }
}

/* Classes utilitaires pour remplacer les styles en ligne */
.fawaid-d-none {
    display: none !important;
}
.fawaid-d-flex {
    display: flex !important;
}
.fawaid-align-center {
    align-items: center !important;
}
/* Point de statut : en ligne / absent / terminé */
.fawaid-status-dot.online { background: #4ADE80; box-shadow: 0 0 8px rgba(74, 222, 128, .8); }
.fawaid-status-dot.away { background: #B5B3D5; box-shadow: 0 0 8px rgba(181, 179, 213, .7); }
.fawaid-status-dot.ended { background: #6B7280; box-shadow: none; }

/* Liens dans les messages */
.fawaid-msg a { color: inherit; text-decoration: underline; word-break: break-all; }
