<!-- Simple Cookie Consent Popup Start -->
<style>
  #cookieBox {
    position: fixed;
    right: 20px;
    bottom: 20px;
    max-width: 360px;
    background: #111;
    color: #fff;
    padding: 18px;
    border-radius: 10px;
    z-index: 99999;
    font-family: Arial, sans-serif;
    box-shadow: 0 8px 30px rgba(0,0,0,0.35);
    display: none;
  }

  #cookieBox h3 {
    margin: 0 0 8px;
    font-size: 18px;
  }

  #cookieBox p {
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 12px;
    color: #ddd;
  }

  #cookieBox a {
    color: #fff;
    text-decoration: underline;
  }

  .cookie-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .cookie-actions button {
    border: none;
    padding: 9px 12px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 5px;
  }

  .cookie-accept {
    background: #fff;
    color: #000;
  }

  .cookie-essential,
  .cookie-settings {
    background: #333;
    color: #fff;
  }

  .cookie-close {
    position: absolute;
    right: 10px;
    top: 8px;
    background: transparent;
    color: #fff;
    border: none;
    font-size: 20px;
    cursor: pointer;
  }

  #cookiePreferences {
    display: none;
    margin: 12px 0;
    border-top: 1px solid #333;
    padding-top: 10px;
  }

  #cookiePreferences label {
    display: block;
    font-size: 13px;
    margin-bottom: 8px;
  }

  #cookieMiniBtn {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 30px;
    padding: 10px 16px;
    font-size: 13px;
    cursor: pointer;
    z-index: 99999;
    display: none;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
  }

  @media (max-width: 480px) {
    #cookieBox {
      right: 12px;
      left: 12px;
      bottom: 12px;
      max-width: none;
    }

    #cookieMiniBtn {
      right: 12px;
      bottom: 12px;
    }
  }
</style>

<div id="cookieBox">
  <button class="cookie-close" onclick="minimizeCookieBox()">−</button>

  <h3>Cookies</h3>

  <p>
    We use cookies to improve your browsing experience, analyze traffic, and support marketing.
    You can accept all cookies or use essential cookies only.
    <a href="/privacy-policy.php">Privacy Policy</a>
  </p>

  <div id="cookiePreferences">
    <label>
      <input type="checkbox" checked disabled>
      Essential Cookies
    </label>

    <label>
      <input type="checkbox" id="analyticsCookies">
      Analytics Cookies
    </label>

    <label>
      <input type="checkbox" id="marketingCookies">
      Marketing Cookies
    </label>
  </div>

  <div class="cookie-actions">
    <button class="cookie-essential" onclick="saveCookieConsent(false, false)">
      Essential Only
    </button>

    <button class="cookie-settings" onclick="toggleCookiePreferences()">
      Settings
    </button>

    <button class="cookie-accept" onclick="saveCookieConsent(true, true)">
      Accept All
    </button>
  </div>
</div>

<button id="cookieMiniBtn" onclick="openCookieBox()">
  Cookies
</button>

<script>
  document.addEventListener("DOMContentLoaded", function () {
    var consent = localStorage.getItem("cookieConsent");
    var minimized = localStorage.getItem("cookieMinimized");

    if (!consent) {
      if (minimized === "yes") {
        document.getElementById("cookieMiniBtn").style.display = "block";
      } else {
        document.getElementById("cookieBox").style.display = "block";
      }
    }
  });

  function saveCookieConsent(analytics, marketing) {
    var consentData = {
      essential: true,
      analytics: analytics,
      marketing: marketing
    };

    localStorage.setItem("cookieConsent", JSON.stringify(consentData));
    localStorage.removeItem("cookieMinimized");

    document.getElementById("cookieBox").style.display = "none";
    document.getElementById("cookieMiniBtn").style.display = "none";

    if (analytics) {
      console.log("Analytics cookies accepted");
      // Google Analytics code yahan add karna hai
    }

    if (marketing) {
      console.log("Marketing cookies accepted");
      // Meta Pixel / Google Ads code yahan add karna hai
    }
  }

  function toggleCookiePreferences() {
    var prefBox = document.getElementById("cookiePreferences");
    prefBox.style.display = prefBox.style.display === "block" ? "none" : "block";

    var analytics = document.getElementById("analyticsCookies").checked;
    var marketing = document.getElementById("marketingCookies").checked;

    if (prefBox.style.display === "none") {
      saveCookieConsent(analytics, marketing);
    }
  }

  function minimizeCookieBox() {
    localStorage.setItem("cookieMinimized", "yes");
    document.getElementById("cookieBox").style.display = "none";
    document.getElementById("cookieMiniBtn").style.display = "block";
  }

  function openCookieBox() {
    document.getElementById("cookieBox").style.display = "block";
    document.getElementById("cookieMiniBtn").style.display = "none";
  }
</script>
<!-- Simple Cookie Consent Popup End -->