/* Chat Widget Styles */
#chat-widget {
    position: fixed;
    bottom: 30px;
    right: 20px;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 500px;
}

@media only screen and (max-width: 600px) {
    #chat-widget {
        bottom: 20px;
        right: 20px;
        width: 320px;
        max-height: 500px;
    }
}

/* Header ajusté pour plus d'espace */
.chat-header {
    background: linear-gradient(90deg, #a70456, #e11b37);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    min-height: 60px;
}

/* Titre compact */
.chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
}

/* Afficher le texte du titre sur ordinateur */
.chat-title-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Afficher le statut admin sur ordinateur */
.admin-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.8;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.online {
    background-color: #22c55e;
    box-shadow: 0 0 6px #22c55e;
}

.status-indicator.offline {
    background-color: #ef4444;
}

.status-text {
    font-weight: 500;
}

.unread-badge {
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
}

.chat-actions {
    display: flex;
    gap: 5px;
}

.chat-toggle {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: background 0.2s;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-toggle:hover {
    background: rgba(255,255,255,0.3);
}

/* Icône de chat dans le header */
.chat-icon {
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Body (caché par défaut) */
.chat-body {
    display: none;
    flex: 1;
    flex-direction: column;
    background: #f0f0f0;
    height: 350px;
    max-height: 350px;
    position: relative;
}

/* Zone principale du chat */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 350px; /* Hauteur fixe pour stabilité */
    background: #fff;
}

.chat-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0; /* ESSENTIEL pour le scroll */
    justify-content: flex-start; /* CHANGÉ de flex-end à start */
    height: auto; /* Supprimer toute hauteur fixe */
}

/* Input Area - COLLÉ EN BAS */
.chat-input-area {
    padding: 12px;
    border-top: 1px solid #e5e7eb;
    background: white;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    min-height: 60px;
    position: sticky;
    bottom: 0;
    z-index: 10;
    align-self: flex-end; /* Renforce la position en bas */
}

#chat-message-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 10px 12px;
    resize: none;
    font-family: inherit;
    font-size: 13px;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.4;
}

#chat-message-input:focus {
    border-color: #a70456;
}

#chat-send-btn, #chat-attach-btn {
    background: linear-gradient(90deg, #a70456, #e11b37);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

#chat-send-btn:hover, #chat-attach-btn:hover {
    opacity: 0.9;
}

#chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Messages */
.message {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 18px;
    position: relative;
    animation: fadeIn 0.3s ease;
    word-wrap: break-word;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    align-self: flex-end;
    background: linear-gradient(135deg, #a70456, #e11b37);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.admin-message {
    align-self: flex-start;
    background: white;
    color: #333;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message-content {
    margin-bottom: 4px;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 13px;
}

.message-time {
    font-size: 10px;
    opacity: 0.7;
    text-align: right;
}

.admin-message .message-time {
    text-align: left;
}

/* File Messages */
.file-message {
    margin: 4px 0;
}

.file-message img {
    max-width: 180px;
    max-height: 180px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    display: block;
}

.file-message img:hover {
    transform: scale(1.02);
}

.audio-message audio {
    width: 220px;
    height: 35px;
}

.document-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    font-size: 13px;
}

.user-message .document-message {
    background: rgba(255,255,255,0.2);
}

