=== Nexu Stats: Visitor Traffic & Real-Time Statistics Plugin for WordPress ===
Contributors: nexuwp
Tags: analytics, statistics, tracking, visitors, ai
Requires at least: 6.0
Tested up to: 6.8
Stable tag: 2.49.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Professional analytics system with deep insights, AI-powered reports, real-time tracking, and comprehensive visitor analysis. Zero impact on site speed.

== Description ==

NexuStats is a powerful, professional-grade analytics plugin for WordPress that provides deep insights into your website's performance without slowing down your site.

= Key Features =

* **Real-Time Analytics** - Monitor visitors as they browse your site
* **AI-Powered Insights** - Get intelligent analysis and recommendations
* **Zero Speed Impact** - Optimized tracking using Beacon API
* **Cache Compatible** - Works perfectly with all major caching plugins
* **Bot Detection** - Advanced algorithms to filter out bot traffic
* **Geographic Data** - See where your visitors are coming from
* **Device Analytics** - Track desktop, mobile, and tablet usage
* **Privacy Compliant** - GDPR-ready with IP anonymization
* **Beautiful Dashboard** - Modern, intuitive interface
* **Automated Reports** - Daily, weekly, and monthly email reports

= What Makes NexuStats Different? =

1. **Performance First** - Uses async JavaScript and Beacon API for zero impact on page load
2. **Cache Friendly** - Designed to work seamlessly with caching plugins
3. **AI Analysis** - Deep insights powered by artificial intelligence
4. **Complete Privacy** - GDPR compliant with IP anonymization
5. **Professional Design** - Clean, modern interface that's easy to use

= Perfect For =

