/**
 * KODEX Chatbot Widget Styles
 * Design moderne et responsive
 */

/* Widget Container */
.kodex-chat-widget {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Chat Container */
.kodex-chat-container {
    position: fixed;
    bottom: 90px;
    right: 2rem;
    width: 400px;
    max-width: calc(100vw - 2rem);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.kodex-chat-container.kodex-chat-open {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.kodex-chat-container.kodex-chat-minimized {
    height: 60px;
}

.kodex-chat-container.kodex-chat-minimized .kodex-chat-messages,
.kodex-chat-container.kodex-chat-minimized .kodex-chat-input-area {
    display: none;
}

/* Header */
.kodex-chat-header {
    background: #000000;
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

.kodex-chat-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
    color: white;
}

.kodex-chat-status {
    font-size: 12px;
    margin: 2px 0 0 0;
    opacity: 0.9;
    color: white;
}

.kodex-chat-btn-icon {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.kodex-chat-btn-icon:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Messages Area */
.kodex-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.kodex-chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

.kodex-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Message Bubbles */
.kodex-chat-message {
    display: flex;
    animation: messageSlideIn 0.3s ease-out;
}

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

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

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

.kodex-message-content {
    max-width: 80%;
    display: flex;
    flex-direction: column;
}

.kodex-message-text {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.kodex-chat-message-user .kodex-message-text {
    background: #000000;
    color: white;
    border-bottom-right-radius: 4px;
}

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

.kodex-message-time {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
    padding: 0 0.5rem;
}

.kodex-chat-message-user .kodex-message-time {
    text-align: right;
}

.kodex-chat-message-bot .kodex-message-time {
    text-align: left;
}

/* Typing Indicator */
.kodex-typing-indicator .kodex-message-content {
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.kodex-typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.kodex-typing-dots span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.kodex-typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.kodex-typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input Area */
.kodex-chat-input-area {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 1rem;
    flex-shrink: 0;
}

.kodex-chat-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.kodex-chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.kodex-chat-input:focus {
    border-color: #000000;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.kodex-chat-send-btn {
    background: #000000;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.kodex-chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.kodex-chat-send-btn:active {
    transform: scale(0.98);
}

/* Suggestions */
.kodex-chat-suggestions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.kodex-suggestion-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.kodex-suggestion-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 768px) {
    .kodex-chat-container {
        bottom: 80px;
        right: 1rem;
        left: 1rem;
        width: auto;
        max-width: none;
        height: 500px;
    }
}

@media (max-width: 480px) {
    .kodex-chat-container {
        bottom: 70px;
        right: 0.5rem;
        left: 0.5rem;
        height: calc(100vh - 100px);
        border-radius: 12px;
    }

    .kodex-chat-header {
        padding: 0.875rem 1rem;
    }

    .kodex-chat-messages {
        padding: 1rem;
    }

    .kodex-message-content {
        max-width: 85%;
    }
}

/* Utility Classes */
.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: 0.5rem;
}

.ml-3 {
    margin-left: 0.75rem;
}
