<!doctype html>
<html lang="sv">
  <head>
    <!-- Google Tag Manager with Consent Mode -->
    <script>
      // Default consent to denied (GDPR compliant)
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('consent', 'default', {
        'analytics_storage': 'denied',
        'ad_storage': 'denied',
        'ad_user_data': 'denied',
        'ad_personalization': 'denied'
      });

      // CRITICAL: Restore saved consent BEFORE any tags fire
      // This fixes the "0% consent rate" issue for returning visitors
      (function() {
        try {
          var saved = localStorage.getItem('cookie_preferences');
          if (saved) {
            var prefs = JSON.parse(saved);
            gtag('consent', 'update', {
              'analytics_storage': prefs.analytics ? 'granted' : 'denied',
              'ad_storage': prefs.marketing ? 'granted' : 'denied',
              'ad_user_data': prefs.marketing ? 'granted' : 'denied',
              'ad_personalization': prefs.marketing ? 'granted' : 'denied'
            });
          }
        } catch(e) {}
      })();

      (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
      new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
      j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
      'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
      })(window,document,'script','dataLayer','GTM-KB4852L9');
    </script>
    <!-- End Google Tag Manager -->

    <!-- Google Ads Base Tag -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=AW-17825439449"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', 'AW-17825439449');
    </script>
    <!-- End Google Ads Base Tag -->

    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Köp Däck Online | Däck Enkelt – Vinterdäck, Sommardäck & Helårsdäck</title>
    <meta name="description" content="Köp vinterdäck, sommardäck och helårsdäck online. Leverans inom 2–4 arbetsdagar. Fri frakt vid beställningar över 2 000 kr. Nokian, Continental, Michelin m.fl." />
    <meta name="author" content="Däck Enkelt" />

    <meta property="og:title" content="Köp Däck Online | Däck Enkelt – Vinterdäck, Sommardäck & Helårsdäck" />
    <meta property="og:description" content="Köp vinterdäck, sommardäck och helårsdäck online. Leverans inom 2–4 arbetsdagar. Fri frakt vid beställningar över 2 000 kr." />
    <meta property="og:type" content="website" />
    <meta property="og:url" content="https://dack-enkelt.se" />
    <link rel="canonical" href="https://dack-enkelt.se/" />
    <meta property="og:image" content="https://dack-enkelt.se/logo/logo.png" />
    <meta property="og:site_name" content="Däck Enkelt" />
    <meta property="og:locale" content="sv_SE" />

    <meta name="twitter:card" content="summary_large_image" />
    <meta name="twitter:title" content="Köp Däck Online | Däck Enkelt – Vinterdäck, Sommardäck & Helårsdäck" />
    <meta name="twitter:description" content="Köp vinterdäck, sommardäck och helårsdäck online. Leverans inom 2–4 arbetsdagar. Fri frakt vid beställningar över 2 000 kr." />
    <meta name="twitter:image" content="https://dack-enkelt.se/logo/logo.png" />

    <meta name="verification" content="9e32631a5fd050dba734281124c9486c" />

    <!-- Contentsquare -->
    <script src="https://t.contentsquare.net/uxa/33b55c1d76088.js"></script>

    <!-- Favicons -->
    <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
    <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
    <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
    <link rel="icon" href="/favicon.ico" />
    <link rel="manifest" href="/site.webmanifest" />
    <meta name="theme-color" content="#101418" />
    
    <!-- Critical CSS to prevent white flash before Tailwind loads -->
    <style>
      html, body, #root {
        background-color: #101418 !important;
        color: #fafafa !important;
        min-height: 100vh;
        margin: 0;
        padding: 0;
      }
    </style>

    <!-- Osano Cookie Consent (CSS inlined to avoid SPOF) -->
    <script defer src="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js" data-cfasync="false"></script>
    <style>
      /* Essential cookieconsent base styles (inlined to avoid SPOF) */
      .cc-window {
        position: fixed;
        overflow: hidden;
        box-sizing: border-box;
        font-family: Helvetica, Calibri, Arial, sans-serif;
        font-size: 16px;
        line-height: 1.5em;
        display: flex;
        flex-wrap: nowrap;
        z-index: 9999;
        opacity: 1;
        transition: opacity 1s ease;
      }
      .cc-window.cc-invisible { opacity: 0; }
      .cc-banner .cc-message {
        display: block;
        flex: 1 1 auto;
        max-width: 100%;
        margin-right: 1em;
      }
      .cc-compliance {
        display: flex;
        align-items: center;
      }
      .cc-btn {
        display: block;
        padding: 0.4em 0.8em;
        font-size: 0.9em;
        font-weight: 700;
        border: 2px solid;
        text-align: center;
        white-space: nowrap;
        cursor: pointer;
      }
      .cc-link {
        opacity: 0.8;
        display: inline-block;
        padding: 0.2em;
        text-decoration: underline;
        cursor: pointer;
      }
      .cc-revoke {
        position: fixed;
        padding: 0.5em;
        cursor: pointer;
        z-index: 9999;
      }
      /* Centered modal with clean layout */
      .cc-window.cc-floating {
        padding: 2em;
        box-shadow: 0 20px 60px rgba(0,0,0,0.5);
        max-width: 540px;
        width: calc(100% - 2em);
        background: #1a1f24 !important;
        border: 1px solid rgba(255,255,255,0.08) !important;
        border-radius: 16px !important;
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        z-index: 100000 !important;
        overflow: visible !important;
      }
      .cc-revoke { display: none !important; }
      /* Dark overlay - blocks clicks to modals beneath */
      body.cc-visible::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.7);
        backdrop-filter: blur(3px);
        z-index: 99999;
        pointer-events: all;
      }
      /* Logo centered above text */
      .cc-message::before {
        content: '';
        display: block;
        width: 160px;
        height: 48px;
        margin: 0 auto 1.25em;
        background: url('/logo/dack-enkelt.svg') no-repeat center;
        background-size: contain;
      }
      .cc-message {
        text-align: center;
        line-height: 1.6;
        font-size: 0.95em;
        color: rgba(250,250,250,0.8) !important;
        margin-bottom: 1.5em !important;
      }
      .cc-compliance {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75em;
      }
      .cc-btn {
        flex: 1 1 auto;
        min-width: 140px;
        padding: 0.9em 1.2em;
        border-radius: 8px;
        font-weight: 600;
        transition: all 0.15s;
        font-size: 0.9em;
        border: none;
        text-align: center;
        white-space: nowrap;
      }
      .cc-allow {
        background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%) !important;
        color: white !important;
      }
      .cc-allow:hover {
        filter: brightness(1.1);
        box-shadow: 0 4px 16px rgba(255,107,53,0.4) !important;
      }
      .cc-deny {
        background: rgba(255,255,255,0.06) !important;
        color: rgba(250,250,250,0.9) !important;
      }
      .cc-deny:hover {
        background: rgba(255,255,255,0.1) !important;
      }
      .cc-link {
        display: block;
        text-align: center;
        margin-top: 1em;
        color: rgba(250,250,250,0.5) !important;
        font-size: 0.8em;
      }
      .cc-link:hover {
        color: #FF6B35 !important;
      }
      /* Stack buttons on smaller screens */
      @media (max-width: 600px) {
        .cc-compliance {
          flex-direction: column;
        }
        .cc-btn {
          width: 100%;
          min-width: unset;
        }
        .cc-allow {
          order: -1; /* Show "Godkänn alla" first */
        }
      }
      /* Mobile */
      @media (max-width: 480px) {
        .cc-window.cc-floating {
          margin: 1em;
          width: calc(100% - 2em) !important;
          max-width: none;
          left: 0 !important;
          transform: translate(0, -50%) !important;
          padding: 1.5em;
        }
      }

      /* Cookie preferences modal */
      .cookie-preferences-modal {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.85);
        backdrop-filter: blur(4px);
        z-index: 100001;
        align-items: center;
        justify-content: center;
        padding: 1em;
      }
      .cookie-preferences-modal.active { display: flex; }
      /* Hide consent banner when preferences modal is open */
      body:has(.cookie-preferences-modal.active) .cc-window {
        display: none !important;
      }
      body:has(.cookie-preferences-modal.active)::before {
        display: none !important;
      }
      .cookie-preferences-content {
        background: #1a1f24;
        color: #fafafa;
        padding: 2.5em;
        border-radius: 12px;
        max-width: 650px;
        width: 100%;
        max-height: 85vh;
        overflow-y: auto;
        border: 1px solid #2a3038;
        box-shadow: 0 10px 40px rgba(0,0,0,0.6);
      }
      .cookie-preferences-content h2 {
        margin-top: 0;
        margin-bottom: 0.5em;
        font-size: 1.6em;
        color: #fafafa;
      }
      .cookie-preferences-content > p {
        margin-bottom: 2em;
        line-height: 1.6;
        opacity: 0.9;
        font-size: 0.95em;
      }
      .cookie-category {
        margin: 1em 0;
        padding: 1.5em;
        background: rgba(255,255,255,0.03);
        border: 1px solid rgba(255,255,255,0.08);
        border-radius: 8px;
        transition: all 0.2s;
      }
      .cookie-category:hover {
        background: rgba(255,255,255,0.05);
        border-color: rgba(255,255,255,0.12);
      }
      .cookie-category-title {
        margin-top: 0;
        margin-bottom: 0.5em;
        font-size: 1.15em;
        font-weight: 600;
        color: #fafafa;
      }
      .cookie-category p {
        margin: 0.5em 0 0 0;
        font-size: 0.9em;
        opacity: 0.85;
        line-height: 1.5;
      }
      .cookie-category p small {
        opacity: 0.7;
        margin-top: 0.5em;
        display: block;
      }
      .cookie-toggle {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 1em;
      }
      .cookie-toggle > div:first-child {
        flex: 1;
      }
      .toggle-switch {
        position: relative;
        width: 56px;
        height: 28px;
        background: #3a3f47;
        border-radius: 28px;
        cursor: pointer;
        transition: all 0.3s;
        flex-shrink: 0;
        border: 2px solid transparent;
      }
      .toggle-switch:hover:not(.disabled) {
        background: #4a4f57;
      }
      .toggle-switch.active {
        background: #FF6B35;
        border-color: #FF6B35;
      }
      .toggle-switch.disabled {
        opacity: 0.6;
        cursor: not-allowed;
        background: #FF6B35;
      }
      .toggle-switch::after {
        content: '';
        position: absolute;
        top: 3px;
        left: 3px;
        width: 20px;
        height: 20px;
        background: white;
        border-radius: 50%;
        transition: all 0.3s;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
      }
      .toggle-switch.active::after {
        left: 31px;
      }
      .cookie-preferences-actions {
        display: flex;
        gap: 1em;
        margin-top: 2.5em;
        justify-content: flex-end;
        flex-wrap: wrap;
      }
      .cookie-preferences-actions button {
        padding: 0.85em 1.8em;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        font-weight: 500;
        font-size: 0.95em;
        transition: all 0.2s;
      }
      .cookie-preferences-actions button:hover {
        transform: translateY(-1px);
      }
      .btn-save-preferences {
        background: #FF6B35;
        color: white;
      }
      .btn-save-preferences:hover {
        background: #E85A2B;
        box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
      }
      .btn-cancel {
        background: transparent;
        border: 1px solid #555 !important;
        color: #fafafa;
      }
      .btn-cancel:hover {
        background: rgba(255,255,255,0.05);
        border-color: #777 !important;
      }

      /* Mobile responsive */
      @media (max-width: 640px) {
        .cookie-preferences-content {
          padding: 1.5em;
        }
        .cookie-category {
          padding: 1em;
        }
        .cookie-preferences-actions {
          flex-direction: column-reverse;
        }
        .cookie-preferences-actions button {
          width: 100%;
        }
      }

      /* Floating cookie settings button */
      .cookie-settings-fab {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        background: #1a1f24;
        border: 1px solid #2a3038;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        transition: all 0.3s;
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
      }
      .cookie-settings-fab.visible {
        opacity: 1;
        visibility: visible;
      }
      .cookie-settings-fab:hover {
        background: #FF6B35;
        transform: scale(1.1);
        box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
      }
      .cookie-settings-fab svg {
        width: 24px;
        height: 24px;
        fill: #fafafa;
      }
      @media (max-width: 640px) {
        .cookie-settings-fab {
          width: 44px;
          height: 44px;
          bottom: 90px;
          right: 16px;
        }
        .cookie-settings-fab svg {
          width: 18px;
          height: 18px;
        }
      }
    </style>
    <script>
      // Cookie categories state
      let cookiePreferences = {
        necessary: true, // Always true
        analytics: false,
        marketing: false
      };

      // Load saved preferences
      function loadCookiePreferences() {
        const saved = localStorage.getItem('cookie_preferences');
        if (saved) {
          cookiePreferences = { ...cookiePreferences, ...JSON.parse(saved) };
          cookiePreferences.necessary = true; // Always enforce necessary
        }
      }

      // Save preferences
      function saveCookiePreferences() {
        localStorage.setItem('cookie_preferences', JSON.stringify(cookiePreferences));
        updateConsentMode();
        fireGTMConsentEvent();
      }

      // Update Google Consent Mode based on preferences
      function updateConsentMode() {
        gtag('consent', 'update', {
          'analytics_storage': cookiePreferences.analytics ? 'granted' : 'denied',
          'ad_storage': cookiePreferences.marketing ? 'granted' : 'denied',
          'ad_user_data': cookiePreferences.marketing ? 'granted' : 'denied',
          'ad_personalization': cookiePreferences.marketing ? 'granted' : 'denied'
        });
      }

      // Fire GTM event when consent changes
      function fireGTMConsentEvent() {
        window.dataLayer = window.dataLayer || [];
        window.dataLayer.push({
          'event': 'cookie_consent_update',
          'cookie_consent': {
            'necessary': cookiePreferences.necessary,
            'analytics': cookiePreferences.analytics,
            'marketing': cookiePreferences.marketing
          },
          'consent_timestamp': new Date().toISOString()
        });
      }

      // Show preferences modal
      function showCookiePreferences() {
        const modal = document.getElementById('cookie-preferences-modal');
        if (modal) {
          modal.classList.add('active');
          // Hide the consent banner while preferences are open
          const ccWindow = document.querySelector('.cc-window');
          if (ccWindow) ccWindow.style.display = 'none';
          // Update toggles to reflect current state
          document.getElementById('toggle-analytics').classList.toggle('active', cookiePreferences.analytics);
          document.getElementById('toggle-marketing').classList.toggle('active', cookiePreferences.marketing);
        }
      }

      // Hide preferences modal
      function hideCookiePreferences() {
        const modal = document.getElementById('cookie-preferences-modal');
        if (modal) modal.classList.remove('active');
        // Show the consent banner again
        const ccWindow = document.querySelector('.cc-window');
        if (ccWindow) ccWindow.style.display = '';
      }

      // Accept all cookies
      function acceptAllCookies() {
        cookiePreferences = { necessary: true, analytics: true, marketing: true };
        saveCookiePreferences();
        hideCookiePreferences();
      }

      // Reject optional cookies
      function rejectOptionalCookies() {
        cookiePreferences = { necessary: true, analytics: false, marketing: false };
        saveCookiePreferences();
        hideCookiePreferences();
      }

      // Save custom preferences
      function saveCustomPreferences() {
        saveCookiePreferences();
        hideCookiePreferences();
      }

      // Toggle category
      function toggleCategory(category) {
        if (category === 'necessary') return; // Can't disable necessary
        cookiePreferences[category] = !cookiePreferences[category];
        document.getElementById(`toggle-${category}`).classList.toggle('active', cookiePreferences[category]);
      }

      // Make showCookiePreferences globally available
      window.showCookiePreferences = showCookiePreferences;

      window.addEventListener("load", function(){
        loadCookiePreferences();

        // Prevent duplicate insertion of modal - check multiple IDs to be safe
        if (document.getElementById('cookie-preferences-modal') ||
            document.getElementById('toggle-analytics') ||
            document.getElementById('toggle-marketing')) {
          // Elements already exist, skip modal creation
        } else {
          // Create preferences modal
          const modalHTML = `
            <div id="cookie-preferences-modal" class="cookie-preferences-modal">
              <div class="cookie-preferences-content">
                <h2>Cookie-inställningar</h2>
                <p>Vi använder cookies för att förbättra din upplevelse på Däck Enkelt. Du kan välja vilka kategorier av cookies du vill tillåta.</p>

                <div class="cookie-category">
                  <div class="cookie-toggle">
                    <div>
                      <div class="cookie-category-title">Nödvändiga cookies</div>
                      <p>Dessa cookies är nödvändiga för att webbplatsen ska fungera korrekt. De används för att komma ihåg dina inställningar och kan inte stängas av.</p>
                    </div>
                    <div class="toggle-switch active disabled"></div>
                  </div>
                </div>

                <div class="cookie-category">
                  <div class="cookie-toggle">
                    <div>
                      <div class="cookie-category-title">Analys-cookies</div>
                      <p>Hjälper oss att förstå hur besökare använder webbplatsen genom att samla in och rapportera information anonymt. Vi använder detta för att förbättra användarupplevelsen.<br><small >Tjänster: Google Analytics</small></p>
                    </div>
                    <div id="toggle-analytics" class="toggle-switch" onclick="toggleCategory('analytics')"></div>
                  </div>
                </div>

                <div class="cookie-category">
                  <div class="cookie-toggle">
                    <div>
                      <div class="cookie-category-title">Marknadsförings-cookies</div>
                      <p>Används för att spåra besökare över olika webbplatser för att visa relevanta och personliga annonser. Detta hjälper oss att nå rätt kunder med våra erbjudanden.<br><small >Tjänster: Google Ads, Contentsquare</small></p>
                    </div>
                    <div id="toggle-marketing" class="toggle-switch" onclick="toggleCategory('marketing')"></div>
                  </div>
                </div>

                <div class="cookie-preferences-actions">
                  <button class="btn-cancel" onclick="hideCookiePreferences()">Avbryt</button>
                  <button class="btn-save-preferences" onclick="saveCustomPreferences()">Spara inställningar</button>
                </div>
              </div>
            </div>
          `;
          document.body.insertAdjacentHTML('beforeend', modalHTML);
        }

        // Add floating cookie settings button (only if not already present)
        if (!document.getElementById('cookie-settings-fab')) {
          const fabHTML = `
            <div class="cookie-settings-fab" id="cookie-settings-fab" onclick="showCookiePreferences()" title="Cookie-inställningar">
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
                <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"/>
              </svg>
            </div>
          `;
          document.body.insertAdjacentHTML('beforeend', fabHTML);
        }

        // Show FAB after user has made initial consent choice
        const showFAB = () => {
          const fab = document.getElementById('cookie-settings-fab');
          const hasConsented = localStorage.getItem('cookie_preferences');
          if (hasConsented && fab) {
            // Show after a delay so it doesn't appear during initial banner
            setTimeout(() => fab.classList.add('visible'), 1000);
          }
        };

        window.cookieconsent.initialise({
          "palette": {
            "popup": { "background": "#1a1f24", "text": "#fafafa" },
            "button": { "background": "#FF6B35", "text": "#ffffff" }
          },
          "theme": "edgeless",
          "position": "middle",
          "type": "opt-in",
          "content": {
            "message": "Vi använder cookies för att förbättra din upplevelse och visa relevanta annonser.",
            "allow": "Godkänn alla",
            "deny": "Endast nödvändiga",
            "link": "Anpassa inställningar",
            "href": "#",
            "target": "_self"
          },
          onPopupOpen: function() {
            document.body.classList.add('cc-visible');
            const link = document.querySelector('.cc-link');
            if (link) {
              link.addEventListener('click', function(e) {
                e.preventDefault();
                showCookiePreferences();
              });
            }
          },
          onPopupClose: function() {
            document.body.classList.remove('cc-visible');
          },
          onStatusChange: function(status) {
            document.body.classList.remove('cc-visible');
            if (status === 'allow') {
              acceptAllCookies();
            } else if (status === 'deny') {
              rejectOptionalCookies();
            }
            showFAB();
          },
          onInitialise: function (status) {
            // Apply saved preferences on page load
            if (status === 'allow' || status === 'deny') {
              updateConsentMode();
            }
            showFAB();
          }
        });

        // If user has already made a choice, apply it immediately
        const consent = localStorage.getItem('cookie_preferences');
        if (consent) {
          updateConsentMode();
          showFAB();
        }
      });
    </script>
    <script type="module" crossorigin src="/assets/index-BV9VWBj2.js"></script>
    <link rel="modulepreload" crossorigin href="/assets/vendor-react-zQy1qe_w.js">
    <link rel="modulepreload" crossorigin href="/assets/vendor-ui-CV3mUHHE.js">
    <link rel="stylesheet" crossorigin href="/assets/index-Citn3ur6.css">
  </head>

  <body>
    <!-- Google Tag Manager (noscript) -->
    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KB4852L9"
    height="0" width="0" style="display:none;visibility:hidden" sandbox="allow-scripts allow-same-origin"></iframe></noscript>
    <!-- End Google Tag Manager (noscript) -->
    <div id="root"></div>
    
    <!-- Google Customer Reviews - Merchant Badge Widget -->
    <script id="merchantWidgetScript" src="https://www.gstatic.com/shopping/merchant/merchantwidget.js" defer></script>
    <script>
      document.getElementById('merchantWidgetScript').addEventListener('load', function() {
        window.merchantwidget.start({
          merchant_id: 5713553110,
          position: "BOTTOM_LEFT",
          region: "SE"
        });
      });
    </script>
    
    <!-- Google Customer Reviews - Survey Opt-in (loaded on order confirmation) -->
    <script src="https://apis.google.com/js/platform.js?onload=gapiLoaded" async defer></script>
    <script>
      window.gapiLoaded = function() {
        // Pre-load surveyoptin module for order confirmation page
        window.gapi.load('surveyoptin', function() {});
      }
    </script>
  </body>
</html>
