/**
 * AI Chatbot - Styles CSS
 * Design sobre, élégant et responsive
 * Palette : Bleu & Gold (cohérent avec la DA du site)
 */

/* ============================================
   CONTAINER PRINCIPAL
   ============================================ */

.ai-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: var(--font-body, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);
}

/* ============================================
   BULLE DE CHAT
   ============================================ */

.ai-chatbot-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1A2332 0%, #15202A 50%, #1F2A3F 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(26, 35, 50, 0.25);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    padding: 12px;
}

.ai-chatbot-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.ai-chatbot-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(26, 35, 50, 0.35);
    background: linear-gradient(135deg, #1F2A3F 0%, #1A2332 50%, #22324A 100%);
}

.ai-chatbot-bubble:active {
    transform: scale(0.95);
}

.ai-chatbot-bubble-hidden {
    display: none;
}

/* Animation de pulsation (optionnel) */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(26, 35, 50, 0.25);
    }
    50% {
        box-shadow: 0 4px 20px rgba(201, 162, 77, 0.3);
    }
}

/* ============================================
   PANEL DE CHAT
   ============================================ */

.ai-chatbot-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(26, 35, 50, 0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.ai-chatbot-panel-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ============================================
   HEADER
   ============================================ */

.ai-chatbot-header {
    background: linear-gradient(135deg, #1A2332 0%, #15202A 50%, #1F2A3F 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.ai-chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.ai-chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-chatbot-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.ai-chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: block;
    margin-top: 2px;
}

.ai-chatbot-status-offline {
    opacity: 0.7;
}

.ai-chatbot-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ai-chatbot-btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.ai-chatbot-btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.ai-chatbot-btn-icon:active {
    transform: scale(0.95);
}

/* ============================================
   ZONE DE MESSAGES
   ============================================ */

.ai-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #F4F6FA;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

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

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

.ai-chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(26, 35, 50, 0.2);
    border-radius: 3px;
}

.ai-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(26, 35, 50, 0.3);
}

/* ============================================
   MESSAGES
   ============================================ */

.ai-chatbot-message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    animation: messageSlideIn 0.3s ease;
}

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

.ai-chatbot-message-user {
    align-self: flex-end;
}

.ai-chatbot-message-bot {
    align-self: flex-start;
}

.ai-chatbot-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ai-chatbot-message-user .ai-chatbot-message-content {
    background: linear-gradient(135deg, #1A2332 0%, #15202A 50%, #1F2A3F 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-chatbot-message-bot .ai-chatbot-message-content {
    background: #FFFFFF;
    color: #0F1623;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(26, 35, 50, 0.1);
}

.ai-chatbot-message-error .ai-chatbot-message-content {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.ai-chatbot-message-time {
    font-size: 11px;
    color: #9CA3AF;
    margin-top: 4px;
    padding: 0 4px;
}

.ai-chatbot-message-user .ai-chatbot-message-time {
    text-align: right;
}

/* ============================================
   INDICATEUR DE FRAÎCHE
   ============================================ */

.ai-chatbot-typing {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #F4F6FA;
    flex-shrink: 0;
}

.ai-chatbot-typing-dots {
    display: flex;
    gap: 4px;
}

.ai-chatbot-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #C9A24D;
    animation: typingDot 1.4s infinite ease-in-out;
}

.ai-chatbot-typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

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

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

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

.ai-chatbot-typing-text {
    font-size: 12px;
    color: #4B5563;
    font-style: italic;
}

/* ============================================
   ZONE DE SAISIE
   ============================================ */

.ai-chatbot-input-area {
    padding: 16px;
    background: #FFFFFF;
    border-top: 1px solid rgba(26, 35, 50, 0.1);
    flex-shrink: 0;
}

.ai-chatbot-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-chatbot-input {
    width: 100%;
    min-height: 44px;
    max-height: 120px;
    padding: 12px 16px;
    border: 2px solid rgba(26, 35, 50, 0.1);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: all 0.2s ease;
    background: #F8F9FA;
    line-height: 1.5;
    color: #0F1623;
}

.ai-chatbot-input:focus {
    border-color: #C9A24D;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(201, 162, 77, 0.1);
}

.ai-chatbot-input::placeholder {
    color: #9CA3AF;
}

.ai-chatbot-input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-chatbot-char-count {
    font-size: 11px;
    color: #9CA3AF;
}

.ai-chatbot-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: linear-gradient(135deg, #1A2332 0%, #15202A 50%, #1F2A3F 100%);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ai-chatbot-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    background: linear-gradient(135deg, #1F2A3F 0%, #1A2332 50%, #22324A 100%);
    box-shadow: 0 4px 12px rgba(201, 162, 77, 0.3);
}

.ai-chatbot-send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.ai-chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(26, 35, 50, 0.2);
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

@media (max-width: 768px) {
    .ai-chatbot-container {
        bottom: 0;
        right: 0;
        left: 0;
    }

    .ai-chatbot-bubble {
        bottom: 20px;
        right: 20px;
        position: fixed;
    }

    .ai-chatbot-panel {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
    }

    .ai-chatbot-messages {
        padding: 16px;
    }

    .ai-chatbot-message {
        max-width: 85%;
    }
}

/* ============================================
   MODE SOMBRE (OPTIONNEL)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .ai-chatbot-panel {
        background: #1f2937;
    }

    .ai-chatbot-messages {
        background: #111827;
    }

    .ai-chatbot-message-bot .ai-chatbot-message-content {
        background: #374151;
        color: #f3f4f6;
        border-color: #4b5563;
    }

    .ai-chatbot-message-time {
        color: #9ca3af;
    }

    .ai-chatbot-typing {
        background: #111827;
    }

    .ai-chatbot-input-area {
        background: #1f2937;
        border-top-color: #374151;
    }

    .ai-chatbot-input {
        background: #111827;
        border-color: #374151;
        color: #f3f4f6;
    }

    .ai-chatbot-input:focus {
        background: #111827;
        border-color: #C9A24D;
    }

    .ai-chatbot-char-count {
        color: #6b7280;
    }
}

/* ============================================
   ACCESSIBILITÉ
   ============================================ */

.ai-chatbot-container *:focus-visible {
    outline: 2px solid #C9A24D;
    outline-offset: 2px;
}

/* Animation de chargement pour les messages */
.ai-chatbot-message-loading {
    opacity: 0.6;
}
