/* WhatsApp Analytics Pro - Enhanced Styles with Improved Loading States */

/* WhatsApp Button Styles */
.wap-whatsapp-button {
    position: fixed !important;
    z-index: 9999 !important;
    background-color: #25D366 !important;
    color: white !important;
    padding: 12px 24px !important;
    border-radius: 50px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3) !important;
    transition: all 0.3s ease !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    border: none !important;
    outline: none !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.wap-whatsapp-button:hover {
    background-color: #128C7E !important;
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.4) !important;
    color: white !important;
    text-decoration: none !important;
}

.wap-whatsapp-button:focus {
    outline: 2px solid #ffffff !important;
    outline-offset: 2px !important;
}

.wap-whatsapp-button:active {
    transform: translateY(0) scale(1.02) !important;
}

/* Loading state for button */
.wap-whatsapp-button.loading {
    opacity: 0.8 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    animation: buttonPulse 1.5s ease-in-out infinite !important;
}

.wap-whatsapp-button.loading::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 20px !important;
    height: 20px !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-top: 2px solid white !important;
    border-radius: 50% !important;
    animation: spin 1s linear infinite !important;
    transform: translate(-50%, -50%) !important;
    z-index: 1 !important;
}

.wap-whatsapp-button.loading span,
.wap-whatsapp-button.loading svg {
    opacity: 0.3 !important;
}

/* Position variations */
.wap-whatsapp-button.bottom-right {
    bottom: 30px !important;
    right: 30px !important;
}

.wap-whatsapp-button.bottom-left {
    bottom: 30px !important;
    left: 30px !important;
}

.wap-whatsapp-button.top-right {
    top: 30px !important;
    right: 30px !important;
}

.wap-whatsapp-button.top-left {
    top: 30px !important;
    left: 30px !important;
}

/* Enhanced animations */
@keyframes buttonPulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 0.8; 
    }
    50% { 
        transform: scale(1.05); 
        opacity: 0.9; 
    }
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes float {
    0%, 100% { 
        transform: translateY(0); 
    }
    50% { 
        transform: translateY(-10px); 
    }
}

.wap-whatsapp-button.floating {
    animation: float 3s ease-in-out infinite;
}

/* Pulse animation for attention */
@keyframes pulse {
    0% { 
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3); 
    }
    50% { 
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.6); 
    }
    100% { 
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3); 
    }
}

.wap-whatsapp-button.pulse {
    animation: pulse 2s ease-in-out;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .wap-whatsapp-button {
        padding: 10px 18px !important;
        font-size: 14px !important;
        border-radius: 40px !important;
    }
    
    .wap-whatsapp-button.bottom-right,
    .wap-whatsapp-button.bottom-left {
        bottom: 20px !important;
    }
    
    .wap-whatsapp-button.top-right,
    .wap-whatsapp-button.top-left {
        top: 20px !important;
    }
    
    .wap-whatsapp-button.bottom-right,
    .wap-whatsapp-button.top-right {
        right: 20px !important;
    }
    
    .wap-whatsapp-button.bottom-left,
    .wap-whatsapp-button.top-left {
        left: 20px !important;
    }
    
    .wap-whatsapp-button svg {
        width: 20px !important;
        height: 20px !important;
    }
}

/* Small screens */
@media (max-width: 480px) {
    .wap-whatsapp-button {
        padding: 8px 16px !important;
        font-size: 13px !important;
        gap: 8px !important;
    }
    
    .wap-whatsapp-button span {
        display: none !important;
    }
    
    .wap-whatsapp-button {
        width: 50px !important;
        height: 50px !important;
        border-radius: 50% !important;
        justify-content: center !important;
        padding: 0 !important;
    }
    
    .wap-whatsapp-button svg {
        width: 24px !important;
        height: 24px !important;
    }
}

/* Modal Styles */
.wap-modal {
    display: none !important;
    position: fixed !important;
    z-index: 10000 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(5px) !important;
    animation: fadeIn 0.3s ease-out !important;
}

.wap-modal-content {
    background-color: white !important;
    margin: 5% auto !important;
    padding: 0 !important;
    border-radius: 12px !important;
    width: 90% !important;
    max-width: 500px !important;
    position: relative !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2) !important;
    overflow: hidden !important;
    animation: slideIn 0.3s ease-out !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.wap-modal-header {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
    color: white !important;
    padding: 25px 30px !important;
    position: relative !important;
}

.wap-modal-close {
    color: white !important;
    position: absolute !important;
    right: 20px !important;
    top: 20px !important;
    font-size: 28px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    width: 30px !important;
    height: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.2) !important;
    transition: all 0.3s ease !important;
}

.wap-modal-close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: rotate(90deg) !important;
}

.wap-modal-body {
    padding: 30px !important;
}

/* Enhanced Form Styles */
.wap-form-group {
    margin-bottom: 20px !important;
    position: relative !important;
}

.wap-form-label {
    display: block !important;
    margin-bottom: 8px !important;
    font-weight: 600 !important;
    color: #374151 !important;
    font-size: 14px !important;
}

.wap-form-input {
    width: 100% !important;
    padding: 12px 16px !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    transition: all 0.3s ease !important;
    box-sizing: border-box !important;
    font-family: inherit !important;
    background-color: white !important;
}

.wap-form-input:focus {
    outline: none !important;
    border-color: #25D366 !important;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1) !important;
    transform: translateY(-1px) !important;
}

