/* WP Flow Agent Chat Styles */

/* Container principal do agent - CENTRALIZADO */
.wpflow-agent-chat {
    width: 100%;
    /* max-width é aplicado via CSS inline gerado dinamicamente */
    margin: 20px auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.agent-chat-modern-container {
    width: 100%;
    height: 700px;
    max-height: 700px;
    color: #fff;
    padding: 24px;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
}

/* Garante que todos elementos internos respeitem a largura */
.wpflow-agent-chat * {
    max-width: 100%;
    box-sizing: border-box;
}

.agent-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 100%;
    margin: 0 auto 32px auto;
}
@media (min-width: 768px) {
    .agent-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 1024px) {
    .agent-cards-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
.agent-card {
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 20px;
    padding: 24px 20px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border 0.2s, color 0.2s;
    color: #fff;
    box-shadow: 0 2px 8px 0 rgba(0,0,0,0.10);
}
.agent-card:hover {
    background: #27272a;
    border-color: #fff;
    color: #fff;
}

.agent-input-modern-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 32px 0 0 0;
    padding: 0;
    box-sizing: border-box;
}

/* Área de anexo de arquivo */
.agent-attachment-area {
    margin-bottom: 12px;
}

.attachment-card {
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    border: 2px solid #20b2aa;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    box-shadow: 0 2px 8px rgba(32, 178, 170, 0.15);
    transition: all 0.3s ease;
}

.attachment-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(32, 178, 170, 0.25);
}

.attachment-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(32, 178, 170, 0.1);
    border-radius: 8px;
    flex-shrink: 0;
}

.attachment-info {
    flex: 1;
    min-width: 0;
}

.attachment-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
    margin-bottom: 4px;
    word-break: break-word;
}

.attachment-type {
    font-size: 12px;
    color: #7f8c8d;
    font-style: italic;
}

.attachment-remove {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.attachment-remove:hover {
    background: #c0392b;
    transform: scale(1.1);
}
.agent-input-modern {
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 32px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px 0 rgba(0,0,0,0.10);
    width: 100%;
    box-sizing: border-box;
}
.input-options {
    position: relative;
}
.options-btn {
    background: none;
    border: none;
    color: #a1a1aa;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
}
.options-btn:hover {
    background: #27272a;
    color: #fff;
}
.options-dropdown {
    position: absolute;
    left: 0;
    bottom: 110%;
    background: #27272a;
    border: 1px solid #3f3f46;
    border-radius: 16px;
    min-width: 180px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.22);
    z-index: 10;
    padding: 8px 0;
    display: none !important;
}
.options-dropdown.show {
    display: block !important;
}
.options-dropdown .dropdown-item {
    width: 100%;
    background: none;
    border: none;
    color: #fff;
    text-align: left;
    padding: 10px 18px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.options-dropdown .dropdown-item:hover {
    background: #3f3f46;
}
.icon-plus {
    font-size: 1.8rem !important;
    font-weight: 300 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    color: #a1a1aa !important;
    background: transparent !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}
.icon-camera, .icon-clip {
    font-size: 1.1rem;
    display: inline-block;
}
.agent-input-modern .agent-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: #fff !important;
    font-size: 1.1rem;
    padding: 0 8px;
}
.agent-input-modern .agent-input::placeholder {
    color: #a1a1aa;
}
.agent-input-modern .send-button {
    color: #a1a1aa;
    background: none;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
    padding: 0;
}
.agent-input-modern .send-button:hover {
    background: #27272a;
    color: #fff;
}
.input-counter {
    margin-top: 6px;
    text-align: right;
    font-size: 11px;
    color: #a1a1aa;
}

@media (max-width: 768px) {
    .agent-chat-modern-container, .agent-input-modern-wrapper {
        width: 100%;
        max-width: 100%;
        padding: 0;
    }
    .agent-cards-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .agent-card {
        padding: 18px 10px;
        font-size: 0.98rem;
    }
    .agent-input-modern {
        padding: 10px 10px;
    }
    
    /* Responsivo para anexos */
    .attachment-card {
        padding: 12px;
        gap: 8px;
    }
    
    .attachment-icon {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    
    .attachment-name {
        font-size: 13px;
    }
    
    .attachment-type {
        font-size: 11px;
    }
    
    .file-attachment {
        gap: 6px;
        padding: 6px;
    }
    
    .file-icon {
        font-size: 16px;
    }
    
    /* Responsivo para ações das mensagens */
    .message-actions {
        gap: 6px;
    }
    
    .action-btn {
        padding: 4px;
    }
    
    .action-btn svg {
        width: 14px;
        height: 14px;
    }
}

.wpflow-agent-chat {
    width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    border: none;
}

/* Header do Agente */
.agent-header {
    display: none;
}

.agent-avatar {
    font-size: 24px;
    margin-right: 12px;
    background: rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agent-info {
    flex: 1;
}

.agent-name {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.agent-description {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
    line-height: 1.3;
}

.agent-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.3);
}

.status-indicator.online {
    animation: pulse 2s infinite;
}

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

/* Área de Mensagens */
.agent-messages {
    flex: 0 0 auto;
    min-height: 200px;
    max-height: 500px;
    height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    background: transparent;
    scroll-behavior: smooth;
    box-sizing: border-box;
}

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

.agent-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.agent-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.agent-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mensagens */
.bot-message, .user-message {
    display: flex;
    margin-bottom: 16px;
    align-items: flex-start;
    gap: 8px;
}

.user-message {
    justify-content: flex-end;
    /* Removido flex-direction: row-reverse para não mostrar avatar */
}

/* Avatar apenas para mensagens do bot */
.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

.bot-message .message-avatar {
    background: #008080;
    color: white;
}

/* Avatar do usuário removido - não será exibido */
.user-message .message-avatar {
    display: none;
}

.message-content {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 16px;
    word-wrap: break-word;
}

/* Ajustes específicos para mensagens do usuário sem avatar */
.user-message .message-content {
    margin-right: 0; /* Remove margem já que não há avatar */
}

.bot-message .message-content {
    background: transparent;
    border: none;
    border-bottom-left-radius: 4px;
    color: white;
}

.user-message .message-content {
    background: #373737;
    color: white;
    border-radius: 8px;
    border: none;
    box-shadow: none;
}

.message-content p {
    margin: 0;
    line-height: 1.4;
    font-size: 14px;
    color: white;
}

.message-content a {
    color: #a8d8ff;
    text-decoration: underline;
}

.user-message .message-content a {
    color: #e1f5fe;
}

/* Ícones de ação das mensagens do bot */
.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    justify-content: flex-start;
}

