/* Assistant Virtuel PixelRush - Styles */

.chat-assistant-widget {
    position: fixed;
    bottom: 20px;
    z-index: 9999;
    font-family: system-ui, -apple-system, sans-serif;
}

/* Classes de position */
.chat-assistant-widget.right-4 {
    right: 20px;
}

.chat-assistant-widget.left-4 {
    left: 20px;
}

/* Bouton flottant */
.chat-toggle-btn {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.chat-icon {
    width: 28px;
    height: 28px;
}

/* Badge de notification pulsant */
.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    box-shadow: 0 0 0 2px white;
    animation: chatBadgePulse 1.8s ease-out infinite;
}

@keyframes chatBadgePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6), 0 0 0 2px white;
    }
    70% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0), 0 0 0 2px white;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0), 0 0 0 2px white;
    }
}

/* Bulle d'invitation */
.chat-teaser {
    position: absolute;
    bottom: 72px;
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: min(260px, calc(100vw - 60px));
    background: white;
    color: #1f2937;
    padding: 10px 14px;
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    cursor: pointer;
    animation: chatTeaserIn 0.35s ease;
}

.chat-assistant-widget.left-4 .chat-teaser {
    right: auto;
    left: 0;
}

.chat-teaser-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #6b7280;
}

.chat-teaser-text {
    margin: 0;
}

.chat-teaser-close {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-teaser-close svg {
    width: 12px;
    height: 12px;
}

@media (max-width: 640px) {
    .chat-teaser {
        font-size: 13px;
        padding: 8px 12px;
        gap: 6px;
    }
}

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

/* Fenêtre de chat */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

/* En-tête */
.chat-header {
    padding: 16px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.chat-avatar svg {
    width: 24px;
    height: 24px;
}

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

.chat-header-status {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

.chat-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-close-btn svg {
    width: 20px;
    height: 20px;
}

/* Zone des messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f9fafb;
}

.chat-message {
    margin-bottom: 12px;
    display: flex;
}

.chat-message-user {
    justify-content: flex-end;
}

.chat-message-assistant {
    justify-content: flex-start;
}

.chat-message-content {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message-user .chat-message-content {
    background: var(--chat-primary-color, #3b82f6);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message-assistant .chat-message-content {
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-message-assistant .chat-message-content a {
    color: #2563eb;
    text-decoration: underline;
}

.chat-message-assistant .chat-message-content a:hover {
    color: #1d4ed8;
}

.chat-message-user .chat-message-content a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
}

/* Paragraphes et listes générés depuis les réponses du bot */
.chat-paragraph {
    margin: 0 0 10px 0;
}

.chat-paragraph:last-child {
    margin-bottom: 0;
}

.chat-list {
    margin: 0 0 10px 0;
    padding-left: 20px;
}

.chat-list:last-child {
    margin-bottom: 0;
}

.chat-list li {
    margin-bottom: 4px;
}

.chat-list li:last-child {
    margin-bottom: 0;
}


/* Liens générés par le backend */
.chat-link-wrap {
    display: block;
    margin-top: 10px;
    margin-bottom: 2px;
}

.chat-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--chat-primary-color, #3b82f6) !important;
    background-color: white;
    border: 1.5px solid var(--chat-primary-color, #3b82f6);
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
    letter-spacing: 0.01em;
}

.chat-link-btn::after {
    content: "↗";
    font-size: 12px;
    opacity: 0.75;
    transition: opacity 0.2s;
}

.chat-link-btn:hover {
    background-color: var(--chat-primary-color, #3b82f6);
    color: white !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.13);
    text-decoration: none !important;
}

.chat-link-btn:hover::after {
    opacity: 1;
}

/* Indicateur de chargement */
.chat-loading {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.chat-loading span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.chat-loading span:nth-child(1) {
    animation-delay: -0.32s;
}

.chat-loading span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Réponses rapides */
.quick-responses {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.quick-response-btn {
    padding: 8px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.quick-response-btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

/* Zone de saisie */
.chat-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: var(--chat-primary-color, #3b82f6);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.chat-send-btn:hover {
    opacity: 0.9;
}

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

.chat-send-btn svg {
    width: 20px;
    height: 20px;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Responsive - Mobile */
@media (max-width: 640px) {
    .chat-window {
        position: fixed;
        width: calc(100vw - 32px);
        left: 16px;
        right: 16px;
        bottom: 90px;
        height: calc(100vh - 120px);
        max-height: calc(100vh - 120px);
    }

    .chat-assistant-widget.left-4 .chat-window,
    .chat-assistant-widget.right-4 .chat-window {
        left: 16px;
        right: 16px;
        transform: none;
    }

    .chat-toggle-btn {
        width: 56px;
        height: 56px;
    }
}

/* Classe utilitaire */
.hidden {
    display: none !important;
}
