/* ============================================
   CRESCENS CHAT WIDGET - CSS COMPLET CORRIGÉ
   ============================================ */

/* Conteneur principal */
#crescens-chat {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    font-family: 'Raleway', sans-serif;
}

/* Bouton flottant */
.crescens-toggle {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0e65f8 0%, #3d8cff 100%);
    border: 3px solid white;
    color: white;
    font-size: 1.6rem;
    cursor: pointer;
    box-shadow: 0 6px 25px rgba(14, 101, 248, 0.4);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 100000;
    outline: none;
}

.crescens-toggle:hover {
    transform: scale(1.15) rotate(15deg);
    box-shadow: 0 12px 35px rgba(14, 101, 248, 0.6);
    background: linear-gradient(135deg, #0a51cc 0%, #2d7cff 100%);
}

.crescens-toggle:active {
    transform: scale(0.95);
}

.crescens-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #00c9a7;
    color: white;
    font-size: 0.7rem;
    padding: 4px 9px;
    border-radius: 15px;
    font-weight: 800;
    box-shadow: 0 3px 10px rgba(0, 201, 167, 0.4);
    border: 2px solid white;
}

/* Conteneur du chat - AUGMENTÉ EN HAUTEUR */
.crescens-container {
    position: absolute;
    bottom: 90px;
    right: 0;
    width: 420px;
    height: 490px; /* Augmenté de 490px à 600px */ 
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    visibility: hidden;
    border: 1px solid rgba(14, 101, 248, 0.1);
}

.crescens-container.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
    animation: chatPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* NOUVEAU : Classe pour cacher le chat quand le formulaire est actif */
.crescens-container.form-active .crescens-messages,
.crescens-container.form-active .crescens-input,
.crescens-container.form-active .chat-footer {
    display: none !important;
}

/* NOUVEAU : Formulaire prend toute la hauteur quand actif */
.crescens-container.form-active .crescens-login {
    display: flex !important;
    flex: 1;
    height: 100%;
    position: relative;
    margin-top: 0;
}

