/**
 * Creasite AI Assistant - Chatbot Styles
 *
 * @package Creasite_AI_Assistant
 */

/* Variables CSS */
:root {
    --creasite-primary-color: #2563eb;
    --creasite-primary-hover: #1d4ed8;
    --creasite-text-color: #1f2937;
    --creasite-text-light: #6b7280;
    --creasite-bg-color: #ffffff;
    --creasite-bg-light: #f3f4f6;
    --creasite-border-color: #e5e7eb;
    --creasite-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --creasite-radius: 16px;
    --creasite-radius-sm: 12px;
    --creasite-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset pour le conteneur */
.creasite-chatbot-container,
.creasite-chatbot-container * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Bouton toggle */
.creasite-chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--creasite-primary-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    transition: var(--creasite-transition);
    z-index: 999998;
}

.creasite-chatbot-toggle:hover {
    transform: scale(1.1);
    background: var(--creasite-primary-hover);
}

.creasite-chatbot-toggle.is-hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.creasite-chatbot-toggle svg {
    width: 28px;
    height: 28px;
    fill: #ffffff;
}

/* Badge notification */
.creasite-chatbot-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    border: 2px solid #ffffff;
}

/* Conteneur principal */
.creasite-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 100px);
    background: var(--creasite-bg-color);
    border-radius: var(--creasite-radius);
    box-shadow: var(--creasite-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: var(--creasite-transition);
}

.creasite-chatbot-container.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.creasite-chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--creasite-primary-color);
    color: #ffffff;
}

.creasite-chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.creasite-chatbot-header-avatar svg {
    width: 24px;
    height: 24px;
    fill: #ffffff;
}

.creasite-chatbot-header-text h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 2px 0;
}

.creasite-chatbot-header-text p {
    font-size: 12px;
    opacity: 0.9;
    margin: 0;
}

.creasite-chatbot-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--creasite-transition);
}

.creasite-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.creasite-chatbot-close svg {
    width: 18px;
    height: 18px;
    fill: #ffffff;
}

/* Zone des messages */
.creasite-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--creasite-bg-light);
}

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

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

.creasite-chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--creasite-border-color);
    border-radius: 3px;
}

.creasite-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--creasite-text-light);
}

/* Messages */
.creasite-chatbot-message {
    display: flex;
    gap: 10px;
    max-width: 90%;
    animation: fadeInUp 0.3s ease;
}

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

.creasite-chatbot-message--user {
    flex-direction: row-reverse;
    align-self: flex-end;
}

.creasite-chatbot-message--assistant {
    align-self: flex-start;
}

.creasite-chatbot-message--error {
    align-self: center;
    max-width: 100%;
}

.creasite-chatbot-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--creasite-bg-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.creasite-chatbot-message--assistant .creasite-chatbot-avatar {
    background: var(--creasite-primary-color);
}

.creasite-chatbot-message--assistant .creasite-chatbot-avatar svg {
    fill: #ffffff;
}

.creasite-chatbot-message--user .creasite-chatbot-avatar {
    background: var(--creasite-bg-color);
}

.creasite-chatbot-message--user .creasite-chatbot-avatar svg {
    fill: var(--creasite-text-light);
}

.creasite-chatbot-avatar svg {
    width: 18px;
    height: 18px;
}

.creasite-chatbot-content {
    padding: 12px 16px;
    border-radius: var(--creasite-radius-sm);
    font-size: 14px;
    line-height: 1.5;
    color: var(--creasite-text-color);
}

.creasite-chatbot-message--assistant .creasite-chatbot-content {
    background: var(--creasite-bg-color);
    border-bottom-left-radius: 4px;
}

.creasite-chatbot-message--user .creasite-chatbot-content {
    background: var(--creasite-primary-color);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.creasite-chatbot-message--error .creasite-chatbot-content {
    background: #fef2f2;
    color: #dc2626;
    text-align: center;
    font-size: 13px;
}

.creasite-chatbot-content .bullet {
    color: var(--creasite-primary-color);
    font-weight: bold;
}

/* Indicateur de frappe */
.creasite-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.creasite-typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--creasite-text-light);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

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

/* Zone de saisie */
.creasite-chatbot-input-area {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 16px 20px;
    background: var(--creasite-bg-color);
    border-top: 1px solid var(--creasite-border-color);
}

.creasite-chatbot-input {
    flex: 1;
    min-height: 44px;
    max-height: 100px;
    padding: 12px 16px;
    border: 1px solid var(--creasite-border-color);
    border-radius: var(--creasite-radius-sm);
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    outline: none;
    transition: var(--creasite-transition);
    font-family: inherit;
}

.creasite-chatbot-input:focus {
    border-color: var(--creasite-primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.creasite-chatbot-input::placeholder {
    color: var(--creasite-text-light);
}

.creasite-chatbot-send {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border: none;
    background: var(--creasite-primary-color);
    border-radius: var(--creasite-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--creasite-transition);
}

.creasite-chatbot-send:hover:not(:disabled) {
    background: var(--creasite-primary-hover);
}

.creasite-chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.creasite-chatbot-send svg {
    width: 20px;
    height: 20px;
    fill: #ffffff;
}

/* Footer */
.creasite-chatbot-footer {
    padding: 8px 20px;
    text-align: center;
    background: var(--creasite-bg-color);
    border-top: 1px solid var(--creasite-border-color);
}

.creasite-chatbot-footer p {
    font-size: 11px;
    color: var(--creasite-text-light);
    margin: 0;
}

.creasite-chatbot-footer a {
    color: var(--creasite-primary-color);
    text-decoration: none;
}

.creasite-chatbot-footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 480px) {
    .creasite-chatbot-container {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .creasite-chatbot-container.is-open {
        border-radius: 0;
    }

    .creasite-chatbot-toggle {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
}

/* Mode sombre (optionnel) */
@media (prefers-color-scheme: dark) {
    .creasite-chatbot-container {
        /* Le mode sombre peut être activé si nécessaire */
    }
}
