/**
 * NUMERIS AFRICA - Floating AI Assistant Widget CSS
 * Design subtil, moderne et interactif (Mode sombre glassmorphism)
 * Persistance LocalStorage & Responsive Mobile
 */

/* ==========================================================
   1. BOUTON FLOTTANT SUBTIL (BOTTOM-LEFT)
   ========================================================== */
.naw-trigger-btn {
    position: fixed !important;
    bottom: 24px !important;
    left: 24px !important;
    z-index: 99990 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 9px !important;
    padding: 10px 16px !important;
    background: rgba(15, 23, 42, 0.94) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    border: 1px solid rgba(255, 122, 0, 0.45) !important;
    border-radius: 9999px !important;
    color: #ffffff !important;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    outline: none !important;
    user-select: none !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 18px rgba(255, 122, 0, 0.2) !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.naw-trigger-btn:hover {
    background: rgba(15, 23, 42, 0.98) !important;
    border-color: rgba(255, 122, 0, 0.85) !important;
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.48), 0 0 24px rgba(255, 122, 0, 0.35) !important;
    color: #ffffff !important;
}

.naw-trigger-btn:active {
    transform: translateY(0) scale(0.97) !important;
}

/* Icône Sparkle AI */
.naw-trigger-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: #ff7a00;
}

.naw-trigger-icon-wrap svg {
    width: 19px !important;
    height: 19px !important;
    fill: currentColor;
    transition: transform 0.3s ease;
}

.naw-trigger-btn:hover .naw-trigger-icon-wrap svg {
    transform: rotate(12deg) scale(1.1);
}

/* Point vert En Ligne Pulsant */
.naw-online-dot {
    position: absolute;
    top: -1px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    border: 1.5px solid #0f172a;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
}

.naw-online-dot::after {
    content: '';
    position: absolute;
    top: -1.5px;
    left: -1.5px;
    right: -1.5px;
    bottom: -1.5px;
    border-radius: 50%;
    border: 1.5px solid #10b981;
    animation: nawPulse 2.4s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

@keyframes nawPulse {
    0% { transform: scale(1); opacity: 0.9; }
    60% { transform: scale(2.4); opacity: 0; }
    100% { transform: scale(2.4); opacity: 0; }
}

.naw-btn-text {
    letter-spacing: 0.2px;
    font-weight: 600;
}

/* Badge subtil tag Direct */
.naw-badge-subtle {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    background: rgba(255, 122, 0, 0.18);
    border: 1px solid rgba(255, 122, 0, 0.35);
    border-radius: 9999px;
    color: #ff9433;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* État actif quand la boîte est ouverte */
.naw-trigger-btn.naw-active {
    border-color: #ff7a00 !important;
    background: #1e293b !important;
}

/* ==========================================================
   2. ESPACE DE CONVERSATION (PANEL MODAL / TIROIR)
   ========================================================== */
.naw-panel {
    position: fixed !important;
    bottom: 78px !important;
    left: 24px !important;
    width: 390px !important;
    max-width: calc(100vw - 32px) !important;
    height: 560px !important;
    max-height: calc(100vh - 100px) !important;
    z-index: 99995 !important;
    display: flex !important;
    flex-direction: column !important;
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 20px !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65), 0 0 35px rgba(255, 122, 0, 0.15) !important;
    overflow: hidden !important;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(16px) scale(0.96) !important;
    transform-origin: bottom left !important;
    transition: opacity 0.26s ease, transform 0.26s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.naw-panel.naw-is-open {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0) scale(1) !important;
}

/* Ligne orange supérieure */
.naw-panel-accent-top {
    height: 3px;
    background: linear-gradient(90deg, #ff7a00 0%, #ff9433 50%, #ff7a00 100%);
    width: 100%;
    flex-shrink: 0;
}

/* Header du Chat */
.naw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    background: #0b1120;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.naw-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.naw-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255, 122, 0, 0.2) 0%, rgba(255, 122, 0, 0.05) 100%);
    border: 1px solid rgba(255, 122, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ff7a00;
    flex-shrink: 0;
}

.naw-avatar svg {
    width: 20px !important;
    height: 20px !important;
    fill: currentColor;
}

.naw-header-info {
    display: flex;
    flex-direction: column;
}

.naw-header-title {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.naw-header-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
    font-weight: 600;
}

.naw-header-sub {
    font-size: 11.5px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 1px;
}

.naw-header-sub-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
}

.naw-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.naw-head-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.naw-head-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

.naw-head-btn svg {
    width: 15px !important;
    height: 15px !important;
    fill: currentColor;
}

/* ==========================================================
   3. FLUX DE MESSAGES (SCROLLABLE STREAM)
   ========================================================== */
.naw-stream {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 13px;
    background: radial-gradient(circle at 15% 15%, rgba(255, 122, 0, 0.03), transparent 60%), #0f172a;
}

/* Custom Scrollbar */
.naw-stream::-webkit-scrollbar {
    width: 5px;
}
.naw-stream::-webkit-scrollbar-track {
    background: transparent;
}
.naw-stream::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
.naw-stream::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 122, 0, 0.4);
}

