/**
 * ====================================
 * WHATSAPP WIDGET INTERATIVO - STYLES
 * Popup moderno e responsivo
 * ====================================
 */

/* ===================================
   POPUP BASE
   =================================== */

.whatsapp-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.whatsapp-popup.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.whatsapp-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.whatsapp-popup-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 440px;
    max-height: 90vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.whatsapp-popup.active .whatsapp-popup-content {
    transform: translate(-50%, -50%) scale(1);
}

/* ===================================
   HEADER
   =================================== */

.whatsapp-popup-header {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    position: relative;
}

.whatsapp-popup-avatar {
    position: relative;
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.whatsapp-popup-avatar svg {
    width: 32px;
    height: 32px;
}

.whatsapp-status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
    background: #ccc;
    transition: background 0.3s ease;
}

.whatsapp-status-indicator.online {
    background: #4CAF50;
    animation: pulse-green 2s infinite;
}

.whatsapp-status-indicator.offline {
    background: #9E9E9E;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
    50% { box-shadow: 0 0 0 6px rgba(76, 175, 80, 0); }
}

.whatsapp-popup-info h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.whatsapp-status-text {
    margin: 4px 0 0;
    font-size: 13px;
    opacity: 0.9;
}

.whatsapp-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.whatsapp-popup-close:hover {
    background: rgba(0, 0, 0, 0.3);
    transform: rotate(90deg);
}

/* ===================================
   BODY
   =================================== */

.whatsapp-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
}

.whatsapp-message-preview {
    margin-bottom: 20px;
}

.whatsapp-bubble {
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    max-width: 85%;
    margin-bottom: 12px;
}

/* Mensagem do bot */
.whatsapp-bot-message {
    background: white;
}

.whatsapp-bot-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 8px 0;
    border-color: transparent white transparent transparent;
}

.whatsapp-bubble p {
    margin: 0 0 8px;
    font-size: 15px;
    color: #333;
    white-space: pre-line;
}

.whatsapp-time {
    font-size: 11px;
    color: #999;
    display: block;
    text-align: right;
}

/* ===================================
   FORM
   =================================== */

.whatsapp-form {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.whatsapp-form-group {
    margin-bottom: 16px;
    position: relative;
    transition: all 0.3s ease;
}

.whatsapp-form-group:last-child {
    margin-bottom: 0;
}

.whatsapp-form-group.focused {
    transform: translateY(-2px);
}

.whatsapp-form-group.valid input,
.whatsapp-form-group.valid select {
    border-color: #25D366;
}

.whatsapp-form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.whatsapp-form-group label svg {
    color: #25D366;
    flex-shrink: 0;
}

.whatsapp-char-count {
    margin-left: auto;
    font-size: 12px;
    color: #999;
    font-weight: 400;
}

.whatsapp-field-check {
    position: absolute;
    top: 42px;
    right: 12px;
    color: #25D366;
    font-size: 18px;
    font-weight: bold;
    display: none;
    animation: checkPop 0.3s ease;
}

@keyframes checkPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.whatsapp-form-group input,
.whatsapp-form-group select,
.whatsapp-form-group textarea {
    width: 100%;
    padding: 12px;
    padding-right: 40px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.whatsapp-form-group input:focus,
.whatsapp-form-group select:focus,
.whatsapp-form-group textarea:focus {
    outline: none;
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.whatsapp-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Sugestões contextuais */
.whatsapp-suggestions {
    margin-top: 8px;
    padding: 12px;
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    border-left: 4px solid #25D366;
    border-radius: 8px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.whatsapp-suggestions.show {
    opacity: 1;
    transform: translateY(0);
}

.whatsapp-suggestions-title {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 600;
    color: #2E7D32;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.whatsapp-suggestions-text {
    margin: 0;
    font-size: 13px;
    color: #1B5E20;
    line-height: 1.5;
}

.whatsapp-send-btn {
    width: 100%;
    padding: 14px;
    background: #ccc;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: not-allowed;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    margin-top: 16px;
    opacity: 0.6;
}

.whatsapp-send-btn.enabled {
    background: linear-gradient(135deg, #25D366 0%, #20BA5A 100%);
    cursor: pointer;
    opacity: 1;
}

.whatsapp-send-btn.enabled:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.whatsapp-send-btn.enabled:active {
    transform: translateY(0);
}

.whatsapp-send-btn:disabled {
    cursor: not-allowed;
}

.whatsapp-send-btn svg {
    animation: float 2s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(3px); }
}

/* ===================================
   QUICK ACTIONS
   =================================== */

.whatsapp-quick-actions {
    background: white;
    padding: 16px;
    border-radius: 12px;
}

.whatsapp-quick-actions p {
    margin: 0 0 12px;
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.whatsapp-quick-btn {
    width: 100%;
    padding: 12px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.whatsapp-quick-btn:last-child {
    margin-bottom: 0;
}

.whatsapp-quick-btn:hover {
    background: #f5f5f5;
    border-color: #25D366;
    color: #25D366;
    transform: translateX(4px);
}

/* ===================================
   FOOTER
   =================================== */

.whatsapp-popup-footer {
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
}

.whatsapp-popup-footer svg {
    color: #25D366;
}

/* ===================================
   BOTÃO FLUTUANTE - MELHORIAS
   =================================== */

.whatsapp-float.online::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: #4CAF50;
    border: 2px solid white;
    border-radius: 50%;
    animation: pulse-green 2s infinite;
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 480px) {
    .whatsapp-popup-content {
        width: 95%;
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .whatsapp-popup-header {
        padding: 16px;
    }
    
    .whatsapp-popup-avatar {
        width: 48px;
        height: 48px;
    }
    
    .whatsapp-popup-avatar svg {
        width: 28px;
        height: 28px;
    }
    
    .whatsapp-popup-info h3 {
        font-size: 16px;
    }
    
    .whatsapp-popup-body {
        padding: 16px;
    }
    
    .whatsapp-form {
        padding: 16px;
    }
    
    .whatsapp-quick-actions {
        padding: 12px;
    }
}

/* ===================================
   ANIMAÇÕES
   =================================== */

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

.whatsapp-bot-message {
    animation: slideUp 0.4s ease;
}

/* ===================================
   ACESSIBILIDADE
   =================================== */

@media (prefers-reduced-motion: reduce) {
    .whatsapp-popup,
    .whatsapp-popup-content,
    .whatsapp-send-btn,
    .whatsapp-quick-btn {
        transition: none !important;
        animation: none !important;
    }
}

/* ===================================
   SCROLLBAR CUSTOMIZADA
   =================================== */

.whatsapp-popup-body::-webkit-scrollbar {
    width: 6px;
}

.whatsapp-popup-body::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.whatsapp-popup-body::-webkit-scrollbar-thumb {
    background: #25D366;
    border-radius: 3px;
}

.whatsapp-popup-body::-webkit-scrollbar-thumb:hover {
    background: #20BA5A;
}
