/* NEXY IA Chat - Estilos Principais */

/* Container Principal */
#nexy-chat-container {
    max-width: 100%;
    height: 600px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header do Chat */
.nexy-chat-header {
    background: #4F46E5;
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nexy-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.nexy-chat-logo {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4F46E5;
    font-weight: bold;
    font-size: 20px;
}

/* Área de Mensagens */
.nexy-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f7f8fa;
}

.nexy-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.nexy-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.nexy-chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.nexy-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mensagens */
.nexy-message {
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
}

.nexy-message.user {
    flex-direction: row-reverse;
}

.nexy-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #4F46E5;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.nexy-message.assistant .nexy-message-avatar {
    background: #10B981;
}

.nexy-message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.nexy-message.user .nexy-message-content {
    background: #4F46E5;
    color: white;
}

.nexy-message-content p {
    margin: 0 0 8px 0;
}

.nexy-message-content p:last-child {
    margin-bottom: 0;
}

/* Área de Input */
.nexy-chat-input {
    padding: 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.nexy-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.nexy-message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.nexy-message-input:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.nexy-send-button {
    padding: 0;
    width: 44px;
    height: 44px;
    background: #4F46E5;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.nexy-send-button:hover:not(:disabled) {
    background: #4338CA;
}

.nexy-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nexy-send-button svg {
    width: 20px;
    height: 20px;
}

/* Loading */
.nexy-loading {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

.nexy-loading-dots {
    display: inline-flex;
    gap: 4px;
}

.nexy-loading-dot {
    width: 8px;
    height: 8px;
    background: #6b7280;
    border-radius: 50%;
    animation: nexy-pulse 1.4s infinite;
}

.nexy-loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.nexy-loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes nexy-pulse {
    0%, 60%, 100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}

/* Formulário de Login */
.nexy-auth-form {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.nexy-auth-box {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    text-align: center;
}

.nexy-auth-box h2 {
    margin-bottom: 8px;
    color: #1f2937;
}

.nexy-auth-box p {
    color: #6b7280;
    margin-bottom: 32px;
}

.nexy-form-group {
    margin-bottom: 16px;
}

.nexy-form-group input,
.nexy-form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.nexy-form-group input:focus,
.nexy-form-group select:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.nexy-btn {
    width: 100%;
    padding: 12px 24px;
    background: #4F46E5;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.nexy-btn:hover {
    background: #4338CA;
}

.nexy-auth-switch {
    margin-top: 20px;
    color: #6b7280;
    font-size: 14px;
}

.nexy-auth-switch a {
    color: #4F46E5;
    text-decoration: none;
}

.nexy-auth-switch a:hover {
    text-decoration: underline;
}

/* Mensagem de Boas-vindas */
.nexy-welcome {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.nexy-welcome h3 {
    color: #1f2937;
    margin-bottom: 16px;
}

.nexy-suggestions {
    margin-top: 32px;
    display: grid;
    gap: 12px;
}

.nexy-suggestion {
    padding: 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.nexy-suggestion:hover {
    border-color: #4F46E5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Responsividade */
@media (max-width: 768px) {
    #nexy-chat-container {
        height: 500px;
        border-radius: 0;
    }
    
    .nexy-message-content {
        max-width: 85%;
    }
    
    .nexy-chat-header {
        padding: 16px;
    }
    
    .nexy-chat-messages {
        padding: 16px;
    }
    
    .nexy-chat-input {
        padding: 16px;
    }
}

/* Tema Escuro */
.nexy-dark #nexy-chat-container {
    background: #1f2937;
    color: #e5e7eb;
}

.nexy-dark .nexy-chat-messages {
    background: #111827;
}

.nexy-dark .nexy-message-content {
    background: #374151;
    color: #e5e7eb;
}

.nexy-dark .nexy-message.user .nexy-message-content {
    background: #4F46E5;
    color: white;
}

.nexy-dark .nexy-chat-input {
    background: #1f2937;
    border-top-color: #374151;
}

.nexy-dark .nexy-message-input {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

.nexy-dark .nexy-auth-form {
    background: rgba(31, 41, 55, 0.98);
}

.nexy-dark .nexy-auth-box h2 {
    color: #e5e7eb;
}

/* Animações */
.nexy-fade-in {
    animation: nexyFadeIn 0.3s ease-in;
}

@keyframes nexyFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Melhorias de Acessibilidade */
.nexy-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}