/* ═══════════════════════════════════════════════════════════════
   EKLOR STUDIO — Chat Widget
   Vanilla CSS, matche le dark theme du site (purple/pink gradient)
   ═══════════════════════════════════════════════════════════════ */

:root {
    --ek-chat-bg: #0a0a0f;
    --ek-chat-bg-2: #13131c;
    --ek-chat-bg-3: #1a1a26;
    --ek-chat-text: #f0f0f5;
    --ek-chat-text-2: #9999aa;
    --ek-chat-text-3: #666677;
    --ek-chat-accent: #7c3aed;
    --ek-chat-accent-2: #a855f7;
    --ek-chat-pink: #ec4899;
    --ek-chat-border: rgba(255, 255, 255, 0.08);
    --ek-chat-border-2: rgba(255, 255, 255, 0.12);
    --ek-chat-gradient: linear-gradient(135deg, #7c3aed, #ec4899);
    --ek-chat-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04);
    --ek-chat-glow: 0 0 24px rgba(124, 58, 237, 0.4);
}

/* ═══ BOUTON FLOTTANT ═══ */
#ek-chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--ek-chat-gradient);
    border: none;
    cursor: pointer;
    z-index: 9998;
    box-shadow: var(--ek-chat-shadow), var(--ek-chat-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-family: 'Inter', -apple-system, sans-serif;
}
#ek-chat-launcher:hover {
    transform: scale(1.08);
    box-shadow: 0 24px 70px rgba(0,0,0,0.6), 0 0 32px rgba(236, 72, 153, 0.5);
}
#ek-chat-launcher svg { width: 26px; height: 26px; }

#ek-chat-launcher .ek-chat-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--ek-chat-gradient);
    opacity: 0.5;
    animation: ek-chat-pulse 2.4s ease-in-out infinite;
    pointer-events: none;
}
@keyframes ek-chat-pulse {
    0%, 100% { transform: scale(1); opacity: 0.45; }
    50% { transform: scale(1.35); opacity: 0; }
}

#ek-chat-launcher .ek-chat-dot-new {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ec4899;
    border: 2px solid var(--ek-chat-bg);
    box-shadow: 0 0 8px rgba(236, 72, 153, 0.7);
}

/* Hide launcher when window is open */
body.ek-chat-open #ek-chat-launcher {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

/* ═══ FENÊTRE CHAT ═══ */
#ek-chat-window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 48px);
    background: var(--ek-chat-bg);
    border: 1px solid var(--ek-chat-border-2);
    border-radius: 20px;
    box-shadow: var(--ek-chat-shadow);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Inter', -apple-system, sans-serif;
    color: var(--ek-chat-text);
    animation: ek-chat-slide-up 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
#ek-chat-window.ek-chat-visible { display: flex; }

@keyframes ek-chat-slide-up {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ═══ HEADER ═══ */
.ek-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.12), rgba(124, 58, 237, 0.02));
    border-bottom: 1px solid var(--ek-chat-border);
    flex-shrink: 0;
}
.ek-chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--ek-chat-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 800;
    color: #fff;
    font-size: 15px;
    flex-shrink: 0;
}
.ek-chat-header-info {
    flex: 1;
    min-width: 0;
}
.ek-chat-header-title {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
}
.ek-chat-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--ek-chat-text-2);
    margin-top: 2px;
}
.ek-chat-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}
.ek-chat-close {
    background: transparent;
    border: 1px solid var(--ek-chat-border);
    color: var(--ek-chat-text-2);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.ek-chat-close:hover {
    background: var(--ek-chat-bg-3);
    color: var(--ek-chat-text);
    border-color: var(--ek-chat-border-2);
}

/* ═══ MESSAGES ═══ */
.ek-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}
.ek-chat-messages::-webkit-scrollbar {
    width: 6px;
}
.ek-chat-messages::-webkit-scrollbar-track { background: transparent; }
.ek-chat-messages::-webkit-scrollbar-thumb {
    background: var(--ek-chat-border-2);
    border-radius: 3px;
}

