/**
 * WhatsApp Floating Button Styles
 */

/* Base container */
#edmark-whatsapp-container {
    position: fixed;
    bottom: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

#edmark-whatsapp-container.show {
    opacity: 1;
    transform: translateY(0);
}

/* Position variants */
#edmark-whatsapp-container.position-right {
    right: 20px;
}

#edmark-whatsapp-container.position-left {
    left: 20px;
}

/* Mobile only visibility */
#edmark-whatsapp-container.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    #edmark-whatsapp-container.mobile-only {
        display: block;
    }
}

/* Simple button style */
.whatsapp-simple-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: #25d366;
    border-radius: 50%;
    color: white;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
    position: relative;
    animation: pulse 2s infinite;
}

.whatsapp-simple-btn:hover {
    background: #128c7e;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
    color: white;
    text-decoration: none;
}

.whatsapp-simple-btn svg {
    width: 28px;
    height: 28px;
}

/* Tooltip */
.whatsapp-tooltip {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.position-left .whatsapp-tooltip {
    right: auto;
    left: 70px;
}

.whatsapp-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -5px;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #333;
}

.position-left .whatsapp-tooltip::after {
    left: auto;
    right: -5px;
    border-right-color: transparent;
    border-left-color: #333;
}

.whatsapp-simple-btn:hover .whatsapp-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Chat window style */
.whatsapp-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 300px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

.position-left .whatsapp-chat-window {
    right: auto;
    left: 0;
}

.whatsapp-chat-window.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chat-header {
    background: #25d366;
    color: white;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    padding: 2px;
}

.chat-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.online-status {
    font-size: 12px;
    opacity: 0.9;
}

.chat-close {
    margin-left: auto;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-body {
    padding: 20px 15px;
    background: #f0f0f0;
}

.chat-message {
    background: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative;
}

.chat-message::before {
    content: '';
    position: absolute;
    top: 15px;
    left: -8px;
    border: 8px solid transparent;
    border-right-color: white;
}

.chat-message p {
    margin: 0;
    font-size: 14px;
    color: #333;
}

.chat-footer {
    padding: 15px;
    background: white;
}

.chat-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: #25d366;
    color: white;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.3s ease;
}

.chat-send-btn:hover {
    background: #128c7e;
    color: white;
    text-decoration: none;
}

/* Toggle button for chat window */
.whatsapp-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: #25d366;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
    position: relative;
    animation: pulse 2s infinite;
}

.whatsapp-toggle-btn:hover {
    background: #128c7e;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

.whatsapp-toggle-btn svg {
    width: 28px;
    height: 28px;
    transition: opacity 0.3s ease;
}

.whatsapp-toggle-btn .close-icon {
    position: absolute;
    opacity: 0;
}

.whatsapp-toggle-btn.active .whatsapp-icon {
    opacity: 0;
}

.whatsapp-toggle-btn.active .close-icon {
    opacity: 1;
}

.whatsapp-toggle-btn:hover .whatsapp-tooltip {
    opacity: 1;
    visibility: visible;
}

/* QR Code Modal */
.whatsapp-qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 300px;
    width: 90%;
    position: relative;
}

.qr-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.qr-modal-content h3 {
    margin: 0 0 20px 0;
    color: #333;
}

.qr-code-container {
    margin: 20px 0;
}

.qr-code-container img {
    max-width: 100%;
    height: auto;
}

.qr-modal-content p {
    margin: 20px 0 0 0;
    color: #666;
    font-size: 14px;
}

/* Pulse animation */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }
    50% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4), 0 0 0 10px rgba(37, 211, 102, 0.1);
    }
    100% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }
}

/* Dark theme */
.style-dark .whatsapp-simple-btn,
.style-dark .whatsapp-toggle-btn {
    background: #128c7e;
}

.style-dark .whatsapp-simple-btn:hover,
.style-dark .whatsapp-toggle-btn:hover {
    background: #075e54;
}

.style-dark .chat-header {
    background: #128c7e;
}

.style-dark .chat-send-btn {
    background: #128c7e;
}

.style-dark .chat-send-btn:hover {
    background: #075e54;
}

/* Auto theme (follows system preference) */
@media (prefers-color-scheme: dark) {
    .style-auto .whatsapp-simple-btn,
    .style-auto .whatsapp-toggle-btn {
        background: #128c7e;
    }
    
    .style-auto .whatsapp-simple-btn:hover,
    .style-auto .whatsapp-toggle-btn:hover {
        background: #075e54;
    }
    
    .style-auto .chat-header {
        background: #128c7e;
    }
    
    .style-auto .chat-send-btn {
        background: #128c7e;
    }
    
    .style-auto .chat-send-btn:hover {
        background: #075e54;
    }
    
    .style-auto .whatsapp-tooltip {
        background: #444;
    }
    
    .style-auto .whatsapp-tooltip::after {
        border-right-color: #444;
    }
    
    .style-auto .position-left .whatsapp-tooltip::after {
        border-right-color: transparent;
        border-left-color: #444;
    }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .whatsapp-chat-window {
        width: 280px;
        bottom: 70px;
    }
    
    .position-right .whatsapp-chat-window {
        right: -10px;
    }
    
    .position-left .whatsapp-chat-window {
        left: -10px;
    }
    
    #edmark-whatsapp-container.position-right {
        right: 15px;
    }
    
    #edmark-whatsapp-container.position-left {
        left: 15px;
    }
    
    .whatsapp-simple-btn,
    .whatsapp-toggle-btn {
        width: 55px;
        height: 55px;
    }
    
    .whatsapp-simple-btn svg,
    .whatsapp-toggle-btn svg {
        width: 24px;
        height: 24px;
    }
    
    .whatsapp-tooltip {
        display: none; /* Hide tooltips on mobile */
    }
}

/* Accessibility improvements */
.whatsapp-simple-btn:focus,
.whatsapp-toggle-btn:focus,
.chat-send-btn:focus {
    outline: 2px solid #25d366;
    outline-offset: 2px;
}

.chat-close:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    #edmark-whatsapp-container {
        display: none !important;
    }
}
