/* Widget de chat */
#ec-chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #0066cc;
    color: white;
    padding: 15px 20px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    z-index: 9998;
    transition: all 0.3s ease;
}

#ec-chat-button:hover {
    background: #0052a3;
    box-shadow: 0 6px 16px rgba(0, 102, 204, 0.5);
    transform: translateY(-2px);
}

#ec-chat-button svg {
    width: 24px;
    height: 24px;
}

#ec-chat-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 40px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    font-family: Arial, sans-serif;
    transition: all 0.3s ease;
}

.ec-chat-hidden {
    display: none !important;
}

/* Header */
.ec-chat-header {
    background: #0066cc;
    color: white;
    padding: 16px 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ec-chat-title {
    font-size: 16px;
    font-weight: 600;
}

.ec-chat-actions {
    display: flex;
    gap: 8px;
    padding: unset;
}

.ec-chat-actions button { 
    background: rgba(255, 255, 255, 0.2); 
    border: none; 
    color: white; 
    width: 28px; 
    height: 28px; 
    border-radius: 4px; 
    cursor: pointer; 
    font-size: 18px; 
    /* Ligne modifiée/ajoutée pour centrer */ 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    /* Fin des modifications */ 
    line-height: 1; /* Conservez-le, mais le flexbox prime */ 
    transition: background 0.2s; 
}  

.ec-chat-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Body */
.ec-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
    background: #f5f5f5;
    position: relative;
}

/* Welcome screen */
.ec-chat-welcome h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #333;
}

.ec-chat-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ec-chat-form input,
.ec-chat-form select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    height: auto;
}

.ec-chat-form label {
    font-size: 13px;
    color: #666;
    margin-top: 8px;
}

.ec-chat-form button {
    background: #0066cc;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.ec-chat-form button:hover {
    background: #0052a3;
}

/* Messages */
.ec-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
}

.ec-chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
}

.ec-chat-message-client {
    align-self: flex-end;
    background: #0066cc;
    color: white;
    border-bottom-right-radius: 4px;
}

.ec-chat-message-operator {
    align-self: flex-start;
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ec-chat-message-system {
    align-self: center;
    background: #ffe9b3;
    color: #856404;
    font-size: 12px;
    padding: 8px 12px;
    text-align: center;
    max-width: 90%;
}

.ec-chat-message-content {
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 1.4;
}

.ec-chat-message-image {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 6px;
    cursor: pointer;
}

.ec-chat-message-file {
    display: inline-block;
    background: #f0f0f0;
    color: #0066cc;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 6px;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.2s;
}

.ec-chat-message-file:hover {
    background: #e0e0e0;
    text-decoration: underline;
}

.ec-chat-message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

/* Waiting state */
.ec-chat-waiting {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #666;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.ec-chat-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #0066cc;
    border-radius: 50%;
    animation: ec-spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes ec-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ec-chat-waiting p {
    margin-bottom: 16px;
}

.ec-chat-secondary-btn {
    background: white;
    color: #0066cc;
    border: 1px solid #0066cc;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ec-chat-secondary-btn:hover {
    background: #f0f7ff;
}

/* Closed screen */
.ec-chat-closed {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 30px;
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
    max-width: 300px;
}

.ec-chat-closed-icon {
    width: 60px;
    height: 60px;
    background: #4caf50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 16px;
}

.ec-chat-closed h3 {
    color: #333;
    font-size: 18px;
    margin-bottom: 8px;
}

.ec-chat-closed p {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.4;
}

.ec-chat-primary-btn {
    background: #0066cc;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.ec-chat-primary-btn:hover {
    background: #0052a3;
}

/* Input area */
.ec-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 12px 12px;
}

.ec-chat-input-area button {
    background: #f0f0f0;
    border: none;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 16px;
}

.ec-chat-input-area button:hover {
    background: #e0e0e0;
}

.ec-chat-input-area #ec-chat-send {
    background: #0066cc;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.ec-chat-input-area #ec-chat-send:hover {
    background: #0052a3;
}

.ec-chat-input-area input[type="text"] {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

.ec-chat-input-area input[type="text"]:focus {
    outline: none;
    border-color: #0066cc;
}

/* Footer */
.ec-chat-footer {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: center;
}

.ec-chat-end-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.ec-chat-end-btn:hover {
    background: #c82333;
}

/* Responsive */
@media (max-width: 480px) {
    #ec-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
        bottom: 10px;
        right: 10px;
    }

    #ec-chat-button {
        bottom: 10px;
        right: 10px;
    }
}