.ek-chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: ek-chat-msg-in 0.25s ease-out;
}
@keyframes ek-chat-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ek-chat-msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.ek-chat-msg.ek-chat-user {
    align-self: flex-end;
    align-items: flex-end;
}
.ek-chat-msg.ek-chat-user .ek-chat-msg-bubble {
    background: var(--ek-chat-gradient);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ek-chat-msg.ek-chat-assistant {
    align-self: flex-start;
    align-items: flex-start;
}
.ek-chat-msg.ek-chat-assistant .ek-chat-msg-bubble {
    background: var(--ek-chat-bg-3);
    color: var(--ek-chat-text);
    border: 1px solid var(--ek-chat-border);
    border-bottom-left-radius: 4px;
}

.ek-chat-msg.ek-chat-system .ek-chat-msg-bubble {
    background: rgba(124, 58, 237, 0.08);
    border: 1px solid rgba(124, 58, 237, 0.25);
    color: var(--ek-chat-text-2);
    font-size: 13px;
    text-align: center;
    align-self: center;
}

.ek-chat-msg-bubble a {
    color: var(--ek-chat-accent-2);
    text-decoration: underline;
}

/* ═══ TYPING INDICATOR ═══ */
.ek-chat-typing {
    align-self: flex-start;
    background: var(--ek-chat-bg-3);
    border: 1px solid var(--ek-chat-border);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    padding: 12px 16px;
    display: flex;
    gap: 4px;
    align-items: center;
}
.ek-chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ek-chat-text-2);
    animation: ek-chat-bounce 1.2s infinite;
}
.ek-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.ek-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ek-chat-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ═══ QUICK ACTIONS / SUGGESTIONS ═══ */
.ek-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    align-self: flex-start;
    max-width: 100%;
}
.ek-chat-suggestion {
    background: rgba(124, 58, 237, 0.08);
    border: 1px solid rgba(124, 58, 237, 0.3);
    color: var(--ek-chat-accent-2);
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}
.ek-chat-suggestion:hover {
    background: rgba(124, 58, 237, 0.18);
    border-color: var(--ek-chat-accent-2);
    color: #fff;
}

/* ═══ LEAD CAPTURE INLINE FORM ═══ */
.ek-chat-lead-form {
    background: var(--ek-chat-bg-3);
    border: 1px solid rgba(124, 58, 237, 0.4);
    border-radius: 14px;
    padding: 14px;
    margin-top: 4px;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ek-chat-lead-form-title {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--ek-chat-text);
}
.ek-chat-lead-form-sub {
    font-size: 12px;
    color: var(--ek-chat-text-2);
    margin-top: -4px;
}
.ek-chat-lead-form input,
.ek-chat-lead-form textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--ek-chat-bg);
    border: 1px solid var(--ek-chat-border-2);
    border-radius: 8px;
    color: var(--ek-chat-text);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease;
}
.ek-chat-lead-form input:focus,
.ek-chat-lead-form textarea:focus {
    border-color: var(--ek-chat-accent-2);
}
.ek-chat-lead-form textarea {
    resize: vertical;
    min-height: 60px;
    max-height: 120px;
}
.ek-chat-lead-form-actions {
    display: flex;
    gap: 8px;
}
.ek-chat-lead-form button {
    flex: 1;
    padding: 9px 14px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.1s ease;
    border: none;
}
.ek-chat-lead-form button.ek-chat-lead-submit {
    background: var(--ek-chat-gradient);
    color: #fff;
}
.ek-chat-lead-form button.ek-chat-lead-cancel {
    background: transparent;
    color: var(--ek-chat-text-2);
    border: 1px solid var(--ek-chat-border-2);
    flex: 0 0 auto;
}
.ek-chat-lead-form button:hover { opacity: 0.92; }
.ek-chat-lead-form button:active { transform: scale(0.98); }
.ek-chat-lead-form button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ═══ FOOTER / INPUT ═══ */
.ek-chat-footer {
    border-top: 1px solid var(--ek-chat-border);
    padding: 12px 14px 8px;
    background: var(--ek-chat-bg-2);
    flex-shrink: 0;
}
.ek-chat-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.ek-chat-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 14px;
    background: var(--ek-chat-bg-3);
    border: 1px solid var(--ek-chat-border-2);
    border-radius: 100px;
    color: var(--ek-chat-text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    outline: none;
    transition: border-color 0.15s ease;
    overflow-y: auto;
}
.ek-chat-input:focus {
    border-color: var(--ek-chat-accent-2);
}
.ek-chat-input::placeholder {
    color: var(--ek-chat-text-3);
}
.ek-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ek-chat-gradient);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s ease, transform 0.1s ease;
}
.ek-chat-send:hover { opacity: 0.92; }
.ek-chat-send:active { transform: scale(0.94); }
.ek-chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.ek-chat-send svg { width: 18px; height: 18px; }

.ek-chat-credit {
    text-align: center;
    font-size: 10px;
    color: var(--ek-chat-text-3);
    margin-top: 6px;
    letter-spacing: 0.2px;
}
.ek-chat-credit a {
    color: var(--ek-chat-text-2);
    text-decoration: none;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 600px) {
    #ek-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }
    #ek-chat-launcher {
        bottom: 78px; /* leave room for sticky CTA */
        right: 16px;
        width: 56px;
        height: 56px;
    }
}

/* Reduce launcher position when sticky-cta visible (desktop fine, mobile already handled above) */
@media (min-width: 601px) and (max-width: 900px) {
    #ek-chat-launcher {
        bottom: 20px;
        right: 20px;
    }
}
