=== Nik Cookie Consent ===
Contributors: nikdimon
Tags: cookie, consent, gdpr, google consent mode, banner
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
Stable tag: 1.0.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Lightweight, fast cookie‑consent banner. Asks for consent, stores the choice and fires the consent event. Free and simple.

== Description ==

A deliberately tiny cookie‑consent banner. It does exactly three things and nothing more:

1. Shows a GDPR/ePrivacy banner with Accept / Decline.
2. Stores the visitor's choice in a cookie for 180 days.
3. Fires the consent event so your analytics/ads react:
   * **Google Consent Mode v2** — sets all storage to `denied` by default (before any tag fires) and updates to `granted` on accept.
   * **GTM dataLayer** — pushes `nik_cc_granted` / `nik_cc_denied`.
   * **DOM event** — dispatches `nikcc:change` with `{ consent: 'granted' | 'denied' }`.

No external requests, no jQuery, no bundled files — about 2&nbsp;KB of inline CSS/JS in the footer. Nothing is loaded on the front end besides that.

= Settings (Settings → Cookie Consent) =

* Banner text, Accept label, Decline label
* Privacy link label — points at your WordPress Privacy Policy page (Settings → Privacy)
* Theme: dark or light
* Position: bottom bar, bottom‑left card or bottom‑right card
* Accent color
* Google Consent Mode v2 on/off

= Re‑open the banner =

Shortcode: `[nik_cookie_settings text="Cookie settings"]`
JS API: `NikCookieConsent.open()`, `NikCookieConsent.reset()`, `NikCookieConsent.get()`

= Developer hooks =

Filters: `nik_cc_cookie_name`, `nik_cc_event_granted`, `nik_cc_event_denied`, `nik_cc_privacy_url`, `nik_cc_string`.
Multilingual: banner strings are registered with Polylang (String Translations) automatically when Polylang is active.

== Installation ==

1. Upload the `nik-cookie-consent` folder to `/wp-content/plugins/`, or install the ZIP via Plugins → Add New → Upload.
2. Activate.
3. Adjust the wording under Settings → Cookie Consent (optional — sensible defaults ship out of the box).

== Frequently Asked Questions ==

= Does it block scripts by itself? =

No. It is a consent *signal* layer, kept intentionally light. It sets Google Consent Mode v2 (so Google/GTM tags respect the choice) and fires a dataLayer / DOM event you can gate your own tags on. It does not scan or rewrite third‑party scripts.

= Will it slow my site down? =

No extra HTTP requests and no libraries — only a couple of KB of inline CSS/JS in the footer, plus a tiny Consent Mode default in the head.

== Changelog ==

= 1.0.5 =
* Fix (the real one): in the default "bottom bar" position the banner did not disappear after Accept/Decline — the `hidden` attribute was overridden by the position rule (equal CSS specificity, later rule wins), so `display:flex` beat `display:none`. The choice was recorded and events fired, but the bar stayed on screen — which read as "the buttons do nothing". `[hidden]` is now enforced with `!important`.

= 1.0.4 =
* Buttons: the handler now also listens on `pointerup` (capture phase), so Accept/Decline still register even if a browser extension or another script swallows the `click` event. The action is made idempotent so it never fires twice.

= 1.0.3 =
* Analytics integration: on Accept the banner now also raises `window.nikAnalyticsConsent` and fires the `nikAnalyticsConsentGiven` event, so Nik Analytics (and anything using the same signal) in “wait for consent” mode starts recording right after the visitor accepts.

= 1.0.2 =
* Buttons: bulletproof click handling — a delegated capture‑phase listener (survives themes/plugins that clone or move the footer, or that stop click propagation), and the banner now always closes and stores the choice even if a third‑party or analytics script throws inside the handler.

= 1.0.1 =
* Banner text now uses a rich editor (TinyMCE) — insert links (e.g. Privacy Policy) and basic formatting; safe HTML allowed via wp_kses.
* More robust buttons: click handlers bound directly to each button and a very high stacking context (z-index + isolation) so nothing overlays or swallows the click.

= 1.0.0 =
* Initial release: banner, consent storage, Google Consent Mode v2, dataLayer push and `nikcc:change` DOM event, settings page, reopen shortcode/JS API, Polylang string registration.
