/* Variables CSS */
:root {
    --chatbot-color: #0073aa;
    --chatbot-color-hover: #005a87;
    --chatbot-bg: #ffffff;
    --chatbot-text: #333333;
    --chatbot-border: #e5e7eb;
    --chatbot-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

/* Container principal */
#kozapartaz-chatbot-container {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

#kozapartaz-chatbot-container.kozapartaz-chatbot-bottom-right {
    bottom: 20px;
    right: 20px;
}

#kozapartaz-chatbot-container.kozapartaz-chatbot-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Bouton d'ouverture */
.kozapartaz-chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--chatbot-color);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: var(--chatbot-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.kozapartaz-chatbot-toggle svg {
    width: 28px;
    height: 28px;
}

/* Images personnalisées pour l'icône du bouton */
.kozapartaz-chatbot-custom-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

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

/* Fenêtre du chatbot */
.kozapartaz-chatbot-window {
    position: absolute;
    bottom: 80px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--chatbot-bg);
    border-radius: 16px;
    box-shadow: var(--chatbot-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.kozapartaz-chatbot-bottom-right .kozapartaz-chatbot-window {
    right: 0;
}

.kozapartaz-chatbot-bottom-left .kozapartaz-chatbot-window {
    left: 0;
}

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

/* En-tête */
.kozapartaz-chatbot-header {
    background: var(--chatbot-color);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

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

/* Image personnalisée pour l'avatar dans l'en-tête */
.kozapartaz-chatbot-custom-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kozapartaz-chatbot-title {
    font-weight: 600;
    font-size: 16px;
}

.kozapartaz-chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.kozapartaz-chatbot-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.kozapartaz-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Corps des messages */
.kozapartaz-chatbot-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    scroll-behavior: smooth;
}

.kozapartaz-chatbot-body::-webkit-scrollbar {
    width: 6px;
}

.kozapartaz-chatbot-body::-webkit-scrollbar-track {
    background: transparent;
}

.kozapartaz-chatbot-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

/* Messages */
.kozapartaz-chatbot-message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

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

.kozapartaz-chatbot-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--chatbot-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kozapartaz-chatbot-message-user .kozapartaz-chatbot-message-avatar {
    background: #6b7280;
}

.kozapartaz-chatbot-message-content {
    flex: 1;
}

.kozapartaz-chatbot-message-text {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    color: var(--chatbot-text);
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.kozapartaz-chatbot-message-user .kozapartaz-chatbot-message-text {
    background: var(--chatbot-color);
    color: white;
}

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

/* Indicateur de saisie */
.kozapartaz-chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
}

.kozapartaz-chatbot-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chatbot-color);
    animation: typing 1.4s infinite;
}

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

.kozapartaz-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;
    }
}

/* Suggestions rapides */
.kozapartaz-chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.kozapartaz-chatbot-suggestion {
    background: white;
    border: 1px solid var(--chatbot-border);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--chatbot-text);
    cursor: pointer;
    transition: all 0.2s;
}

.kozapartaz-chatbot-suggestion:hover {
    background: var(--chatbot-color);
    color: white;
    border-color: var(--chatbot-color);
    transform: translateY(-2px);
}

/* Pied de page */
.kozapartaz-chatbot-footer {
    border-top: 1px solid var(--chatbot-border);
    background: white;
    padding: 16px 20px;
}

.kozapartaz-chatbot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.kozapartaz-chatbot-input {
    flex: 1;
    border: 1px solid var(--chatbot-border);
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.kozapartaz-chatbot-input:focus {
    border-color: var(--chatbot-color);
}

.kozapartaz-chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--chatbot-color);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.kozapartaz-chatbot-send:hover {
    background: var(--chatbot-color-hover);
    transform: scale(1.1);
}

.kozapartaz-chatbot-send:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: scale(1);
}

.kozapartaz-chatbot-powered {
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 480px) {
    .kozapartaz-chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
    }
    
    #kozapartaz-chatbot-container.kozapartaz-chatbot-bottom-right,
    #kozapartaz-chatbot-container.kozapartaz-chatbot-bottom-left {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }
    
    .kozapartaz-chatbot-toggle {
        width: 56px;
        height: 56px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --chatbot-bg: #1f2937;
        --chatbot-text: #f3f4f6;
        --chatbot-border: #374151;
    }
    
    .kozapartaz-chatbot-body {
        background: #111827;
    }
    
    .kozapartaz-chatbot-message-text {
        background: #1f2937;
        color: #f3f4f6;
    }
    
    .kozapartaz-chatbot-suggestion {
        background: #1f2937;
        color: #f3f4f6;
    }
}