@keyframes chatPop {
    0% {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    70% {
        transform: translateY(-5px) scale(1.02);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* En-tête du chat */
.crescens-header {
    background: linear-gradient(135deg, #0e65f8 0%, #0a51cc 100%);
    color: white;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 2;
    min-height: 80px;
    box-shadow: 0 4px 15px rgba(14, 101, 248, 0.2);
    flex-shrink: 0;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.crescens-avatar {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.1) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.crescens-title h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.crescens-status {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.2;
}

.crescens-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #2ed573;
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px #2ed573;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.crescens-close {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
    flex-shrink: 0;
}

.crescens-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* Zone des messages */
.crescens-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8fafd;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(14, 101, 248, 0.03) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(0, 201, 167, 0.03) 0%, transparent 20%);
}

/* Messages */
.message {
    max-width: 85%;
    animation: messageAppear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    animation-delay: 0.1s;
}

.message.bot {
    align-self: flex-start;
    animation-delay: 0.2s;
}

.message-content {
    padding: 12px 15px;
    border-radius: 18px;
    line-height: 1.4;
    font-size: 0.9rem;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-family: 'Raleway', sans-serif;
}

.message.user .message-content {
    background: linear-gradient(135deg, #0e65f8 0%, #3d8cff 100%);
    color: white;
    border-bottom-right-radius: 4px;
    border-top-right-radius: 18px;
    border-top-left-radius: 18px;
    border-bottom-left-radius: 18px;
}

.message.bot .message-content {
    background: white;
    color: #1a1f2d;
    border-bottom-left-radius: 4px;
    border-top-right-radius: 18px;
    border-top-left-radius: 18px;
    border-bottom-right-radius: 18px;
    border: 1px solid rgba(14, 101, 248, 0.1);
}

.message-time {
    font-size: 0.7rem;
    color: #6c757d;
    margin-top: 4px;
    text-align: right;
    font-weight: 500;
    opacity: 0.8;
}

.message.bot .message-time {
    text-align: left;
}

/* Style spécial pour les messages "aucun document" */
.message.bot.no-doc .message-content {
    background: #fff !important;
    color: #666 !important;
    font-style: italic !important;
    border: 1px dashed #ccc !important;
}

/* ============================================
   FORMULAIRE DE CONNEXION - STYLE DESKTOP (par défaut)
   ============================================ */

.crescens-login {
    padding: 0 !important;
    background: white;
    animation: fadeIn 0.5s ease;
    display: none; /* CACHÉ par défaut */
    flex-direction: column;
    flex: 1; /* Prend tout l'espace disponible comme .crescens-messages */
    min-height: 0;
    overflow: hidden;
    justify-content: flex-start !important;
    align-items: stretch;
    position: relative;
    border-top: 1px solid rgba(14, 101, 248, 0.1);
    /* Style desktop par défaut */
    height: 100%; /* NOUVEAU : Prend toute la hauteur */
    max-height: none;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
}

/* NOUVEAU : Animation d'apparition du formulaire */
@keyframes formSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.crescens-container.form-active .crescens-login {
    animation: formSlideIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* HEADER DU FORMULAIRE - STYLE DESKTOP */
.login-header {
    text-align: center;
    margin: 0 !important;
    
    flex-shrink: 0;
    border-bottom: 1px solid rgba(14, 101, 248, 0.1);
    background: #f8fafd;
}

.login-icon {
    width: 60px !important;
    height: 60px !important;
    background: linear-gradient(135deg, #0e65f8 0%, #3d8cff 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px auto !important;
    font-size: 1.5rem !important;
    color: white;
    box-shadow: 0 6px 20px rgba(14, 101, 248, 0.3);
    border: 4px solid white;
}

.login-header h4 {
    margin: 0 0 8px 0 !important;
    color: #0e65f8 !important;
    font-size: 1.2rem !important;
    font-weight: 700;
    position: relative;
    display: inline-block;
}

.login-header h4::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #0e65f8 0%, #3d8cff 100%);
    border-radius: 2px;
}

.login-header p {
    margin: 10px 0 0 0 !important;
    color: #6c757d;
    font-size: 0.85rem !important;
    line-height: 1.4;
    padding: 0;
}

/* FORMULAIRE - STYLE DESKTOP */
#login-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 15px !important;
    margin: 0;
    padding: 20px 25px !important;
    justify-content: space-between; /* NOUVEAU : distribue l'espace */
    overflow-y: auto;
}

/* NOUVEAU : Section pour centrer le formulaire */
.form-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 250px;
    padding: 10px 0;
}

.form-group {
    margin-bottom: 0;
    position: relative;
    flex-shrink: 0;
}

.form-group label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px !important;
    color: #0e65f8 !important;
    font-weight: 600;
    font-size: 0.9rem !important;
    padding-left: 5px;
    opacity: 1 !important;
    visibility: visible !important;
}

.form-group label i {
    color: #0e65f8;
    font-size: 0.95rem !important;
}

#login-form input {
    width: 100% !important;
    padding: 14px 18px !important;
    border: 2px solid #e0e6ef;
    border-radius: 12px !important;
    font-size: 0.95rem !important;
    transition: all 0.3s;
    font-family: 'Raleway', sans-serif;
    background: white;
    color: #1a1f2d;
    box-sizing: border-box;
    height: auto !important;
    min-height: 50px !important;
    line-height: 1.4;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1 !important;
}

#login-form input:focus {
    outline: none;
    border-color: #0e65f8;
    box-shadow: 0 0 0 4px rgba(14, 101, 248, 0.15);
    background: white;
}

#login-form input::placeholder {
    color: #a0aec0;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* BOUTON DE SOUMISSION - DESKTOP */
.crescens-btn {
    width: 100% !important;
    padding: 14px 18px !important;
    background: linear-gradient(135deg, #0e65f8 0%, #3d8cff 100%);
    color: white;
    border: none;
    border-radius: 12px !important;
    font-size: 0.95rem !important;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.4s;
    margin: 10px 0 0 0 !important;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    height: auto !important;
    min-height: 55px !important;
}

/* NOUVEAU : Conteneur pour les actions du formulaire */
.form-actions {
    margin-top: auto;
    flex-shrink: 0;
}

.crescens-btn i {
    font-size: 1rem !important;
}

.crescens-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.crescens-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(14, 101, 248, 0.3);
}

.crescens-btn:hover::before {
    left: 100%;
}

.crescens-btn:active {
    transform: translateY(-1px);
}

.crescens-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.crescens-btn:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* FOOTER COPYRIGHT */
.login-footer, .chat-footer {
    text-align: center;
    
    margin: 0 !important;
    border-top: 1px solid rgba(14, 101, 248, 0.1);
    flex-shrink: 0;
    background: #f8fafd;
}

.copyright-signature {
    text-align: center;
    padding: 8px 0;
}

