/* ============================================
   WHATSAPP + ROBÔ DE CHAT - CSS LIMPO E OTIMIZADO
   VERSÃO FINAL SEM DUPLICAÇÕES
   ============================================ */

/* Container principal */
.whatsapp-wrapper {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

/* ============================================
   BOTÃO WHATSAPP
   ============================================ */
.whatsapp-float {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    animation: pulse-whatsapp 2s infinite;
}

.whatsapp-float:hover {
    transform: scale(1.15) rotate(5deg);
    background: linear-gradient(135deg, #128C7E, #075e54);
    box-shadow: 0 12px 35px rgba(37, 211, 102, 0.6);
    color: white;
    text-decoration: none;
}

.whatsapp-text {
    position: absolute;
    right: 75px;
    background: #25D366;
    color: white;
    padding: 8px 18px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.whatsapp-float:hover .whatsapp-text {
    opacity: 1;
    visibility: visible;
    transform: translateX(-5px);
}

@keyframes pulse-whatsapp {
    0%, 100% { box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4); }
    50% { box-shadow: 0 8px 40px rgba(37, 211, 102, 0.7); }
}

/* ============================================
   CONTAINER DO ROBÔ
   ============================================ */
.robot-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* ============================================
   CABEÇA DO ROBÔ - SEMPRE VISÍVEL
   ============================================ */
.robot-icon-sm {
    font-size: 55px;
    cursor: pointer;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.3));
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
    animation: robotBounce 2s ease-in-out infinite;
    user-select: none;
}

.robot-icon-sm:hover {
    transform: scale(1.2);
    filter: drop-shadow(0 12px 30px rgba(0,0,0,0.4));
}

.robot-icon-sm:active {
    transform: scale(0.95);
}

/* Bolinha verde de status */
.robot-status {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 16px;
    height: 16px;
    background: #2ecc71;
    border-radius: 50%;
    border: 3px solid white;
    animation: statusPulse 2s infinite;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
}

/* Tooltip */
.tooltip-text {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #091E3E, #0d2b55);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    pointer-events: none;
}

.robot-icon-sm:hover .tooltip-text {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(-5px);
}

@keyframes robotBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(-5deg); }
    75% { transform: translateY(-8px) rotate(5deg); }
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* ============================================
   JANELA DE CHAT - GRANDE E ALTA
   ============================================ */
.robot-message {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 500px;
    height: 650px;
    max-height: 700px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    display: none;
    animation: chatSlideUp 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
    border: 1px solid rgba(0,0,0,0.1);
}

.robot-message.show {
    display: flex;
    flex-direction: column;
}

