/* =========================
   CHATBOT PUBLIC - STYLES
   ========================= */

/* Widget flottant */
.public-chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Poppins', sans-serif;
    display: none; /* Caché par défaut */
}

/* Bouton d'ouverture */
.public-chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FDA307 0%, #FC9D0B 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(253, 163, 7, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    transition: all 0.3s ease;
    position: relative;
}

.public-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.public-chatbot-toggle::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0;
    }
}

.public-chatbot-toggle.active {
    background: linear-gradient(135deg, #FC9D0B 0%, #FDA307 100%);
    box-shadow: 0 6px 20px rgba(253, 163, 7, 0.45);
}

/* Badge de notification */
.public-chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #FDA307;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Container du chat */
.public-chatbot-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.public-chatbot-container.active {
    display: flex;
}

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

/* Header du chat */
.public-chatbot-header {
    background: linear-gradient(135deg, #50CEDB 0%, #6191DA 50%, #5F8FD8 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.public-chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.public-chatbot-header-actions {
    display: flex;
    gap: 10px;
}

.public-chatbot-header-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.public-chatbot-header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Zone de messages */
.public-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.public-chatbot-message {
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: fadeIn 0.3s ease;
    width: 100%;
    margin-bottom: 12px;
}

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

.public-chatbot-message.user {
    align-items: flex-end;
}

.public-chatbot-message.user .public-chatbot-message-wrapper {
    display: flex;
    flex-direction: row-reverse;
    gap: 10px;
    align-items: flex-start;
    max-width: 85%;
    margin-left: auto;
}

.public-chatbot-message.assistant {
    align-items: flex-start;
}

.public-chatbot-message.assistant .public-chatbot-message-wrapper {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: flex-start;
    max-width: 85%;
}

.public-chatbot-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.public-chatbot-message-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.public-chatbot-message.user .public-chatbot-message-avatar {
    background: linear-gradient(135deg, #50CEDB 0%, #6191DA 50%, #5F8FD8 100%);
    color: white;
}

.public-chatbot-message.assistant .public-chatbot-message-avatar {
    background: #e9ecef;
    color: #495057;
}

.public-chatbot-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
}

.public-chatbot-message.user .public-chatbot-message-content {
    background: linear-gradient(135deg, #50CEDB 0%, #6191DA 50%, #5F8FD8 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.public-chatbot-message.assistant .public-chatbot-message-content {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
    flex: 1;
}

/* Message de bienvenue */
.public-chatbot-welcome {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

.public-chatbot-welcome h4 {
    margin: 0 0 8px 0;
    color: #495057;
    font-size: 16px;
}

.public-chatbot-welcome p {
    margin: 0;
    font-size: 14px;
}

/* Indicateur de frappe */
.public-chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.public-chatbot-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6c757d;
    animation: typing 1.4s infinite;
}

.public-chatbot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.public-chatbot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Zone de saisie */
.public-chatbot-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.public-chatbot-input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    resize: none;
    max-height: 100px;
    min-height: 44px;
}

.public-chatbot-input:focus {
    outline: none;
    border-color: #6191DA;
    box-shadow: 0 0 0 3px rgba(97, 145, 218, 0.1);
}

.public-chatbot-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #50CEDB 0%, #6191DA 50%, #5F8FD8 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.public-chatbot-send-btn:hover:not(:disabled) {
    transform: scale(1.1);
}

.public-chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Boutons CTA */
.public-chatbot-cta {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 85%;
    align-self: flex-start;
}

.public-chatbot-cta-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #FDA307 0%, #FC9D0B 100%);
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: white;
    display: block;
    text-align: center;
    box-shadow: 0 2px 8px rgba(253, 163, 7, 0.3);
}

.public-chatbot-cta-btn:hover {
    background: linear-gradient(135deg, #FC9D0B 0%, #FDA307 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(253, 163, 7, 0.4);
}

.public-chatbot-cta-btn:active {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .public-chatbot-container {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 80px;
        right: 10px;
        left: 10px;
        max-width: none;
        max-height: none;
    }
    
    .public-chatbot-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .public-chatbot-toggle {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }
}

/* Scrollbar personnalisée */
.public-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.public-chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.public-chatbot-messages::-webkit-scrollbar-thumb {
    background: #FDA307;
    border-radius: 3px;
}

.public-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #FC9D0B;
}