* Bloggers who want to understand their audience
* Business owners tracking website performance
* Marketers analyzing campaign effectiveness
* Developers needing detailed technical data
* Anyone who values privacy and performance

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/nexustats/`
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Go to NexuStats in your admin menu
4. Configure your settings and start tracking!

== Frequently Asked Questions ==

= Does this plugin slow down my website? =

No! NexuStats is specifically designed for zero performance impact. It uses async JavaScript and Beacon API to ensure your site stays fast.

= Is it compatible with caching plugins? =

Yes! NexuStats works perfectly with all major caching plugins including WP Super Cache, W3 Total Cache, WP Rocket, and LiteSpeed Cache.

= Is it GDPR compliant? =

Yes! NexuStats includes IP anonymization and other privacy features to help you comply with GDPR and other privacy regulations.

= Do I need an API key for AI features? =

Yes, for AI-powered analysis you'll need an API key from OpenAI, Anthropic, or Google. The basic analytics work without any API key.

= Does it track bots? =

NexuStats has advanced bot detection to filter out bot traffic, giving you accurate human visitor data.

== Screenshots ==

1. Overview Dashboard - Beautiful stats at a glance
2. Real-Time Analytics - See visitors as they browse
3. Geographic Map - Visualize where your traffic comes from
4. AI Analysis - Get intelligent insights and recommendations
5. Device Analytics - Understand your audience's devices
6. Settings Panel - Easy configuration options

== Changelog ==

= 2.49.0 =
* Added: New Settings action to reset all analytics data from admin UI with confirmation and secure AJAX handling.
* Added: Backend reset endpoint to clear visits, pageviews, bot statistics, and AI report records while preserving plugin settings.
* Improved: Reset flow now provides clear success/error feedback and auto-refreshes dashboard after completion.

= 2.48.0 =
* Changed: New sessions are now stored as `Pending Validation (<10s)` and excluded from human analytics until they pass the 10-second threshold.
* Fixed: Sessions under 10 seconds are consistently classified as `Short Session (<10s)` and kept out of core visit metrics.
* Added: Frontend heartbeat duration updates (every 5 seconds while visible) to promote valid sessions to human traffic without waiting for page unload.
* Improved: Duration update flow now supports reliable promotion from pending/short-session state to human when duration reaches 10+ seconds.

= 2.47.0 =
* Fixed: Corrected RTL alignment for Real-Time Session Journey header by removing reversed flex direction that pushed section title to the wrong side.
* Improved: Header actions now use logical spacing (`margin-inline-start`) for stable RTL/LTR placement.

= 2.46.0 =
* Fixed: Real-Time "Live Session Journey" header layout now renders correctly in RTL with proper alignment for icon, title, toggle, and action buttons.
* Improved: Added scoped header/action flex wrapping and RTL icon spacing rules to prevent broken/misaligned controls.

= 2.45.0 =
* Fixed: Real-Time top stat cards now use a dedicated 4-column layout so the header stats row fills the full width without an empty slot.
* Improved: Applied scoped layout class for Real-Time cards only, keeping other dashboard stat sections unchanged.

= 2.44.0 =
* Fixed: Translation loading now prioritizes plugin PO files directly for immediate application of edited translations.
* Improved: Prevents stale MO/L10N precedence by using PO-first strategy inside plugin `languages`.

= 2.43.0 =
* Fixed: Added direct PO fallback loader from plugin `languages` when `mo/l10n.php` is not applied, ensuring edited translations load reliably.
* Improved: Translation flow now keeps plugin-local loading and supports repeated in-plugin re-translation without forcing external language paths.

= 2.42.0 =
* Fixed: Translation updates now auto-apply by regenerating `*.mo` from plugin `*.po` when the PO file is newer.
* Improved: Translation loading now prioritizes plugin `*.mo` files before `*.l10n.php` to prevent stale PHP translation cache precedence.
* Improved: Keeps translation loading fully inside plugin `languages` and supports repeated re-translation without manual MO rebuild steps.

= 2.41.0 =
* Fixed: Persian translation now loads correctly from inside plugin `languages` by adding a valid `nexustats-fa_IR.mo` file.
* Fixed: Removed empty `nexustats-fa_IR.l10n.php` file that was overriding valid translations with blank messages.
* Verified: Runtime translation lookup now resolves plugin strings (example: `ACTIVE` -> `فعال`).

= 2.40.0 =
* Changed: Translations now load strictly from the plugin `languages` directory and no longer read from WordPress root language paths.
* Improved: Locale-aware loading flow remains in place with empty `.l10n.php` protection for reliable in-plugin translation behavior.

= 2.39.0 =
* Fixed: Translation loading now runs early on `plugins_loaded` and checks both `WP_LANG_DIR/plugins` and plugin `languages` paths.
* Fixed: Empty `.l10n.php` files are now ignored to prevent overriding valid translations with blank message sets.
* Improved: Added safer textdomain loading flow using `load_textdomain()` with locale-aware file resolution.

= 2.38.0 =
* Changed: AI report prompt now explicitly disallows emoji and decorative symbols in generated analysis.
* Changed: Report structure templates were cleaned from emoji-based section titles for a more professional management format.
* Added: Server-side emoji stripping in report generation to guarantee emoji-free AI reports before rendering and emailing.

= 2.37.0 =
* Added: Local RTL settings font support with bundled `IMedium.woff2` asset from Nexu Mail SMTP for consistent Persian/Arabic admin typography.
* Improved: RTL font loading is now scoped strictly to NexuStats settings wrapper and does not affect LTR UI.
* Improved: Admin controller now enqueues dedicated RTL font stylesheet only when WordPress is in RTL mode.

= 2.36.0 =
* Improved: AI prompt instructions were refined for concise, executive-style reporting without embedding explicit language directives in prompt text.
* Improved: Report structure guidance now focuses on KPI-first management summaries, clearer priorities, and shorter actionable plans.
* Improved: Email report templates were fully redesigned with unified table-safe responsive layouts for stronger compatibility across Gmail, Outlook, and mobile clients.

= 2.35.0 =
* Improved: AI report scheduler now uses WordPress timezone consistently for generate/send scheduling and cleanup scheduling.
* Changed: Reports are now generated 10 minutes before configured time and sent exactly at configured time.
* Added: Dedicated cron hooks for exact-time send (`*_report_send`) for daily/weekly/monthly reports.
* Added: Automatic fallback in send jobs to generate report if pre-generation was missed, then send immediately at target time.
* Improved: Debug tab now shows separate generate/send cron jobs for better schedule visibility.

= 2.34.0 =
* Added: Sessions with duration under 10 seconds are automatically classified as suspicious bot traffic and excluded from core analytics.
* Improved: Short-session bot reclassification is reversible when the same session later exceeds 10 seconds, preventing false positives.
* Fixed: Visitor new/returning calculations now consistently ignore bot traffic in historical subqueries.

= 2.33.0 =
* Security: Hardened REST tracking endpoint with nonce-based permission checks and server-side rate limiting.
* Fixed: Realtime, filter, and export queries now align with actual database schema fields (`viewed_at`, `country_name`, `referrer_url`, `page_views`).
* Fixed: Realtime active-pages queries now use valid joins and timestamps to prevent invalid counts.
* Fixed: Cleanup cron now purges pageviews using `viewed_at` and also cleans bot stats by retention policy.
* Improved: Admin assets now prefer local vendor paths with CDN fallback for better marketplace compatibility.
* Improved: Removed external bot-country emoji image dependency in favor of local Unicode flag rendering.

= 2.32.0 =
* Fixed: Header "Save Changes" now uses native form submission (`requestSubmit`) with fallbacks for better reliability on the Settings tab.
* Improved: Added robust form lookup fallback for legacy settings form IDs to prevent no-op clicks.

= 2.31.0 =
* Improved: Multi-layer bot detection engine now combines known signatures, behavioral heuristics, request frequency, and browser integrity signals.
* Added: Suspicious automation traffic is now classified and recorded in bot statistics instead of inflating human visit analytics.
* Enhanced: Frontend tracker now sends additional browser integrity metadata (webdriver, plugins count, platform, touch points, tracking source).
* Improved: Bot detection debug insights include scoring and reason codes (when WP_DEBUG and plugin debug mode are enabled).

= 2.30.0 =
* Fixed: Tab-specific settings now save safely without resetting settings from other tabs.
* Fixed: Header "Save Changes" button now targets only savable settings forms and shows proper feedback on non-settings tabs.
* Fixed: Fallback admin nonce mismatch in settings page output, improving reliability of AJAX actions.
* Improved: Admin assets now load consistently on NexuStats tab routes and welcome page.

= 2.29.0 =
* NEW: Beautiful Welcome Page on first activation
* Added: First-time setup wizard with feature highlights
* Added: Modern welcome screen with mascot image
* Enhanced: Improved first-time user experience
* Improved: Direct links to key features from welcome page

= 2.28.4 =
* Fixed: Corrected spelling of Grok (xAI) and updated API endpoints
* Improved: Updated models list for Grok provider

= 2.28.3 =
* Improved: Removed emojis and cleaned up AI provider names in settings
* Fixed: Visual consistency in AI Analysis tab

= 2.28.2 =
* Fixed: Improved chart rendering stability in Device Types tab
* Improved: Added min-height and better alignment for chart containers

= 2.28.1 =
* Improved: Reduced spacing (padding and margin) for the date filter component

= 2.28.0 =
* Improved: Stat cards now display in a single row (5 columns) on desktop
* Fixed: Updated hardcoded blue gradients and colors in tabs to match theme
* Enhanced: Visual consistency across all reporting sections

= 2.27.9 =
* Improved: Increased admin panel width for better space utilization
* Fixed: Remaining blue colors in tabs updated to Indigo/Violet theme

= 2.27.8 =
* Changed: Updated color scheme to Indigo/Violet gradient theme (matching Nexu WP design system)
* Added: Outfit Google Font for titles and headings
* Enhanced: Modern gradient styling for plugin icon and primary elements
* Improved: Visual consistency across all admin interface components

= 2.27.7 =
* Changed: Plugin name updated to "Nexu Stats: Visitor Traffic & Real-Time Statistics Plugin for WordPress"

= 2.27.6 =
* Changed: Tracking is now always on while the plugin is active, so the settings toggle and related option were removed to prevent accidental stats loss.

= 2.27.5 =
* Fixed: AI scheduler now uses a shared, timezone-aware data collector so daily/weekly/monthly emails reflect real visits instead of zeros.
* Fixed: Weekly/monthly jobs referenced legacy columns (`pages_viewed`, `country`, `referrer_type`) that no longer exist; queries now mirror the live analytics tables.
* Improved: Custom/Manual AI exports share the same collector ensuring dashboard stats and AI prompts always come from identical datasets.

= 2.27.4 =
* Fixed: AI email stat cards now display real metrics (visits, bounce rate, duration) by merging the collected dataset into the final report payload and extending manual/custom reports with the same calculations.
* Improved: AI analysis body is rendered with a custom Markdown-to-HTML parser that groups headings, bullets, and paragraphs cleanly, producing readable RTL/LTR blocks.
* Updated: All email templates now use a unified Tahoma font stack for consistent typography across clients.

= 2.27.3 =
* Removed fallback blocks (context snapshot & marketing playbook) from AI emails so only the AI response is rendered.

= 2.27.2 =
* Fixed: Custom AI report emails now send only once by disabling automatic sends when the manual generator delivers the message.
* Added: Context-aware Marketing & Growth Playbook + Site Context Snapshot blocks are appended whenever the AI output is missing or truncates those sections.
* Added: Auto-generated marketing guidance pulls real post titles, categories, keywords, and product names so every report references the actual WordPress site.
* Improved: All HTML email templates now use a 16px base font for clearer typography (LTR + RTL) across clients.

= 2.20.4 =
* DEBUG: Added comprehensive console logging for settings save process
* DEBUG: Added debug-settings.php script to check database values
* Added: Console logs show settings before save, response, and saved values
* Added: Error logging with detailed xhr information
* This version helps diagnose why settings aren't persisting

= 2.20.3 =
* CRITICAL FIX: Boolean settings (checkboxes) now save false values correctly
* Fixed: sanitize_settings now ALWAYS sets boolean values (not just when true)
* Fixed: Unchecked checkboxes now properly save as false instead of being skipped
* Fixed: excluded_ips textarea now uses sanitize_textarea_field to preserve newlines
* Enhanced: Boolean keys always have a value (true or false) in sanitized settings
* This fixes the issue where unchecking a checkbox wouldn't save

= 2.20.2 =
* CRITICAL FIX: All form fields now save correctly (checkboxes, selects, textareas)
* Fixed: JavaScript now captures ALL input types, not just serializeArray
* Fixed: Checkboxes (both checked and unchecked) now save properly
* Fixed: Select dropdowns now save correctly
* Fixed: Textarea fields now save correctly
* Enhanced: Complete form field collection using jQuery .each()
* Enhanced: Better handling of radio buttons

= 2.20.1 =
* CRITICAL FIX: Settings now save correctly and persist after page refresh
* Fixed: Settings merge with existing values instead of replacing them
* Fixed: Added autoload parameter to update_option for better performance
* Enhanced: Improved debug logging for settings save process
* Enhanced: Better verification of saved settings
* Debug: Added comparison check between merged and saved settings

= 2.20.0 =
* NEW: Database Health Check system
* NEW: Automatic database repair and optimization
* NEW: Database statistics and monitoring
* Added: Check Database button in Settings tab
* Added: Repair & Optimize button for fixing database issues
* Added: Detailed table status display with size and record counts
* Added: Automatic table creation if missing
* Added: REPAIR TABLE and OPTIMIZE TABLE functionality
* Enhanced: Database diagnostics with comprehensive health checks
* Security: All database operations use prepared statements
* Security: Proper nonce verification and permission checks
* UX: Beautiful visual feedback for database operations

= 2.19.4 =
* Fixed: Improved submenu icon spacing and alignment
* Fixed: Changed margin-right to margin-left for RTL compatibility
* Fixed: Added vertical-align: middle for proper icon alignment
* UX: Increased icon size to 17px for better visibility
* UX: Added proper spacing between icons and text

= 2.19.3 =
* Fixed: Bot Statistics tab now uses consistent stat card styling
* Fixed: Corrected NEXUSTATS_PLUGIN_URL to NEXUSTATS_URL in tracker script enqueue
* Fixed: Frontend tracking script now loads correctly
* Enhanced: Bot tracking should now work properly for Google Bot and other crawlers
* UX: Improved bot statistics card design to match other tabs

= 2.19.2 =
* Fixed: Real-Time tab now displays page titles instead of just country codes
* Fixed: Added LEFT JOIN to fetch page titles from pageviews table
* Enhanced: Recent Visitors now shows page title + country flag
* Improved: Better fallback logic when page title is not available
* UX: More informative real-time visitor display

= 2.19.1 =
* Fixed: Page titles now display correctly in Top Pages table
* Fixed: Improved empty title handling with proper fallback to "Untitled"
* Fixed: Modern table component now conditionally displays title only when available
* Improved: Better data validation for page titles

= 2.19.0 =
* Fixed: Real-Time tab - Pages Being Viewed Right Now table
* Fixed: Real-Time tab - Recent Visitors (Last 30 Minutes) table
* Enhanced: Real-time data now displays in 2-column grid layout
* Improved: Live updating content now uses modern card design
* UX: Consistent design across ALL tabs including real-time

= 2.18.0 =
* Fixed: Completed ALL remaining table conversions (100% coverage)
* Fixed: pages-tab.php - Top Landing Pages and Top Exit Pages
* Fixed: devices-tab.php - Operating Systems table
* Enhanced: All tables across ALL tabs now use 2-column grid layout
* Improved: Zero old wp-list-table remaining in any tab
* UX: Complete visual consistency throughout the entire plugin

= 2.17.2 =
* Fixed: Stat cards now display in a single row (4 columns)
* Fixed: Changed grid from auto-fit to fixed 4-column layout
* Improved: Better responsive behavior (2 columns on tablet, 1 on mobile)
* UX: All stat cards now stay in one row on desktop screens

= 2.17.1 =
* Enhanced: overview-tab.php - Top Pages and Top Countries tables
* Improved: Complete coverage of all data tables across the plugin
* Improved: All statistical tables now use consistent 2-column grid layout
* UX: Unified design language throughout the entire plugin
* Performance: Maximum space efficiency in all tabs

= 2.17.0 =
* Enhanced: Applied compact 2-column grid layout to all data tables
* Enhanced: sources-tab.php - Search Engines, Top Referrers, Social Media
* Enhanced: devices-tab.php - Browsers and Screen Resolutions tables
* Enhanced: geographic-tab.php - Top Countries and Top Cities tables
* Improved: Consistent card-based design across all tabs
* Improved: All tables now use truncated text with tooltips
* Improved: Uniform spacing and styling throughout plugin
* Performance: Reduced vertical space usage across all tabs
* UX: Better visual consistency across the entire admin interface

= 2.16.1 =
* Fixed: Horizontal scroll issue completely resolved
* Fixed: Added max-width: 100% to all grid and item elements
* Fixed: Added overflow-x: hidden to prevent page stretching
* Fixed: URL word-break for long URLs
* Fixed: Grid items now respect container width
* Fixed: Stats flex-wrap for better responsiveness
* Improved: Section content width constraints
* Improved: Better mobile compatibility

= 2.16.0 =
* Added: 2-column grid layout for data tables (50% space reduction)
* Added: Truncated text with native browser tooltips on hover
* Added: Compact card-based design for each data item
* Enhanced: Font sizes reduced (12px title, 10px URL, 11px stats)
* Enhanced: Minimal padding (10-12px) for space efficiency
* Enhanced: Stats displayed inline (Views + Time in one row)
* Improved: Mobile responsive (single column on small screens)
* Improved: Better visual hierarchy with subtle borders
* Performance: Significantly less vertical space usage
* UX: Full text visible on hover via title attribute

= 2.15.0 =
* Fixed: Simplified table design to match plugin's existing style
* Fixed: Removed oversized gradient headers and excessive spacing
* Fixed: Reduced table padding and font sizes for better space efficiency
* Enhanced: Clean and minimal table styling with subtle hover effects
* Enhanced: Compact pagination controls with better button styling
* Enhanced: Consistent color scheme using plugin's design variables
* Improved: Tables now properly integrate with existing admin design
* Improved: Better visual balance and spacing throughout tables
* Performance: Lighter CSS footprint for faster page loads

= 2.14.0 =
* Added: Modern table component with pagination system
* Added: Smart pagination (10 items per page)
* Added: Responsive table design for mobile devices
* Enhanced: Replaced old WordPress wp-list-table
* Enhanced: Hover effects on table rows
* Enhanced: Automatic number formatting
* Improved: Better visual hierarchy in tables

= 2.13.0 =
* Added: 4 quick-access submenu items under NexuStats main menu
* Added: "Real-Time View" submenu with animated green radar icon
* Added: "Overall Stats" submenu with chart icon
* Added: "AI Reports" submenu with AI icon
* Added: "General Settings" submenu with settings icon
* Enhanced: All submenu items directly link to their respective tabs
* Enhanced: Green pulsing animation for Real-Time icon (live indicator)
* Enhanced: Hover effects with icon scaling for better UX
* Improved: Faster navigation - no need to open main page first
* Improved: Visual hierarchy with color-coded icons

= 2.12.1 =
* Fixed: Critical bug - Settings not saving properly in Settings tab
* Fixed: Missing 'enable_export' checkbox in sanitization (boolean_keys)
* Fixed: Missing 'default_date_range' dropdown in sanitization (text_keys)
* Fixed: JavaScript not handling 'enable_export' checkbox state
* Enhanced: Added comprehensive field validation in sanitize_settings()
* Improved: All settings from Settings tab now save correctly to database

= 2.12.0 =
* Fixed: Critical bug in real-time statistics - incorrect field names causing inaccurate counts
* Fixed: Changed from visit_date (DATE) to visit_timestamp (DATETIME) for accurate 5-minute window
* Fixed: Removed references to is_bot field (bots are now tracked separately)
* Enhanced: Real-time refresh interval reduced from 10s to 5s for faster updates
* Enhanced: Added intelligent request queuing to prevent duplicate AJAX calls
* Enhanced: Implemented automatic fallback to 15s interval after 3 consecutive failures
* Added: Visual flash animation when statistics values update
* Added: Number formatting with thousands separators (e.g., 1,234)
* Added: Comprehensive debug logging for troubleshooting
* Improved: Better error handling with timeout protection (8s timeout)
* Improved: Optimized SQL queries for better performance
* Improved: Immediate initial refresh on page load
* Improved: Automatic cleanup on page unload
* Performance: Queries now use proper DATETIME comparisons for accuracy
* Performance: Added current_time() for WordPress timezone compatibility

= 2.11.3 =
* Enhanced: Added consistent emoji icons to all AI providers for better visual identification
* Added: 🤖 OpenAI - Industry standard AI
* Added: 🧠 Anthropic (Claude) - Advanced reasoning
* Added: 🔍 Google (Gemini) - Search-powered AI
* Added: ⭐ Mistral AI - Recommended choice
* Added: ⚡ Groq - Ultra-fast inference
* Added: 💰 DeepSeek - Cost-effective option
* Added: 💬 Cohere - Conversational AI
* Added: 🌐 Perplexity - Online search integration
* Improved: More intuitive and visually appealing provider selection

= 2.11.2 =
* Improved: Cleaned up AI Provider dropdown labels - removed specific model names
* Changed: Provider labels now show only company names (e.g., "OpenAI" instead of "OpenAI (GPT-4)")
* Improved: Better UX - model selection is now separate and clear in its own dropdown
* Enhanced: Kept emoji indicators for special features (⭐ for recommended, ⚡ for fast, 💰 for cost-effective, 🌐 for online)

= 2.11.1 =
* Fixed: Critical bug in call_mistral() method - missing $model parameter causing connection errors
* Fixed: AI model selection now properly defaults to first available model when provider changes
* Enhanced: Improved model dropdown logic to handle provider switching correctly
* Enhanced: Better error handling and debug logging for Mistral AI API calls
* Fixed: Model parameter now correctly passed to all AI provider API calls
* Improved: JavaScript model selection logic prevents undefined model errors

= 2.11.0 =
* Added: Custom time selection for Daily, Weekly, and Monthly AI reports
* Added: Time picker dropdown (24-hour format) for each report type
* Enhanced: Reports now use WordPress timezone settings (wp_timezone_string)
* Enhanced: Cron jobs automatically reschedule when time settings change
* Enhanced: Reports generated 2 minutes before scheduled time and sent exactly on time
* Improved: Better timezone handling with DateTime and wp_timezone()
* Improved: Clear timezone display in settings (e.g., "Timezone: Asia/Tehran")
* Added: Automatic cron rescheduling on settings save
* Fixed: All scheduled tasks now respect WordPress timezone configuration

= 2.10.1 =
* Fixed: Font Awesome icons now load correctly in admin panel
* Added: Font Awesome 6.5.1 CDN for all admin icons
* Fixed: Resend Email and Delete Report button icons now display properly

= 2.10.0 =
* Complete: Redesigned all email templates with modern, section-based layout
* Enhanced: Beautiful gradient headers with purple/violet theme
* Enhanced: Sectioned content with clear visual separation
* Enhanced: Modern stat boxes with gradient text effects
* Enhanced: Improved typography and spacing for better readability
* Enhanced: Professional footer with dark theme
* Enhanced: Rounded CTA buttons with shadow effects
* Enhanced: Analysis content in styled boxes with left/right borders (RTL support)
* Improved: Email width optimized at 800px for perfect display
* Improved: Better mobile responsiveness
* Added: Section icons for visual hierarchy
* Added: Gradient backgrounds throughout the design

= 2.9.2 =
* Enhanced: Completely overhauled AI prompt engineering for practical recommendations
* Enhanced: AI now provides specific, actionable, and measurable advice
* Fixed: AI no longer recommends external tools (TinyPNG, Yoast, etc.)
* Fixed: AI focuses on built-in WordPress features and manual optimizations
* Improved: Recommendations are now free, implementable, and results-oriented
* Improved: AI provides exact steps with expected outcomes (e.g., "+15% improvement")
* Added: Strict rules against vague advice like "improve SEO" or "create quality content"
* Added: Examples in prompts to guide AI toward practical suggestions
* Enhanced: Better structure for High/Medium/Long-term priority recommendations

= 2.9.1 =
* Fixed: Email width increased from 600px to 800px for better readability
* Fixed: Stats grid now displays horizontally (2x2) instead of vertically stacked
* Fixed: Replaced CSS Grid with HTML table for better email client compatibility
* Enhanced: Improved RTL support in all email templates
* Enhanced: Better spacing and padding in stat boxes
* Improved: Email templates now work perfectly in Gmail, Outlook, and other clients

= 2.9.0 =
* Added: Separate bot tracking system with dedicated database table
* Added: New "Bot Traffic" admin tab with comprehensive bot analytics
* Added: Bot statistics in Overview tab (total visits & unique bots)
* Added: Bot type categorization (Search Engine, Social Media, SEO Tool, Monitoring, Other)
* Added: Bot activity charts (daily visits, hourly patterns)
* Added: Top bots breakdown with visit counts
* Added: Bot geographic distribution (country-based)
* Added: Most crawled pages by bots
* Enhanced: Bots are now tracked separately from human visitors (lightweight tracking)
* Enhanced: Bot tracking includes only essential data (no detailed device/browser info)
* Enhanced: Zero performance impact - bot data stored in optimized separate table
* Improved: Human visitor statistics are now 100% accurate (bots excluded)
* Improved: Better bot detection and categorization
* Fixed: Bot visits no longer mixed with human analytics

= 2.8.1 =
* Fixed: Browser detection now working correctly in real-time and all reports
* Fixed: User agent now properly retrieved from frontend data instead of server-side only
* Enhanced: Browser detection now uses client-side navigator.userAgent for accuracy
* Improved: Fallback to server-side user agent if frontend data is unavailable

= 2.8.0 =
* Enhanced: Completely redesigned report cards with horizontal layout
* Enhanced: Report info now displays in a single compact row with icons
* Enhanced: Reduced card height by 40% for better space efficiency
* Added: Pagination for AI reports (10 reports per page)
* Added: Delete button for individual reports
* Added: "Delete All" button to remove all reports at once
* Added: Total reports count in section header
* Added: Beautiful file icon for each report card
* Added: Smooth fade-out animation when deleting reports
* Improved: Better visual hierarchy with icon-based date/time display
* Improved: Resend button now shows only icon (more compact)
* Improved: Empty state with inbox icon

= 2.7.0 =
* Added: "Resend Email" button for each AI report in the reports list
* Added: Ability to resend any generated report to email with one click
* Enhanced: Report cards now show email status badge with icon
* Enhanced: Visual feedback for email sending (Sending... → Sent! → Resend Email)
* Enhanced: Automatic email_sent status update in database after successful resend
* Improved: Better layout for report cards with action buttons
* Improved: Hover effects and smooth transitions for resend button

= 2.6.0 =
* Fixed: AI reports incorrectly referencing Google Analytics and external tools
* Enhanced: Complete prompt engineering overhaul for accurate NexuStats context
* Enhanced: AI now understands it's analyzing NexuStats (WordPress plugin) data, not Google Analytics
* Enhanced: Removed all references to Google Tag Manager, GA4, and external analytics services
* Enhanced: AI treats zero/low data as "low activity" not "technical problems"
* Enhanced: Prompts now fully in English with language-specific output instructions
* Improved: More actionable recommendations focused on website improvements
* Improved: Better context about data source and collection method
* Improved: Clearer prohibitions against mentioning third-party tools

= 2.5.0 =
* Fixed: Duplicate event handlers causing multiple alerts when saving settings
* Fixed: Removed all annoying alert() popups
* Enhanced: Replaced alerts with elegant inline notifications
* Enhanced: Button state changes (Saving... → Saved! → Original text)
* Enhanced: Visual feedback with icons and colors
* Enhanced: Error messages now show inline instead of alert popups
* Improved: Better UX with smooth transitions and auto-hide messages
* Improved: Used .off().on() pattern to prevent duplicate event listeners

= 2.4.1 =
* Fixed: AI report modal not loading content correctly
* Fixed: Corrected field name mismatch (ai_analysis vs analysis)
* Enhanced: Added loading spinner when opening report modal
* Enhanced: Better error handling with visual feedback
* Improved: Console error logging for debugging

= 2.4.0 =
* Added: New "Audience" tab combining Visitors, Devices, and Geographic data
* Added: New "Content & Traffic" tab combining Pages and Traffic Sources
* Added: Sub-tab navigation for better organization
* Enhanced: Merged Filters functionality into Settings tab
* Improved: Reduced navigation from 11 tabs to 7 tabs (36% reduction)
* Improved: Cleaner and more organized admin interface
* Improved: Better user experience with logical grouping
* Optimized: Faster navigation and less cluttered interface

= 2.3.0 =
* Added: Custom report type support for manual AI reports
* Added: Automatic email sending for manual reports
* Added: RTL (Right-to-Left) support for all email templates
* Added: Custom report email template
* Fixed: Report type display showing empty for custom reports
* Fixed: Report modal click handler now working correctly
* Enhanced: Email templates now detect site language and adjust direction
* Enhanced: Better font support for RTL languages (Persian, Arabic, Hebrew, Urdu)
* Improved: Email styling with proper RTL border positioning

= 2.2.0 =
* Added: AI Model selection dropdown with multiple models per provider
* Added: Test Connection button to verify AI API keys
* Added: Support for 30+ AI models across 8 providers
* Added: Real-time connection testing with detailed error messages
* Enhanced: AI settings now include model selection for each provider
* Enhanced: Better AI configuration with visual feedback
* Fixed: Models are no longer hardcoded - fully customizable
* Improved: User experience with instant connection verification

= 2.1.0 =
* Enhanced: Increased admin panel width from 91% to 96% for better space utilization
* Enhanced: Increased max-width from 1200px to 1600px for wider screens
* Improved: Better content visibility on large monitors
* Improved: More comfortable reading and interaction space
* Optimized: Maintained responsive design for all screen sizes

= 2.0.0 =
* Fixed: Critical bug - Settings were not saving due to nonce mismatch
* Fixed: Nonce verification changed from 'nexustats_admin_nonce' to 'nexustats_admin'
* Fixed: AI report schedule settings (daily/weekly/monthly) were not being saved
* Added: AI schedule checkboxes to sanitization whitelist
* Added: Comprehensive debug logging for settings save process
* Enhanced: Better error tracking and debugging capabilities
* Improved: Settings now save and persist correctly

= 1.9.0 =
* Fixed: AI Analysis tab now shows all 8 AI providers (was showing only 3)
* Fixed: Removed burnt code from ai-analysis-tab.php
* Enhanced: Both Settings and AI Analysis tabs now have complete provider list
* Verified: All files checked for consistency

= 1.8.0 =
* Fixed: Updated file path constants from NEXUSTATS_PLUGIN_DIR to NEXUSTATS_PATH
* Added: Debug logging to track file loading (when WP_DEBUG enabled)
* Added: HTML version comments for cache verification
* Added: clear-cache.php utility script for clearing all PHP caches
* Enhanced: Better cache busting and file verification
* Improved: More robust file loading mechanism

= 1.7.0 =
* Fixed: Date filter styling now matches plugin design system
* Enhanced: Filter bar uses proper ns-card, ns-btn, and ns-form classes
* Enhanced: Replaced Dashicons with Font Awesome icons for consistency
* Enhanced: Better visual hierarchy with proper spacing and colors
* Improved: Filter buttons now have proper hover effects and transitions
* Improved: Form inputs use plugin's custom CSS variables
* Improved: Overall more professional and cohesive appearance

= 1.6.0 =
* Added: Complete AI Settings section in Settings tab
* Added: All 8 AI providers now visible in dropdown (OpenAI, Anthropic, Google, Mistral, Groq, DeepSeek, Cohere, Perplexity)
* Added: API key configuration field
* Added: Report language selection (English/Persian)
* Added: Email configuration for AI reports
* Added: Enable/disable toggles for daily, weekly, and monthly AI reports
* Enhanced: Settings tab now fully functional for AI analysis configuration
* Improved: Better organization of settings with clear sections

= 1.5.0 =
* Added: Advanced date filtering system for all tabs
* Added: 9 preset date ranges (Today, Yesterday, Last 7/30/90 Days, This/Last Month, This Year, Custom)
* Added: Custom date range picker with start and end dates
* Enhanced: All tabs now support dynamic date filtering
* Enhanced: Previous period comparison automatically adjusts based on selected range
* Enhanced: Better data visualization with filtered results
* Improved: User experience with instant filter application

= 1.4.0 =
* Added: Mistral AI support (mistral-large-latest)
* Added: Groq support (llama-3.1-70b-versatile)
* Added: DeepSeek support (deepseek-chat)
* Added: Cohere support (command-r-plus)
* Added: Perplexity support (llama-3.1-sonar-large-128k-online)
* Enhanced: Now supports 8 different AI providers for maximum flexibility

= 1.3.0 =
* Fixed: Duplicate admin menu issue
* Fixed: Duplicate assets enqueuing
* Improved: Separated concerns between PluginManager and DashboardController
* Enhanced: Cleaner code structure and better performance

= 1.2.0 =
* Fixed: CronManager initialization error
* Improved: Component initialization with proper checks
* Enhanced: Admin controller only loads in admin area

= 1.1.0 =
* Enhanced AI analysis system with deep prompt engineering
* Added comprehensive email reporting (daily, weekly, monthly)
* Improved REST API for AJAX and tracking
* Enhanced admin dashboard with all tabs fully functional
* Added advanced filtering and export capabilities
* Improved cron job management for scheduled reports
* Enhanced debugging and logging system
* Performance optimizations and bug fixes

= 1.0.0 =
* Initial release
* Real-time analytics
* AI-powered insights
* Geographic tracking
* Device detection
* Bot filtering
* GDPR compliance
* Cache compatibility
* Beautiful dashboard

== Upgrade Notice ==

= 1.1.0 =
Major update with enhanced AI analysis, email reporting, and improved admin dashboard. Recommended for all users.

= 1.0.0 =
Initial release of NexuStats - Advanced Analytics

== Privacy Policy ==

NexuStats collects visitor data including:
* IP addresses (can be anonymized)
* Browser and device information
* Pages visited
* Geographic location
* Referrer information

All data is stored locally in your WordPress database. No data is sent to external servers except:
* IP geolocation lookups (can be disabled)
* AI analysis (only if configured and only aggregated data)

You can configure data retention periods and enable IP anonymization for GDPR compliance.

