/**
 * Styles du widget de chat IA1
 *
 * @package IA1
 */

/* Container principal */
.ia1-chat-widget {
    max-width: 800px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* En-tête */
.ia1-chat-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.ia1-chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ia1-chat-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.ia1-chat-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: white;
}

.ia1-chat-subtitle {
    font-size: 15px;
    margin: 0;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
}

/* Corps du chat */
.ia1-chat-body {
    padding: 24px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Scrollbar personnalisée */
.ia1-chat-body::-webkit-scrollbar {
    width: 8px;
}

.ia1-chat-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ia1-chat-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.ia1-chat-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Messages */
.ia1-message {
    display: flex;
    gap: 12px;
    animation: ia1-fadeIn 0.3s ease-in;
}

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

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

.ia1-message-user {
    flex-direction: row-reverse;
}

.ia1-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.ia1-message-assistant .ia1-message-avatar {
    background: #2271b1;
}

.ia1-message-user .ia1-message-avatar {
    background: #646970;
}

.ia1-message-content {
    flex: 1;
    min-width: 0;
}

.ia1-message-text {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
}

.ia1-message-assistant .ia1-message-text {
    background: white;
    border: 1px solid #e0e0e0;
}

.ia1-message-user .ia1-message-text {
    background: #2271b1;
    color: white;
}

/* Sources */
.ia1-message-sources {
    margin-top: 10px;
    padding-top: 10px;
}

.ia1-message-sources-title {
    font-size: 12px;
    font-weight: 600;
    color: #646970;
    margin-bottom: 6px;
    display: none;
}

.ia1-message-sources-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ia1-message-source-link {
    font-size: 13px;
    color: #2271b1;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ia1-message-source-link:hover {
    text-decoration: underline;
}

.ia1-message-source-link::before {
    content: "→";
    font-weight: bold;
}

/* Zone de saisie */
.ia1-chat-input-container {
    padding: 16px 24px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.ia1-chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 8px 12px;
    transition: border-color 0.2s;
}

.ia1-chat-input-wrapper:focus-within {
    border-color: #2271b1;
}

.ia1-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.5;
    max-height: 120px;
    min-height: 24px;
    outline: none;
}

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

.ia1-chat-send-btn:hover {
    opacity: 0.8;
}

.ia1-chat-send-btn:active {
    opacity: 1;
}

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

.ia1-chat-info-text {
    margin-top: 8px;
    text-align: center;
    font-size: 12px;
    color: #646970;
}

.ia1-chat-info-text a {
    color: #2271b1;
    text-decoration: none;
}

.ia1-chat-info-text a:hover {
    text-decoration: underline;
}

/* Loader */
.ia1-chat-loader {
    padding: 20px;
    display: flex;
    justify-content: center;
}

.ia1-chat-loader-dots {
    display: flex;
    gap: 8px;
}

.ia1-chat-loader-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2271b1;
    animation: ia1-bounce 1.4s infinite ease-in-out both;
}

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

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

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

/* Erreur */
.ia1-error {
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    text-align: center;
}

.ia1-error a {
    color: #0056b3;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .ia1-chat-widget {
        border-radius: 0;
    }
    
    .ia1-chat-header {
        padding: 16px 20px;
    }
    
    .ia1-chat-body {
        padding: 20px 16px;
    }
    
    .ia1-chat-input-container {
        padding: 12px 16px;
    }
}



