/* AI Chat Widget Styles - Minimalista y Moderno */
.ai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
}

.ai-chat-container {
    width: 450px;
    max-width: calc(100vw - 40px);
    height: 650px;
    max-height: calc(100vh - 100px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-chat-container.minimized {
    height: 64px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Header */
.ai-chat-header {
    padding: 18px 24px;
    background: #2c3e50;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
    position: relative;
}

.ai-chat-header::before {
    content: '';
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    margin-right: 12px;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.ai-chat-header h3 {
    margin: 0;
    margin-left: 20px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #ffffff;
}

.ai-chat-minimize {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    opacity: 0.8;
}

.ai-chat-minimize:hover {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

/* Messages Area */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 4px;
}

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

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Messages */
.ai-chat-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: messageSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

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

.ai-message-content,
.user-message-content {
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.6;
    word-wrap: break-word;
    font-size: 14px;
}

.ai-message-content {
    background: #ffffff;
    color: #1f2937;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.user-message-content {
    background: #2c3e50;
    color: white;
    box-shadow: 0 2px 4px rgba(44, 62, 80, 0.15);
}

.ai-message-time,
.user-message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    padding: 0 4px;
    font-weight: 400;
}

.user-message-time {
    text-align: right;
    color: #6b7280;
}

/* Input Area */
.ai-chat-input-wrapper {
    padding: 20px 24px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.ai-chat-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.ai-chat-input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
    background: #f9fafb;
    color: #1f2937;
}

.ai-chat-input::placeholder {
    color: #9ca3af;
}

.ai-chat-input:focus {
    border-color: #2c3e50;
    background: white;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.05);
}

.ai-chat-send {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: #6b7280;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-chat-send:hover:not(:disabled) {
    background: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(107, 114, 128, 0.2);
}

.ai-chat-send:active:not(:disabled) {
    transform: translateY(0);
}

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

/* Loader */
.ai-chat-loader {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    padding: 12px 0;
}

.ai-chat-loader span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: loaderBounce 1.4s infinite ease-in-out both;
}

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

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

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

/* Hidden when minimized */
.ai-chat-container.minimized .ai-chat-messages,
.ai-chat-container.minimized .ai-chat-input-wrapper {
    display: none;
}

/* Responsive */
@media (max-width: 480px) {
    .ai-chat-widget {
        bottom: 0;
        right: 0;
        left: 0;
    }
    
    .ai-chat-container {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .ai-chat-header {
        border-radius: 0;
    }
    
    .ai-chat-container.minimized {
        height: 64px;
        border-radius: 20px 20px 0 0;
        bottom: 0;
    }
}