.signature-line {
    height: 1px;
    background: linear-gradient(90deg, transparent, #0e65f8, transparent);
    margin: 0 auto 10px auto;
    max-width: 180px;
}

.copyright-text {
    color: #0e65f8 !important;
    font-size: 0.8rem !important;
    font-weight: 600;
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.copyright-text i {
    color: #0e65f8;
    font-size: 0.75rem !important;
}

.copyright-sub {
    color: #8a94a6;
    font-size: 0.75rem !important;
    margin: 0;
    font-style: italic;
}

/* Copyright dans la zone de chat */
.chat-copyright {
    color: #8a94a6;
    font-size: 0.7rem;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    opacity: 0.8;
}

.chat-copyright i {
    font-size: 0.65rem;
}

/* Zone de saisie de message */
.crescens-input {
    padding: 12px 15px;
    background: white;
    border-top: 1px solid rgba(14, 101, 248, 0.1);
    box-shadow: 0 -4px 15px rgba(14, 101, 248, 0.05);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

#message-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

#crescens-message {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid rgba(14, 101, 248, 0.2);
    border-radius: 10px;
    font-size: 0.9rem;
    transition: all 0.3s;
    font-family: 'Raleway', sans-serif;
    background: rgba(14, 101, 248, 0.02);
    min-height: 45px;
    max-height: 100px;
    line-height: 1.4;
    resize: none;
    box-sizing: border-box;
}

#crescens-message:focus {
    outline: none;
    border-color: #0e65f8;
    box-shadow: 0 0 0 3px rgba(14, 101, 248, 0.15);
    background: white;
}

#crescens-message::placeholder {
    color: #a0aec0;
    font-style: italic;
}

.send-btn {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #0e65f8 0%, #3d8cff 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.send-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: 0.5s;
}

.send-btn:hover {
    transform: translateY(-2px) rotate(5deg);
    box-shadow: 0 6px 15px rgba(14, 101, 248, 0.3);
}

.send-btn:hover::before {
    left: 100%;
}

.send-btn:active {
    transform: translateY(-1px);
}

.input-actions {
    display: none;
}

