/**
 * A Notícia Podcast WhatsApp - Estilos Frontend com Chat Bot
 * Arquivo: assets/whatsapp.css
 */

/* Estilos originais do botão */
.anp-whatsapp-container {
    position: fixed;
    z-index: 999999;
    pointer-events: none;
}

.anp-whatsapp-button {
    position: fixed;
    width: 60px;
    height: 60px;
    background-color: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 999999;
    pointer-events: auto;
}

.anp-whatsapp-button:hover {
    background-color: #128C7E;
    transform: scale(1.05);
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.anp-whatsapp-button:focus {
    outline: none;
    text-decoration: none;
}

.anp-whatsapp-button svg {
    transition: transform 0.3s ease;
}

.anp-whatsapp-button:hover svg {
    transform: scale(1.1);
}

/* Posicionamento */
.anp-whatsapp-button.bottom-left {
    bottom: 20px;
    left: 20px;
}

.anp-whatsapp-button.bottom-right {
    bottom: 20px;
    right: 20px;
}

.anp-whatsapp-button.top-left {
    top: 20px;
    left: 20px;
}

.anp-whatsapp-button.top-right {
    top: 20px;
    right: 20px;
}

/* Tooltip */
.anp-whatsapp-tooltip {
    position: absolute;
    background-color: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000000;
}

/* Posicionamento do tooltip */
.anp-whatsapp-button.bottom-left .anp-whatsapp-tooltip,
.anp-whatsapp-button.bottom-right .anp-whatsapp-tooltip {
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
}

.anp-whatsapp-button.top-left .anp-whatsapp-tooltip,
.anp-whatsapp-button.top-right .anp-whatsapp-tooltip {
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
}

/* Setas do tooltip */
.anp-whatsapp-tooltip::after {
    content: '';
    position: absolute;
    border: 5px solid transparent;
}

.anp-whatsapp-button.bottom-left .anp-whatsapp-tooltip::after,
.anp-whatsapp-button.bottom-right .anp-whatsapp-tooltip::after {
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-top-color: #333;
}

.anp-whatsapp-button.top-left .anp-whatsapp-tooltip::after,
.anp-whatsapp-button.top-right .anp-whatsapp-tooltip::after {
    bottom: 100%;
    left: 50%;
    margin-left: -5px;
    border-bottom-color: #333;
}

.anp-whatsapp-button:hover .anp-whatsapp-tooltip {
    opacity: 1;
    visibility: visible;
}

/* ESTILOS DO CHAT MODAL */
.anp-chat-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.anp-chat-modal.anp-show {
    opacity: 1;
    visibility: visible;
}

.anp-chat-container {
    width: 90%;
    max-width: 400px;
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.8) translateY(50px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.anp-chat-modal.anp-show .anp-chat-container {
    transform: scale(1) translateY(0);
}

/* Header do chat */
.anp-chat-header {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.anp-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.anp-chat-details h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.anp-chat-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.anp-chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background-color: #4CAF50;
    border-radius: 50%;
    display: inline-block;
}

.anp-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.anp-chat-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Body do chat */
.anp-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.anp-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Mensagens */
.anp-message {
    max-width: 85%;
    margin-bottom: 8px;
    animation: messageSlideIn 0.3s ease-out;
}

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

.anp-message-received {
    align-self: flex-start;
}

.anp-message-sent {
    align-self: flex-end;
}

.anp-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 14px;
}

.anp-message-received .anp-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.anp-message-sent .anp-message-content {
    background: #25D366;
    color: white;
    border-bottom-right-radius: 5px;
}

.anp-message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

.anp-message-received .anp-message-time {
    text-align: left;
    color: #666;
}

.anp-message-sent .anp-message-time {
    color: #ccc;
}

/* Indicador de digitação */
.anp-typing .anp-message-content {
    padding: 16px 20px;
}

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

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

.anp-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.anp-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Quick Replies */
.anp-quick-replies {
    padding: 15px 20px;
    background: #f0f2f5;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid #e4e6ea;
}

.anp-quick-reply {
    background: white;
    border: 1px solid #25D366;
    color: #25D366;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-weight: 500;
}

.anp-quick-reply:hover {
    background: #25D366;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

/* Footer do chat */
.anp-chat-footer {
    background: white;
    border-top: 1px solid #e4e6ea;
    padding: 15px 20px;
}

.anp-chat-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f2f5;
    border-radius: 25px;
    padding: 8px 15px;
}

#anp-chat-input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    padding: 8px 0;
    font-family: inherit;
}

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