.wap-form-input.error {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

.wap-form-input.success {
    border-color: #22c55e !important;
    background-color: #f0fdf4 !important;
}

.wap-form-input.success::after {
    content: '✓' !important;
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #22c55e !important;
    font-weight: bold !important;
}

.wap-form-textarea {
    resize: vertical !important;
    min-height: 100px !important;
}

.wap-form-helper {
    color: #6b7280 !important;
    font-size: 12px !important;
    margin-top: 5px !important;
    display: block !important;
}

.wap-form-error {
    color: #ef4444 !important;
    font-size: 12px !important;
    margin-top: 5px !important;
    display: block !important;
}

.wap-checkbox-group {
    display: flex !important;
    align-items: flex-start !important;
    cursor: pointer !important;
}

.wap-checkbox {
    margin-right: 12px !important;
    margin-top: 2px !important;
    transform: scale(1.2) !important;
}

.wap-checkbox-label {
    font-size: 14px !important;
    color: #6b7280 !important;
    line-height: 1.5 !important;
    cursor: pointer !important;
}

/* Enhanced Submit Button */
.wap-submit-btn {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
    color: white !important;
    padding: 14px 20px !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    width: 100% !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    position: relative !important;
    overflow: hidden !important;
    min-height: 50px !important;
}

.wap-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.3) !important;
}

.wap-submit-btn:active {
    transform: translateY(0) !important;
}

.wap-submit-btn:disabled {
    opacity: 0.7 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.wap-submit-btn.loading {
    pointer-events: none !important;
}

/* Enhanced Loading spinner */
.wap-spinner {
    display: inline-block !important;
    width: 20px !important;
    height: 20px !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-top: 2px solid #ffffff !important;
    border-radius: 50% !important;
    animation: spin 1s linear infinite !important;
}

/* Enhanced Notification Styles */
.wap-notification {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 10001 !important;
    padding: 12px 20px !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 14px !important;
    max-width: 300px !important;
    word-wrap: break-word !important;
    cursor: pointer !important;
    animation: slideInRight 0.3s ease-out !important;
    border-left: 4px solid rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(10px) !important;
}

.wap-notification-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
    color: white !important;
}

.wap-notification-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: white !important;
}

.wap-notification-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: white !important;
}

.wap-notification-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    color: white !important;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Admin Dashboard Styles */
.wap-summary-cards {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 20px !important;
    margin: 20px 0 !important;
}

.wap-card {
    background: white !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    padding: 20px !important;
    text-align: center !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    overflow: hidden !important;
}

.wap-card::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 4px !important;
    background: linear-gradient(90deg, #25D366 0%, #128C7E 100%) !important;
}

.wap-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.wap-card h3 {
    font-size: 32px !important;
    margin: 0 0 10px 0 !important;
    color: #25D366 !important;
    font-weight: 700 !important;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

.wap-card p {
    margin: 0 !important;
    color: #6b7280 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}

/* Debug mode indicator */
.wap-debug-indicator {
    position: fixed !important;
    top: 10px !important;
    left: 10px !important;
    background: #ef4444 !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 10px !important;
    font-weight: bold !important;
    z-index: 10000 !important;
    animation: debugBlink 2s ease-in-out infinite !important;
}

@keyframes debugBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.5; }
}

/* Enhanced table styles for analytics */
.wap-analytics-table {
    border-collapse: collapse !important;
    width: 100% !important;
    font-size: 13px !important;
}

.wap-analytics-table th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    padding: 12px 8px !important;
    text-align: left !important;
    font-weight: 600 !important;
    border-bottom: 2px solid #dee2e6 !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
}

.wap-analytics-table td {
    padding: 10px 8px !important;
    border-bottom: 1px solid #e9ecef !important;
    vertical-align: top !important;
}

.wap-analytics-table tr:hover {
    background-color: #f8f9fa !important;
}

/* Mobile responsive improvements */
@media (max-width: 768px) {
    .wap-modal-content {
        margin: 10% auto !important;
        width: 95% !important;
    }
    
    .wap-modal-header {
        padding: 20px !important;
    }
    
    .wap-modal-body {
        padding: 20px !important;
    }
    
    .wap-notification {
        right: 10px !important;
        left: 10px !important;
        max-width: none !important;
    }
    
    .wap-form-input {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }
    
    .wap-summary-cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
        gap: 15px !important;
    }
}

@media (max-width: 480px) {
    .wap-modal-content {
        margin: 5% auto !important;
        width: 98% !important;
        border-radius: 8px !important;
    }
    
    .wap-modal-header {
        padding: 15px !important;
    }
    
    .wap-modal-header h2 {
        font-size: 20px !important;
    }
    
    .wap-modal-body {
        padding: 15px !important;
    }
    
    .wap-card {
        padding: 15px !important;
    }
    
    .wap-card h3 {
        font-size: 24px !important;
    }
}

/* Print styles */
@media print {
    .wap-whatsapp-button,
    .wap-modal,
    .wap-notification {
        display: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .wap-whatsapp-button {
        border: 2px solid currentColor !important;
    }
    
    .wap-form-input:focus {
        outline: 3px solid currentColor !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .wap-whatsapp-button,
    .wap-modal,
    .wap-notification,
    .wap-card {
        animation: none !important;
        transition: none !important;
    }
    
    .wap-whatsapp-button.floating,
    .wap-whatsapp-button.pulse {
        animation: none !important;
    }
    
    .wap-whatsapp-button.loading::after {
        animation: none !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .wap-modal-content {
        background-color: #1f2937 !important;
        color: white !important;
    }
    
    .wap-form-input {
        background-color: #374151 !important;
        border-color: #4b5563 !important;
        color: white !important;
    }
    
    .wap-form-input:focus {
        border-color: #25D366 !important;
        background-color: #374151 !important;
    }
    
    .wap-card {
        background-color: #1f2937 !important;
        border-color: #374151 !important;
        color: white !important;
    }
}