/* Indicateur de frappe */
.crescens-typing {
    padding: 12px 15px;
    background: white;
    border-top: 1px solid rgba(14, 101, 248, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideUp 0.3s ease;
    flex-shrink: 0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: linear-gradient(135deg, #0e65f8 0%, #3d8cff 100%);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
    opacity: 0.7;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.crescens-typing span {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

/* Barre de défilement */
.crescens-messages::-webkit-scrollbar {
    width: 6px;
}

.crescens-messages::-webkit-scrollbar-track {
    background: rgba(14, 101, 248, 0.05);
    border-radius: 6px;
    margin: 5px 0;
}

.crescens-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #0e65f8 0%, #3d8cff 100%);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.crescens-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #0a51cc 0%, #2d7cff 100%);
}

/* ============================================
   AFFICHAGE MOBILE WHATSAPP STYLE
   ============================================ */

/* Animation d'ouverture mobile */
@keyframes whatsappSlideIn {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* MOBILE - WHATSAPP STYLE */
@media (max-width: 768px) {
    #crescens-chat {
        position: fixed;
        bottom: 20px;
        right: 20px;
        left: auto;
        display: flex;
        justify-content: flex-end;
        align-items: flex-end;
    }
    
    .crescens-toggle {
        width: 55px;
        height: 55px;
        font-size: 1.4rem;
        position: relative;
        z-index: 100001;
        box-shadow: 0 4px 15px rgba(14, 101, 248, 0.3);
        transition: all 0.3s ease !important;
         bottom: -20px; 
    }
    
    /* Cacher le bouton quand le chat est ouvert */
    .crescens-container.active ~ .crescens-toggle {
        opacity: 0 !important;
        visibility: hidden !important;
        transform: scale(0.8) !important;
        pointer-events: none !important;
    }
    
    /* CONTENEUR FULLSCREEN WHATSAPP */
    .crescens-container {
        position: fixed !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100% !important;
        max-height: 100% !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        top: 0 !important;
        border-radius: 0 !important;
        transform: translateY(100%) !important;
        opacity: 1 !important;
        visibility: visible !important;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        margin: 0 !important;
        z-index: 99999 !important;
        box-shadow: none !important;
        border: none !important;
    }
    
    .crescens-container.active {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        animation: whatsappSlideIn 0.3s ease !important;
    }
    
    /* MOBILE : Pas de classe form-active nécessaire, le formulaire prend tout */
    .crescens-container.form-active {
        transform: translateY(0) !important;
    }
    
    /* Empêcher le scroll du body */
    body.chat-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    /* HEADER MOBILE - THÈME BLEU */
    .crescens-header {
        padding: 15px !important;
        border-radius: 0 !important;
        min-height: 70px !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
        background: linear-gradient(135deg, #0e65f8 0%, #0a51cc 100%) !important;
    }
    
    .crescens-avatar {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.2rem !important;
        background: rgba(255, 255, 255, 0.2) !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
    }
    
    .crescens-title h3 {
        font-size: 1.1rem !important;
        margin: 0 !important;
        color: white !important;
    }
    
    .crescens-status {
        font-size: 0.8rem !important;
        margin-top: 2px !important;
        color: rgba(255, 255, 255, 0.9) !important;
    }
    
    .crescens-status::before {
        background: #2ed573 !important;
        box-shadow: 0 0 10px #2ed573 !important;
    }
    
    .crescens-close {
        width: 35px !important;
        height: 35px !important;
        font-size: 1rem !important;
        background: rgba(255, 255, 255, 0.1) !important;
    }
    
    /* ZONE MESSAGES MOBILE */
    .crescens-messages {
        padding: 15px 15px 100px 15px !important;
        gap: 8px !important;
        flex: 1 !important;
        min-height: 200px !important;
        overflow-y: auto !important;
        background: #f8fafd !important;
        background-image: none !important;
    }
    
    .message {
        max-width: 85% !important;
        margin-bottom: 8px !important;
    }
    
    .message-content {
        padding: 10px 14px !important;
        font-size: 0.95rem !important;
        line-height: 1.4 !important;
        box-shadow: 0 1px 0.5px rgba(0,0,0,0.13) !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    }
    
    .message.user .message-content {
        background: linear-gradient(135deg, #0e65f8 0%, #3d8cff 100%) !important;
        color: white !important;
        border-radius: 7.5px 7.5px 0 7.5px !important;
        border: none !important;
        margin-left: auto !important;
    }
    
    .message.bot .message-content {
        background: white !important;
        color: #000 !important;
        border-radius: 7.5px 7.5px 7.5px 0 !important;
        border: 1px solid rgba(14, 101, 248, 0.1) !important;
        margin-right: auto !important;
    }
    
    .message.bot.no-doc .message-content {
        background: #fff !important;
        color: #666 !important;
        font-style: italic !important;
        border: 1px dashed #ccc !important;
    }
    
    .message-time {
        font-size: 0.65rem !important;
        color: #999 !important;
        margin-top: 4px !important;
    }
    
    /* ZONE DE SAISIE MOBILE */
    .crescens-input {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        background: white !important;
        z-index: 1000 !important;
        padding: 10px 15px !important;
        border-top: 1px solid rgba(14, 101, 248, 0.1) !important;
        box-shadow: 0 -4px 15px rgba(14, 101, 248, 0.05) !important;
        border-radius: 0 !important;
    }
    
    #message-form {
        gap: 10px !important;
    }
    
    .input-wrapper {
        gap: 8px !important;
    }
    
    #crescens-message {
        padding: 12px 15px !important;
        font-size: 1rem !important;
        min-height: 45px !important;
        line-height: 1.3 !important;
        background: rgba(14, 101, 248, 0.02) !important;
        border: 1px solid rgba(14, 101, 248, 0.2) !important;
        border-radius: 10px !important;
        box-shadow: none !important;
    }
    
    #crescens-message:focus {
        border-color: #0e65f8 !important;
        box-shadow: 0 0 0 3px rgba(14, 101, 248, 0.15) !important;
    }
    
    .send-btn {
        width: 45px !important;
        height: 45px !important;
        font-size: 1.1rem !important;
        background: linear-gradient(135deg, #0e65f8 0%, #3d8cff 100%) !important;
        border-radius: 10px !important;
        box-shadow: none !important;
    }
    
    .send-btn:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 6px 15px rgba(14, 101, 248, 0.3) !important;
    }
    
    /* LOGIN MOBILE - FORMULAIRE MOBILE */
    .crescens-login {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        padding: 0 !important;
        background: #f8fafd !important;
        border-top: none !important;
        overflow-y: auto !important;
        min-height: auto !important;
    }
    
    .login-header {
        margin: 0 !important;
       
        margin-top: 70px !important;
    }
    
    .login-icon {
        width: 70px !important;
        height: 70px !important;
        font-size: 1.8rem !important;
        margin-bottom: 15px !important;
        background: linear-gradient(135deg, #0e65f8 0%, #3d8cff 100%) !important;
    }
    
    .login-header h4 {
        font-size: 1.4rem !important;
        color: #0e65f8 !important;
    }
    
    .login-header h4::after {
        background: linear-gradient(90deg, #0e65f8 0%, #3d8cff 100%) !important;
    }
    
    .login-header p {
        font-size: 0.95rem !important;
        color: #6c757d !important;
    }
    
    #login-form {
        padding: 25px 20px !important;
        gap: 20px !important;
        margin-bottom: 0 !important;
        justify-content: flex-start !important;
    }
    
    .form-group label {
        font-size: 0.95rem !important;
        color: #0e65f8 !important;
    }
    
    #login-form input {
        padding: 16px 20px !important;
        font-size: 1rem !important;
        background: white !important;
        border: 2px solid #e0e6ef !important;
        border-radius: 12px !important;
        min-height: 55px !important;
    }
    
    #login-form input:focus {
        border-color: #0e65f8 !important;
        box-shadow: 0 0 0 4px rgba(14, 101, 248, 0.15) !important;
    }
    
    .crescens-btn {
        padding: 16px 20px !important;
        font-size: 1rem !important;
        background: linear-gradient(135deg, #0e65f8 0%, #3d8cff 100%) !important;
        border-radius: 12px !important;
        margin-top: 15px !important;
        min-height: 60px !important;
    }
    
    .login-footer {
        padding: 15px 20px !important;
        margin-top: 0 !important;
        border-top: 1px solid rgba(14, 101, 248, 0.1) !important;
    }
    
    .copyright-text {
        font-size: 0.85rem !important;
        color: #0e65f8 !important;
    }
    
    .copyright-sub {
        font-size: 0.8rem !important;
        color: #8a94a6 !important;
    }
    
    .chat-copyright {
        font-size: 0.65rem !important;
        color: #8a94a6 !important;
        opacity: 0.9 !important;
    }
    
    /* TYPING MOBILE */
    .crescens-typing {
        position: fixed !important;
        bottom: 70px !important;
        left: 15px !important;
        background: white !important;
        border-radius: 18px !important;
        padding: 8px 12px !important;
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08) !important;
        border: 1px solid rgba(14, 101, 248, 0.1) !important;
        width: auto !important;
        max-width: 200px !important;
        animation: slideUp 0.3s ease !important;
    }
    
    .typing-dots span {
        background: linear-gradient(135deg, #0e65f8 0%, #3d8cff 100%) !important;
    }
    
    .crescens-typing span {
        font-size: 0.85rem !important;
        color: #6c757d !important;
    }
    
    /* SCROLLBAR MOBILE */
    .crescens-messages::-webkit-scrollbar {
        width: 4px !important;
    }
    
    .crescens-messages::-webkit-scrollbar-thumb {
        background: linear-gradient(to bottom, #0e65f8 0%, #3d8cff 100%) !important;
        border-radius: 2px !important;
    }
}

/* Très petits mobiles */
@media (max-width: 480px) {
    #crescens-chat {
        bottom: 5px;
        right: 15px;
    }
    
    .crescens-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.3rem; 
        bottom: 70px;
    }
    
    .crescens-header {
        padding: 12px 15px !important;
        min-height: 65px !important;
    }
    
    .crescens-avatar {
        width: 35px !important;
        height: 35px !important;
        font-size: 1.1rem !important;
    }
    
    .crescens-title h3 {
        font-size: 1rem !important;
    }
    
    .crescens-status {
        font-size: 0.75rem !important;
    }
    
    .crescens-messages {
        padding: 12px 12px 90px 12px !important;
    }
    
    .crescens-input {
        padding: 8px 12px !important;
    }
    
    #crescens-message {
        padding: 10px 12px !important;
        min-height: 42px !important;
        font-size: 16px !important;
    }
    
    .send-btn {
        width: 42px !important;
        height: 42px !important;
        font-size: 1rem !important;
    }
    
    .login-icon {
        width: 60px !important;
        height: 60px !important;
        font-size: 1.5rem !important;
    }
    
    .login-header h4 {
        font-size: 1.2rem !important;
    }
    
    .login-header p {
        font-size: 0.85rem !important;
    }
    
    #login-form {
        padding: 20px 15px !important;
        gap: 15px !important;
    }
    
    #login-form input {
        padding: 14px 16px !important;
        font-size: 16px !important;
        min-height: 50px !important;
    }
    
    .crescens-btn {
        padding: 14px 16px !important;
        font-size: 0.9rem !important;
        min-height: 55px !important;
    }
    
    .copyright-text {
        font-size: 0.75rem !important;
    }
    
    .copyright-sub {
        font-size: 0.7rem !important;
    }
    
    /* Ajustement du formulaire sur très petits mobiles */
    .crescens-login {
        margin-top: 0 !important;
    }
    
    .login-header {
        margin-top: 65px !important;
        padding: 20px 15px 15px 15px !important;
    }
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
    .crescens-container {
        background: #1a1f2d;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .crescens-messages {
        background: #161a25;
    }
    
    .message.bot .message-content {
        background: #2d3748;
        color: #e2e8f0;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .crescens-login {
        background: #1a1f2d;
        border-top-color: rgba(255, 255, 255, 0.1);
    }
    
    .login-header {
        background: #1a1f2d;
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .login-header h4 {
        color: #3d8cff !important;
    }
    
    .login-header p {
        color: #a0aec0;
    }
    
    #login-form input {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    #login-form input:focus {
        background: #2d3748;
        border-color: #0e65f8;
    }
    
    .crescens-input {
        background: #1a1f2d;
        border-top-color: rgba(255, 255, 255, 0.1);
    }
    
    #crescens-message {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    #crescens-message:focus {
        background: #2d3748;
    }
    
    .crescens-typing {
        background: #1a1f2d;
        border-top-color: rgba(255, 255, 255, 0.1);
    }
    
    .crescens-typing span {
        color: #a0aec0;
    }
    
    .login-footer {
        background: #1a1f2d;
    }
    
    .copyright-text {
        color: #3d8cff !important;
    }
    
    .form-group label {
        color: #3d8cff !important;
    }
}