#anp-chat-send {
    background: #25D366;
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#anp-chat-send:hover {
    background: #128C7E;
    transform: scale(1.05);
}

/* Animações originais do botão */
@keyframes anp-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
}

@keyframes anp-bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }
    70% {
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

@keyframes anp-shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-3px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(3px);
    }
}

/* Aplicar animações */
.anp-whatsapp-button.pulse {
    animation: anp-pulse 2s infinite;
}

.anp-whatsapp-button.bounce {
    animation: anp-bounce 2s infinite;
}

.anp-whatsapp-button.shake {
    animation: anp-shake 3s infinite;
}

.anp-whatsapp-button.pulse:hover,
.anp-whatsapp-button.bounce:hover,
.anp-whatsapp-button.shake:hover {
    animation: none;
}

/* Responsividade */
@media (max-width: 768px) {
    .anp-whatsapp-button {
        width: 55px;
        height: 55px;
    }
    
    .anp-whatsapp-button svg {
        width: 20px;
        height: 20px;
    }
    
    .anp-whatsapp-tooltip {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .anp-whatsapp-button.bottom-left .anp-whatsapp-tooltip,
    .anp-whatsapp-button.bottom-right .anp-whatsapp-tooltip {
        bottom: 65px;
    }
    
    .anp-whatsapp-button.top-left .anp-whatsapp-tooltip,
    .anp-whatsapp-button.top-right .anp-whatsapp-tooltip {
        top: 65px;
    }
    
    /* Chat modal em mobile */
    .anp-chat-container {
        width: 95%;
        height: 90vh;
        max-height: 600px;
        border-radius: 15px;
    }
    
    .anp-chat-header {
        padding: 15px 20px;
    }
    
    .anp-chat-avatar {
        width: 40px;
        height: 40px;
    }
    
    .anp-quick-replies {
        padding: 12px 15px;
    }
    
    .anp-quick-reply {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .anp-chat-footer {
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    .anp-whatsapp-button {
        width: 50px;
        height: 50px;
    }
    
    .anp-whatsapp-button svg {
        width: 18px;
        height: 18px;
    }
    
    .anp-whatsapp-button.bottom-left,
    .anp-whatsapp-button.top-left {
        left: 15px;
    }
    
    .anp-whatsapp-button.bottom-right,
    .anp-whatsapp-button.top-right {
        right: 15px;
    }
    
    .anp-whatsapp-button.bottom-left,
    .anp-whatsapp-button.bottom-right {
        bottom: 15px;
    }
    
    .anp-whatsapp-button.top-left,
    .anp-whatsapp-button.top-right {
        top: 15px;
    }
    
    .anp-chat-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        max-height: none;
    }
    
    .anp-chat-modal {
        padding: 0;
    }
}

/* Ocultar em dispositivos específicos */
.anp-hide-mobile {
    display: block;
}

.anp-hide-desktop {
    display: block;
}

@media (max-width: 768px) {
    .anp-hide-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .anp-hide-desktop {
        display: none !important;
    }
}

/* Estados de foco para acessibilidade */
.anp-whatsapp-button:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.anp-chat-close:focus,
#anp-chat-send:focus,
.anp-quick-reply:focus {
    outline: 2px solid #25D366;
    outline-offset: 2px;
}

#anp-chat-input:focus {
    outline: none;
}

/* Efeito de loading */
.anp-whatsapp-button.loading {
    pointer-events: none;
    opacity: 0.7;
}

.anp-whatsapp-button.loading svg {
    animation: spin 1s linear infinite;
}

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

/* Scrollbar customizada para o chat */
.anp-chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.anp-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.anp-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}