.action-btn {
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
    transform: scale(1.1);
}

.action-btn:active {
    transform: scale(0.95);
}

.action-btn svg {
    transition: fill 0.2s ease;
}

/* Estados específicos dos botões */
.copy-btn:hover svg {
    fill: #4ade80 !important;
}

.like-btn:hover svg {
    fill: #4ade80 !important;
}

.dislike-btn:hover svg {
    fill: #ef4444 !important;
}

.listen-btn:hover svg {
    fill: #3b82f6 !important;
}

/* Mensagens de arquivo */
.file-message .message-content {
    background: transparent;
    border: none;
    color: white;
}

.file-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px;
    background: rgba(39, 174, 96, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(39, 174, 96, 0.2);
}

.file-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.file-name {
    font-weight: 600;
    color: #27ae60;
    flex: 1;
    word-break: break-word;
}

.file-size {
    font-size: 11px;
    color: #7f8c8d;
    font-style: italic;
}

.file-description {
    margin: 0;
    font-size: 12px;
    color: #7f8c8d;
    font-style: italic;
}

/* Mensagem de Boas-vindas - CORRIGIDO para usar estilo padrão */
.welcome-message {
    margin-bottom: 20px;
}

.welcome-message .bot-message {
    margin-bottom: 0;
}

/* REMOVIDO: Estilo especial da welcome message para usar o estilo padrão das mensagens do bot */
/*
.welcome-message .message-content {
    background: linear-gradient(135deg, #008080 0%, #006666 100%);
    color: white;
    border: none;
}
*/

/* Indicador de Digitação */
.typing-indicator .message-content {
    padding: 12px 16px;
}

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

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

/* Mensagens Padrão */
.default-messages {
    padding: 16px;
    background: transparent;
    order: -1; /* Garante que apareça antes das mensagens */
}

/* Título removido */

.default-messages-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.default-message-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.2;
    margin: 2px;
}

.default-message-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.default-message-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.3);
}

.no-default-messages {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Área de Input */
.agent-input-area {
    padding: 16px;
    background: transparent;
    width: 100%;
    box-sizing: border-box;
}

.input-container {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.agent-input {
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    background: #303030;
    color: #a9a9a9;
}

.agent-input:focus {
    border-color: rgba(255, 255, 255, 0.5);
    background: #303030;
}

.agent-input::placeholder {
    color: #a9a9a9;
}

.send-button {
    background: transparent;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
    padding: 0;
}

.icon-mic {
    background: #ECECEC !important;
    padding: 5px !important;
    border-radius: 50% !important;
    width: 26px !important;
    height: 26px !important;
    box-sizing: content-box;
}

.icon-send {
    background: #000 !important;
    padding: 5px !important;
    border-radius: 50% !important;
    width: 26px !important;
    height: 26px !important;
    box-sizing: content-box;
}


.send-button:hover {
    background: #006666;
    transform: scale(1.05);
}

.send-button:active {
    transform: scale(0.95);
}

.send-icon {
    font-size: 14px;
}

.input-counter {
    margin-top: 6px;
    text-align: right;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.char-count.warning {
    color: #dc3545;
    font-weight: 600;
}

/* Responsivo */
@media (max-width: 768px) {
    .wpflow-agent-chat {
        max-width: 100%;
        margin: 10px;
        border-radius: 8px;
    }
    
    .agent-messages {
        max-height: 400px;
        height: 400px;
    }

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

/* Estados especiais */
.wpflow-agent-chat.loading {
    opacity: 0.7;
    pointer-events: none;
}

.wpflow-agent-chat.error .agent-header {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.wpflow-agent-chat.offline .status-indicator {
    background: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.3);
    animation: none;
}

/* Data Collection Input */
.data-collection-input {
    padding: 16px;
    background: transparent;
}

.data-collection-input .input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Ocultar mensagens padrão durante coleta */
.wpflow-agent-chat.collecting-data .default-messages {
    opacity: 0.5;
    pointer-events: none;
}

/* Animações de entrada */
.bot-message, .user-message {
    animation: slideIn 0.3s ease-out;
}

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