/* Animations réduites */
@media (prefers-reduced-motion: reduce) {
    .crescens-container,
    .crescens-toggle,
    .message,
    .crescens-btn,
    .send-btn,
    .crescens-close {
        transition: none !important;
        animation: none !important;
    }
}

/* Notifications */
.crescens-notif {
    position: fixed;
    top: 25px;
    right: 25px;
    background: linear-gradient(135deg, #0e65f8 0%, #3d8cff 100%);
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    z-index: 100001;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    animation: notifSlideIn 0.3s ease;
    font-size: 0.9rem;
    max-width: 300px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes notifSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.crescens-notif.success {
    background: linear-gradient(135deg, #2ed573 0%, #1dd1a1 100%);
}

.crescens-notif.error {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}

.crescens-notif.warning {
    background: linear-gradient(135deg, #ff9f43 0%, #ff9f1a 100%);
}

.crescens-notif.info {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

/* Accessibilité */
.crescens-toggle:focus-visible,
#crescens-message:focus-visible,
#login-form input:focus-visible,
.crescens-btn:focus-visible,
.send-btn:focus-visible {
    outline: 2px solid #0e65f8;
    outline-offset: 2px;
}

/* Correction iOS */
@supports (-webkit-touch-callout: none) {
    .crescens-container {
        max-height: -webkit-fill-available !important;
    }
    
    .crescens-messages {
        padding-bottom: 130px !important;
    }
    
    /* Éviter le zoom sur focus iOS */
    @media screen and (max-width: 768px) {
        input, textarea {
            font-size: 16px !important;
        }
    }
}

/* Impression */
@media print {
    #crescens-chat {
        display: none !important;
    }
}

/* ============================================
   CORRECTIONS CRITIQUES POUR LE FORMULAIRE
   ============================================ */

/* FIX: Assurer la visibilité des champs */
#crescens-name, #crescens-email {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1 !important;
    background: white !important;
    color: #1a1f2d !important;
    border: 2px solid #e0e6ef !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

/* FIX: Container reste visible */
.crescens-container.active {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
}

/* FIX: Transition contrôlée */
.crescens-container {
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease !important;
}

/* FIX: Display properties forcés */
#crescens-login {
    display: flex !important;
}

#crescens-login[style*="display: none"] {
    display: none !important;
}

#crescens-input {
    display: none !important;
} 

#crescens-input[style*="display: block"] {
    display: block !important;
}

/* FIX: S'assurer que tout est visible dans le formulaire */
#crescens-login * {
    opacity: 1 !important;
    visibility: visible !important;
}

.form-group {
    display: block !important;
}

/* Ajustements pour écrans hauts et bas */
@media (min-width: 769px) and (max-height: 700px) {
    .crescens-container {
        height: 450px;
    }
}

@media (min-width: 769px) and (min-height: 800px) {
    .crescens-container {
        height: 650px;
    }
}