.download-link {
    color: inherit;
    text-decoration: none;
    font-size: 11px;
    opacity: 0.8;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

.download-link:hover {
    opacity: 1;
}

/* Image Modal */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.modal-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading and Empty States */
.loading-message, .no-messages {
    text-align: center;
    color: #6b7280;
    padding: 15px;
    font-style: italic;
    width: 100%;
    font-size: 13px;
}

/* Scrollbar personnalisée */
.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Indicateur en ligne admin */
#admin-online-indicator {
    margin-left: auto;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* ===== STYLES MOBILES AMÉLIORÉS ===== */
@media (max-width: 768px) {
    #chat-widget {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        max-height: 60px;
        transition: all 0.3s ease;
    }
    
    .chat-header {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        padding: 0;
        justify-content: center;
        align-items: center;
        min-height: auto;
    }
    
    .chat-title,
    .chat-title-text,
    .admin-status {
        display: none;
    }
    
    .chat-toggle {
        width: 60px;
        height: 60px;
        background: transparent;
        border: none;
        font-size: 24px;
        margin: 0;
        padding: 0;
    }
    
    .unread-badge {
        position: absolute;
        top: -2px;
        right: -2px;
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
    
    #chat-widget.chat-open {
        width: calc(100vw - 30px);
        height: auto;
        border-radius: 16px;
        max-height: 80vh;
        bottom: 15px;
        right: 15px;
        left: 15px;
    }
    
    #chat-widget.chat-open .chat-header {
        width: 100%;
        height: auto;
        border-radius: 16px 16px 0 0;
        padding: 15px 20px;
        min-height: 60px;
        justify-content: space-between;
    }
    
    #chat-widget.chat-open .chat-title,
    #chat-widget.chat-open .chat-title-text,
    #chat-widget.chat-open .admin-status {
        display: flex;
    }
    
    #chat-widget.chat-open .chat-toggle {
        width: 35px;
        height: 35px;
        background: rgba(255,255,255,0.2);
        font-size: 16px;
    }
    
    #chat-widget.chat-open .unread-badge {
        position: static;
        width: 20px;
        height: 20px;
        font-size: 11px;
    }
    
    #chat-widget.chat-open .chat-body {
        display: flex;
    }
    
    .chat-body {
        height: 60vh;
        max-height: 60vh;
    }
    
    .chat-main {
        height: 60vh;
        max-height: 60vh;
    }
    
    .chat-messages {
        height: calc(60vh - 70px);
        max-height: calc(60vh - 70px);
        padding: 10px;
        gap: 6px;
    }
    
    .message {
        max-width: 92%;
        padding: 10px 14px;
    }
    
    .message-content {
        font-size: 14px;
    }
    
    .file-message img {
        max-width: 150px;
        max-height: 150px;
    }
    
    .audio-message audio {
        width: 200px;
        height: 40px;
    }
    
    .chat-input-area {
        padding: 10px 12px;
        min-height: 55px;
        gap: 6px;
    }
    
    #chat-message-input {
        font-size: 14px;
        padding: 12px 14px;
    }
    
    #chat-send-btn, #chat-attach-btn {
        width: 40px;
        height: 40px;
    }
    
    .conversations-sidebar {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 25;
        background: white;
        border-radius: 16px;
    }
}

/* Pour les très petits écrans */
@media (max-width: 360px) {
    #chat-widget {
        width: 55px;
        height: 55px;
        right: 10px;
        bottom: 10px;
    }
    
    .chat-header {
        width: 55px;
        height: 55px;
    }
    
    .chat-toggle {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
    
    #chat-widget.chat-open {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 10px;
        left: 10px;
        max-height: 85vh;
    }
    
    .chat-body {
        height: 65vh;
        max-height: 65vh;
    }
    
    .chat-main {
        height: 65vh;
        max-height: 65vh;
    }
    
    .chat-messages {
        height: calc(65vh - 70px);
        max-height: calc(65vh - 70px);
    }
    
    .message {
        max-width: 95%;
    }
    
    .file-message img {
        max-width: 130px;
    }
}

/* ===== STYLES DESKTOP ===== */
@media (min-width: 769px) {
    #chat-widget {
        width: 320px;
        height: auto;
        border-radius: 12px;
        max-height: 500px;
    }
    
    .chat-header {
        width: 100%;
        height: auto;
        border-radius: 12px 12px 0 0;
        padding: 15px 20px;
        min-height: 60px;
        justify-content: space-between;
    }
    
    .chat-title,
    .chat-title-text,
    .admin-status {
        display: flex;
    }
    
    .chat-toggle {
        width: 35px;
        height: 35px;
        background: rgba(255,255,255,0.2);
        font-size: 16px;
    }
    
    .unread-badge {
        position: static;
    }
    
    .chat-body {
        display: none;
    }
    
    #chat-widget.chat-open .chat-body {
        display: flex;
    }
}