/* Cabeçalho do chat */
.chat-header {
    background: linear-gradient(135deg, #091E3E, #0d2b55);
    color: white;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 16px;
    border-bottom: 2px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.chat-header span {
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-chat {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-chat:hover {
    background: rgba(255,255,255,0.4);
    transform: rotate(90deg);
}

/* Seta do balão */
.robot-arrow {
    position: absolute;
    bottom: -10px;
    right: 25px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid #0d2b55;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

/* Conteúdo do chat */
.robot-message-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* Área de mensagens */
#chatMessages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 10px;
    min-height: 0;
}

/* Scrollbar personalizada */
#chatMessages::-webkit-scrollbar {
    width: 6px;
}

#chatMessages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#chatMessages::-webkit-scrollbar-thumb {
    background: #091E3E;
    border-radius: 10px;
}

#chatMessages::-webkit-scrollbar-thumb:hover {
    background: #0d2b55;
}

/* Mensagens */
.bot-message, .user-message {
    padding: 12px 16px;
    margin: 12px 0;
    border-radius: 15px;
    word-wrap: break-word;
    font-size: 15px;
    line-height: 1.6;
    max-width: 85%;
    position: relative;
    animation: messagePop 0.3s ease;
}

.bot-message {
    background: linear-gradient(135deg, #f0f7ff, #e3f0ff);
    color: #091E3E;
    margin-right: auto;
    border-bottom-left-radius: 5px;
}

.user-message {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    color: #2e7d32;
    margin-left: auto;
    text-align: right;
    border-bottom-right-radius: 5px;
}

.bot-message strong {
    color: #091E3E;
    font-size: 16px;
}

@keyframes messagePop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Área de input */
.chat-input-area {
    display: flex;
    gap: 10px;
    border-top: 2px solid #eee;
    padding-top: 15px;
    align-items: center;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
    background: #f9f9f9;
}

.chat-input:focus {
    border-color: #091E3E;
    background: white;
    box-shadow: 0 0 0 4px rgba(9, 30, 62, 0.1);
}

.chat-input::placeholder {
    color: #999;
}

.chat-send {
    background: linear-gradient(135deg, #091E3E, #0d2b55);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(9, 30, 62, 0.3);
    flex-shrink: 0;
}

.chat-send:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, #0d2b55, #123a6e);
    box-shadow: 0 8px 25px rgba(9, 30, 62, 0.5);
}

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

/* Loading */
.chat-loading {
    text-align: center;
    color: #666;
    font-size: 14px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.chat-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 3px solid #091E3E;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

/* ============================================
   SETA DE ATENÇÃO
   ============================================ */
.seta-atencao {
    position: absolute;
    right: 70px;
    top: -30px;
    z-index: 1002;
    animation: bounceSeta 1s ease-in-out infinite;
    cursor: pointer;
}

.seta-animada {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    padding: 8px 15px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.texto-seta {
    font-size: 12px;
}

.onda-seta {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50px;
    background: rgba(255,107,53,0.3);
    top: 0;
    left: 0;
    animation: ondaSeta 1.5s ease-in-out infinite;
    z-index: -1;
}

.seta-atencao.clicked {
    animation: fadeOut 0.5s forwards;
}

@keyframes bounceSeta {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes ondaSeta {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes fadeOut {
    to { opacity: 0; visibility: hidden; display: none; }
}

/* ============================================
   RESPONSIVO
   ============================================ */
@media (max-width: 768px) {
    .whatsapp-wrapper {
        bottom: 15px;
        right: 15px;
        gap: 10px;
    }
    
    .whatsapp-float {
        width: 50px;
        height: 50px;
        font-size: 26px;
    }
    
    .whatsapp-text {
        font-size: 12px;
        padding: 6px 14px;
        right: 60px;
    }
    
    .robot-icon-sm {
        font-size: 45px;
    }
    
    .tooltip-text {
        font-size: 11px;
        padding: 6px 12px;
        right: 55px;
    }
    
    .robot-message {
        width: 340px;
        height: 500px;
        max-height: 550px;
        right: -10px;
        bottom: 60px;
    }
    
    .bot-message, .user-message {
        font-size: 13px;
        padding: 10px 14px;
        max-width: 90%;
    }
    
    .chat-header {
        padding: 15px;
        font-size: 14px;
    }
    
    .chat-input {
        padding: 12px 15px;
        font-size: 13px;
    }
    
    .chat-send {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }
    
    .chat-loading {
        font-size: 12px;
    }
    
    .seta-atencao {
        right: 60px;
        top: -25px;
    }
    
    .seta-animada {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .texto-seta {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .whatsapp-wrapper {
        bottom: 10px;
        right: 10px;
        gap: 8px;
    }
    
    .whatsapp-float {
        width: 45px;
        height: 45px;
        font-size: 24px;
    }
    
    .robot-icon-sm {
        font-size: 40px;
    }
    
    .robot-message {
        width: 290px;
        height: 430px;
        max-height: 460px;
        right: -5px;
        bottom: 55px;
    }
    
    .bot-message, .user-message {
        font-size: 12px;
        padding: 8px 12px;
        max-width: 92%;
    }
    
    .chat-header {
        padding: 12px 15px;
        font-size: 13px;
    }
    
    .chat-input {
        padding: 10px 14px;
        font-size: 12px;
    }
    
    .chat-send {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    
    .close-chat {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
}

/* Telas grandes */
@media (min-width: 1400px) {
    .robot-message {
        width: 550px;
        height: 700px;
        max-height: 750px;
    }
}