.elementor-kit-12{--e-global-color-primary:#6EC1E4;--e-global-color-secondary:#54595F;--e-global-color-text:#7A7A7A;--e-global-color-accent:#61CE70;--e-global-typography-primary-font-family:"Roboto";--e-global-typography-primary-font-weight:600;--e-global-typography-secondary-font-family:"Roboto Slab";--e-global-typography-secondary-font-weight:400;--e-global-typography-text-font-family:"Roboto";--e-global-typography-text-font-weight:400;--e-global-typography-accent-font-family:"Roboto";--e-global-typography-accent-font-weight:500;}.elementor-kit-12 e-page-transition{background-color:#FFBC7D;}.elementor-section.elementor-section-boxed > .elementor-container{max-width:1140px;}.e-con{--container-max-width:1140px;}.elementor-widget:not(:last-child){--kit-widget-spacing:20px;}.elementor-element{--widgets-spacing:20px 20px;--widgets-spacing-row:20px;--widgets-spacing-column:20px;}{}h1.entry-title{display:var(--page-title-display);}@media(max-width:1024px){.elementor-section.elementor-section-boxed > .elementor-container{max-width:1024px;}.e-con{--container-max-width:1024px;}}@media(max-width:767px){.elementor-section.elementor-section-boxed > .elementor-container{max-width:767px;}.e-con{--container-max-width:767px;}}
/* Start custom CSS */<script>
const bar = document.getElementById('denimza-delivery-bar');
const popup = document.getElementById('delivery-popup');
const closeBtn = document.getElementById('close-popup');
const pincodeInput = document.getElementById('pincode-input');
const currentPincodeSpan = document.getElementById('current-pincode');
const detectBtn = document.getElementById('detect-btn');
const saveBtn = document.getElementById('save-btn');
const status = document.getElementById('detect-status');

// 1. Agar pehle se pincode save hai to dikhao
let savedPin = localStorage.getItem('denimza_pincode');
if(savedPin){ currentPincodeSpan.innerText = savedPin; }

// 2. Bar pe click -> Popup kholo
bar.addEventListener('click', () => popup.classList.remove('popup-hidden'));
closeBtn.addEventListener('click', () => popup.classList.add('popup-hidden'));

// 3. Auto-Detect Logic
detectBtn.addEventListener('click', () => {
status.innerText = "Detecting location...";
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition((pos) => {
let lat = pos.coords.latitude;
let lon = pos.coords.longitude;
// Free API se Pincode nikalo
fetch(`https://nominatim.openstreetmap.org/reverse?format=json&lat=${lat}&lon=${lon}`)
.then(r => r.json())
.then(data => {
let pin = data.address.postcode;
if(pin){
pincodeInput.value = pin;
status.innerText = "Pincode detected: " + pin;
} else {
status.innerText = "Could not detect, please enter manually";
}
});
}, () => { status.innerText = "Location permission denied"; });
}
});

// 4. Save karo
saveBtn.addEventListener('click', () => {
let pin = pincodeInput.value.trim();
if(pin.length === 6){
localStorage.setItem('denimza_pincode', pin);
currentPincodeSpan.innerText = pin;
popup.classList.add('popup-hidden');
status.innerText = "";
// Ab is pin ko WooCommerce ko bhej sakte ho products filter karne ke liye
console.log("User Pincode Saved:", pin);
} else {
alert("Please enter valid 6-digit pincode");
}
});
</script>/* End custom CSS */