/* Styles pour l'infobulle mobile */
.chat-tooltip {
    position: fixed;
    z-index: 10001;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    padding: 0;
    max-width: 280px;
    animation: tooltipFadeIn 0.3s ease;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tooltip-content {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    gap: 10px;
    position: relative;
}

.tooltip-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(90deg, #a70456, #e11b37);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.tooltip-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tooltip-text strong {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.tooltip-text span {
    font-size: 12px;
    color: #666;
    line-height: 1.3;
}

.tooltip-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.tooltip-close:hover {
    background: #f5f5f5;
    color: #666;
}

.tooltip-arrow {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
}

/* Ajustements pour mobile */
@media (max-width: 768px) {
    .chat-tooltip {
        max-width: 250px;
    }
    
    .tooltip-content {
        padding: 10px 12px;
    }
    
    .tooltip-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .tooltip-text strong {
        font-size: 13px;
    }
    
    .tooltip-text span {
        font-size: 11px;
    }
}

/* Pour les très petits écrans */
@media (max-width: 360px) {
    .chat-tooltip {
        max-width: 220px;
    }
}

/* ===== STYLES HISTORIQUE DES CONVERSATIONS ===== */
.chat-history-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.3s;
    margin-right: 8px;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-history-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.conversations-sidebar {
    width: 100%;
    background: #f8f9fa;
    display: none;
    flex-direction: column;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 20;
}

.conversations-header {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    background: #fff;
    flex-shrink: 0;
}

.conversations-header h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

/* BOUTON NEW CHAT RESPONSIVE */
.new-chat-btn {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(90deg, #a70456, #e11b37);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    min-height: 44px; /* Taille tactile minimale */
}

.new-chat-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(167, 4, 86, 0.3);
}

.new-chat-btn:active {
    transform: translateY(0);
}

/* Icône dans le bouton */
.new-chat-btn i {
    font-size: 16px;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.conversation-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    background: #fff;
}

.conversation-item:hover {
    background-color: #e9ecef;
}

.conversation-item.active {
    background-color: #e3f2fd;
    border-left: 3px solid #1976d2;
}

.conversation-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(90deg, #a70456, #e11b37);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 12px;
    flex-shrink: 0;
    font-size: 16px;
}

.conversation-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.conversation-title {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-time {
    font-size: 11px;
    color: #666;
    white-space: nowrap;
    margin-left: 8px;
}

.conversation-preview {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.conversation-unread {
    background: #ff4444;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
    margin-left: 8px;
}

/* États vides */
.no-conversations {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: #fff;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.no-conversations i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 15px;
}

.no-conversations p {
    margin: 0 0 5px 0;
    font-weight: 500;
    font-size: 16px;
}

.no-conversations small {
    font-size: 12px;
    color: #999;
}

.loading-conversations {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: #fff;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loading-conversations i {
    font-size: 24px;
    margin-bottom: 15px;
    color: #a70456;
}

.loading-conversations p {
    margin: 0;
    font-size: 14px;
}

/* Scrollbar personnalisée pour la sidebar */
.conversations-list::-webkit-scrollbar {
    width: 6px;
}

.conversations-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.conversations-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.conversations-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ===== RESPONSIVE POUR NEW-CHAT-BTN ===== */
@media (max-width: 768px) {
    .conversations-sidebar {
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 20;
        background: white;
        height: 100%;
        border-radius: 16px;
    }
    
    .conversations-header {
        padding: 15px;
        border-radius: 16px 16px 0 0;
    }
    
    .conversations-header h3 {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    /* BOUTON NEW CHAT MOBILE */
    .new-chat-btn {
        padding: 14px 18px;
        font-size: 16px;
        font-weight: 600;
        border-radius: 10px;
        min-height: 50px;
        gap: 10px;
        box-shadow: 0 2px 8px rgba(167, 4, 86, 0.2);
    }
    
    .new-chat-btn i {
        font-size: 18px;
    }
    
    .conversation-item {
        padding: 14px 15px;
        min-height: 60px;
    }
    
    .conversation-avatar {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .conversation-title {
        font-size: 16px;
    }
    
    .conversation-preview {
        font-size: 14px;
    }
    
    .conversation-time {
        font-size: 12px;
    }
    
    .chat-main {
        width: 100%;
    }
}

/* Pour les très petits écrans */
@media (max-width: 360px) {
    .conversations-sidebar {
        width: 100vw;
    }
    
    .conversations-header {
        padding: 12px 15px;
    }
    
    .conversations-header h3 {
        font-size: 17px;
    }
    
    .new-chat-btn {
        padding: 12px 16px;
        font-size: 15px;
        min-height: 48px;
    }
    
    .new-chat-btn i {
        font-size: 17px;
    }
    
    .conversation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    .conversation-time {
        margin-left: 0;
        font-size: 11px;
    }
}

/* Support orientation paysage sur mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .conversations-sidebar {
        max-height: 80vh;
        overflow: hidden;
    }
    
    .conversations-list {
        max-height: calc(80vh - 120px);
    }
    
    .new-chat-btn {
        padding: 10px 14px;
        min-height: 44px;
        font-size: 14px;
    }
}

/* Animation pour les nouveaux messages */
.conversation-item.new-message {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { background-color: #fff; }
    50% { background-color: #e8f5e8; }
    100% { background-color: #fff; }
}

/* Animation de chargement */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.conversation-item {
    animation: fadeIn 0.3s ease;
}

/* Cacher le bouton historique quand le chat est fermé */
#chat-widget:not(.chat-open) .chat-history-btn {
    display: none;
}

/* Afficher le bouton historique seulement quand le chat est ouvert */
#chat-widget.chat-open .chat-history-btn {
    display: flex;
}

/* États de focus pour accessibilité */
.new-chat-btn:focus {
    outline: 2px solid #a70456;
    outline-offset: 2px;
}

/* Désactivé state */
.new-chat-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.new-chat-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

.conversation-item {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.conversation-item:hover {
    background-color: #f5f5f5;
}

.conversation-item.active {
    background-color: #e9ecef;
    border-left: 3px solid #a70456;
}

.new-chat-btn {
    cursor: pointer;
}

/* Styles pour le formulaire d'information visiteur - CORRIGÉ */
.visitor-info-form {
    background: white;
    border-radius: 12px;
    margin: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: none;
    flex-direction: column;
    height: auto;
    min-height: 280px;
}

.visitor-form-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.visitor-form-content p {
    margin: 0 0 15px 0;
    color: #666;
    text-align: center;
    line-height: 1.4;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 0.85rem;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #A70456;
    box-shadow: 0 0 0 3px rgba(167, 4, 86, 0.1);
}

.form-group input.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.form-group input.valid {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.error-message {
    color: #dc3545;
    font-size: 0.75rem;
    margin-top: 4px;
    display: block;
}

.form-actions {
    margin-top: 20px;
    flex-shrink: 0;
}

.submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #6B0F1A 0%, #A70456 50%, #E11B37 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(167, 4, 86, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

/* Styles pour les messages de bienvenue */
.welcome-message {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 12px;
    margin: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    height: auto;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.welcome-message.success {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.welcome-icon {
    font-size: 2rem;
    color: #A70456;
    margin-bottom: 10px;
}

.welcome-message.success .welcome-icon {
    color: #28a745;
}

.welcome-message h3 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 1.1rem;
}

.welcome-message p {
    margin: 0 0 15px 0;
    color: #666;
    line-height: 1.4;
    font-size: 0.9rem;
}

.welcome-tips {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.tip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(167, 4, 86, 0.05);
    border-radius: 6px;
    font-size: 0.8rem;
    color: #555;
}

.tip i {
    color: #A70456;
    font-size: 0.9rem;
}

/* CORRECTIONS POUR LA VISIBILITÉ */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* CORRECTION : Gestion de l'affichage formulaire vs zone de saisie */
.visitor-info-form {
    display: none;
}

#chat-input-area {
    display: flex;
}

/* Quand le formulaire est affiché */
.visitor-info-form.show {
    display: flex;
}

.visitor-info-form.show ~ #chat-input-area {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .visitor-info-form {
        margin: 10px;
        min-height: 240px;
    }
    
    .visitor-form-content {
        padding: 15px;
    }
    
    .welcome-message {
        margin: 10px;
        padding: 15px;
        min-height: 100px;
    }
    
    .form-group input {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    .submit-btn {
        padding: 9px 14px;
        font-size: 0.85rem;
    }
    
    .welcome-icon {
        font-size: 1.8rem;
    }
    
    .welcome-message h3 {
        font-size: 1rem;
    }
}

/* Pour les très petits écrans */
@media (max-width: 360px) {
    .visitor-info-form {
        margin: 8px;
        min-height: 220px;
    }
    
    .visitor-form-content {
        padding: 12px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-group input {
        padding: 7px 9px;
        font-size: 0.8rem;
    }
    
    .submit-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .welcome-message {
        margin: 8px;
        padding: 12px;
        min-height: 90px;
    }
    
    .welcome-icon {
        font-size: 1.6rem;
    }
}

/* Style pour l'état "Aucun message" */
.no-messages {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
    background: white;
    border-radius: 8px;
    margin: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.no-messages i {
    font-size: 2rem;
    color: #ddd;
    margin-bottom: 10px;
    display: block;
}

.no-messages p {
    margin: 0;
    font-size: 14px;
}