/* Message Rows */
.naw-msg-row {
    display: flex;
    gap: 9px;
    max-width: 90%;
    animation: nawFadeSlide 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes nawFadeSlide {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.naw-bot-row {
    align-self: flex-start;
}

.naw-user-row {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.naw-msg-avatar-mini {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(255, 122, 0, 0.18);
    border: 1px solid rgba(255, 122, 0, 0.35);
    color: #ff7a00;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.naw-msg-avatar-mini svg {
    width: 14px !important;
    height: 14px !important;
    fill: currentColor;
}

.naw-msg-content-wrap {
    display: flex;
    flex-direction: column;
}

.naw-bubble {
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.55;
    word-break: break-word;
}

/* Bulle Bot */
.naw-bot-row .naw-bubble {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
    border-radius: 4px 14px 14px 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.naw-bot-row .naw-bubble p {
    margin: 0 0 6px 0;
    color: #e2e8f0;
}
.naw-bot-row .naw-bubble p:last-child {
    margin-bottom: 0;
}
.naw-bot-row .naw-bubble ul {
    margin: 4px 0 6px 0;
    padding-left: 18px;
    color: #e2e8f0;
}
.naw-bot-row .naw-bubble li {
    margin-bottom: 4px;
    color: #f8fafc;
}
.naw-bot-row .naw-bubble strong {
    color: #ffffff;
}
.naw-bot-row .naw-bubble a {
    color: #ff9433;
    text-decoration: underline;
}

/* Bulle Utilisateur */
.naw-user-row .naw-bubble {
    background: linear-gradient(135deg, #ff7a00 0%, #e66000 100%);
    color: #ffffff;
    border-radius: 14px 4px 14px 14px;
    box-shadow: 0 4px 14px rgba(255, 122, 0, 0.28);
}

.naw-msg-time {
    font-size: 10.5px;
    color: #64748b;
    margin-top: 3px;
    padding: 0 2px;
}

.naw-user-row .naw-msg-time {
    text-align: right;
}

/* CTA devis automatique dans la bulle */
.naw-bubble-cta {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.naw-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    background: rgba(255, 122, 0, 0.15);
    border: 1px solid rgba(255, 122, 0, 0.4);
    border-radius: 8px;
    color: #ff9433 !important;
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.naw-cta-btn svg {
    width: 14px !important;
    height: 14px !important;
    fill: currentColor;
    flex-shrink: 0;
}

.naw-cta-btn:hover {
    background: #ff7a00;
    color: #ffffff !important;
    border-color: #ff7a00;
    transform: translateY(-1px);
}

/* Welcome Card initiale */
.naw-welcome-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 122, 0, 0.25);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 2px;
}

.naw-welcome-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #ff9433;
    font-size: 13px;
    font-weight: 700;
}

.naw-welcome-head svg {
    width: 16px !important;
    height: 16px !important;
    fill: #ff7a00;
    flex-shrink: 0;
}

.naw-welcome-text {
    font-size: 12.5px;
    line-height: 1.5;
    color: #cbd5e1;
    margin: 0;
}

/* Chips de suggestions */
.naw-chips-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.naw-chip-btn {
    padding: 5px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.naw-chip-btn:hover {
    background: rgba(255, 122, 0, 0.15);
    border-color: rgba(255, 122, 0, 0.5);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Typing Indicator (3 dots) */
.naw-typing-row {
    display: none;
    align-self: flex-start;
    gap: 9px;
    max-width: 90%;
}

.naw-typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px 14px 14px 14px;
}

.naw-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ff7a00;
    display: inline-block;
    animation: nawDotBounce 1.4s infinite ease-in-out both;
}

.naw-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.naw-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes nawDotBounce {
    0%, 80%, 100% { transform: scale(0.4); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ==========================================================
   4. FOOTER AVEC CHAMP DE SAISIE
   ========================================================== */
.naw-footer {
    padding: 10px 12px;
    background: #0b1120;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.naw-input-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 4px 6px 4px 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.naw-input-form:focus-within {
    border-color: #ff7a00;
    box-shadow: 0 0 0 2px rgba(255, 122, 0, 0.2);
}

.naw-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.4;
    padding: 6px 0;
}

.naw-input::placeholder {
    color: #64748b;
}

.naw-send-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #ff7a00;
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.naw-send-btn:hover {
    background: #e66000;
    transform: scale(1.05);
}

.naw-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.naw-send-btn svg {
    width: 15px !important;
    height: 15px !important;
    fill: currentColor;
    margin-left: 1px;
}

.naw-footer-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10px;
    color: #64748b;
    padding: 6px 4px 2px 4px;
}

.naw-saved-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #94a3b8;
}

.naw-saved-tag svg {
    width: 11px !important;
    height: 11px !important;
    fill: #10b981;
    flex-shrink: 0;
}

/* ==========================================================
   5. RESPONSIVE MOBILE
   ========================================================== */
@media (max-width: 767px) {
    .naw-trigger-btn {
        bottom: 16px !important;
        left: 14px !important;
        padding: 8px 12px !important;
        font-size: 12px !important;
        gap: 7px !important;
    }

    .naw-trigger-icon-wrap {
        width: 18px;
        height: 18px;
    }

    .naw-trigger-icon-wrap svg {
        width: 16px !important;
        height: 16px !important;
    }

    .naw-badge-subtle {
        display: none !important;
    }

    .naw-panel {
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 85vh !important;
        max-height: 85vh !important;
        border-radius: 20px 20px 0 0 !important;
        border-left: none !important;
        border-right: none !important;
        border-bottom: none !important;
        transform: translateY(100%) !important;
        transform-origin: bottom center !important;
    }

    .naw-panel.naw-is-open {
        transform: translateY(0) !important;
    }
}
