/* The line below imports most of the styles for your chosen theme.
It is recommended that you leave this here to receive bug fixes or additions to this theme. */

@import url('/assets/theme_cooper.css');

/* The styles below are automatically turned into controls on the Design Bar.
For more information, see the FAQ. */

/* Colors */

.store_name a:link, .store_name a:hover, .store_name a:visited {
  color: #dc143c;                   /*: Store Name :*/
}

#main h1, #main h2, #main h3, #main h4, #main h5, #main h6, #product_name, #price, #sale_price {
  color: #000000;                   /*: Titles :*/
}

body, #main .faq h2, .label label, #product .better-select-selected-label {
  color: #000000;                   /*: Text :*/
}

a:link, a:visited, a:active, #footer a, .no-products p {
  color: #222222;                   /*: Links :*/;
}

a:hover, #sidebar ul li.current a, body.faq #buttons .faqs, body.contact #buttons .contact_us {
  color: #0098E9;                   /*: Link Hover :*/
}

#main .button, #main button, #items_in_cart, #promotion, #variant_id_chzn .result-selected, #variant_id_chzn .result-selected.highlighted, .stock-remaining, .stock-sold {
  background-color: #e4efeb;        /*: Buttons :*/
}

#main .button, #main button, #items_in_cart a, #promotion, #variant_id_chzn .result-selected, #variant_id_chzn .result-selected.highlighted {
  color: #000000;                   /*: Button Text :*/
}

hr, #thumbs a:hover, #product #variant_id, #footer, #product #variant_id_chzn > * {
  border-color: #000000;               /*: Lines :*/
}

.product .flag.status, #product .status {
  background-color: #ccc;           /*: Product Status :*/
}

#content, #header, #footer{
  background-color: #FFFFFF;        /*: Content Background :*/
}

/* Layout */

#header .store_name {
  font-family: "Times New Roman", Times, serif; /*: Store Name Font :*/
  text-align: center;                     /*: Store Name Alignment :*/
}

#main h1, #main h2, #main h3, #main h4, #main h5, #main h6, #product_name{
  font-family: "Times New Roman", Times, serif; /*: Title Font :*/
}

#banner {
  text-align:center;                /*: Header Image Alignment :*/
}


body{
  background-color: #FFFFFF;          /*: Body Background :*/
  font-family: Helvetica Neue, Arial, Helvetica; /*: Body Font :*/
  background-attachment: scroll;      /*: Background Attachment :*/
  background-repeat: repeat;          /*: Background Image Repeat :*/
  background-position: top center;    /*: Background Image Position :*/
}

/* These are non-CSS custom settings for the theme. It's best to leave these alone.
To create custom Design Bar attributes for your theme, view this help article:
https://storenvy.bolddesk.com/kb/article/229/how-do-i-add-settings-to-the-store-owner-ui */

storenvy {
  storenvy-featured-collection: collection-all;    /*: Featured Collection :*/
  storenvy-use-theme-background: if-false;         /*: Use Theme Background :*/
  storenvy-show-store-name: if-true;               /*: Show Store Name :*/
  storenvy-show-logo: if-true;                     /*: Show Logo :*/
  storenvy-show-stock-bars: if-false;              /*: Show Stock Bars :*/
}
header, #header, .header, #branding, #logo, .logo, #logo img, .logo img {
    margin-top: -55px !important;
    margin-bottom: 8px !important;
    padding-bottom: 0px !important;
}

#page, #main, #content, .container {
    margin-top: -50px !important;
    padding-top: 0px !important;
}
#sidebar ul li:first-child a, .sidebar ul li:first-child a, nav ul li:first-child a {
    margin-top: -10px !important;
    margin-bottom: 5px !important;
    display: inline-block !important;
}
/* 2. Center the Search Bar perfectly within its layout dividers */
input[type="search"], .search-form, #search_box, .search, #sidebar form, .sidebar form {
    margin-top: 15px !important;
    margin-bottom: 15px !important;
    padding: 0px !important;
}

/* 3. Tighten Contact, FAQ, Returns list spacing */
#sidebar ul, .sidebar ul, nav ul {
    margin-top: 0px !important;
    margin-bottom: 5px !important;
    padding-top: 0px !important;
    padding-bottom: 0px !important;
}

#sidebar ul li, .sidebar ul li, nav ul li {
    margin-top: 2px !important;
    margin-bottom: 2px !important;
    padding: 0px !important;
}

/* 4. Pull the Facebook section cleanly up inside its boundary */
#sidebar div, .sidebar div, [class*="social"] {
    margin-top: 8px !important;
    padding-top: 0px !important;
}
#header h1, .store-name, #store-name, #branding h1, .store-title {
    margin-top: 30px !important;
}

<script>
(function() {
    // 1. Force your conversion rate directly (approximate current USD to BDT rate)
    // This removes the API bottleneck so we can see if the script can find your prices!
    const forceBdtRate = 117.50; 

    // 2. Create a continuous loop observer that catches dynamically loaded items
    function huntAndConvertPrices() {
        // Scans absolutely every common text container on your Storenvy theme
        const elements = document.querySelectorAll('span, div, p, strong, em, h1, h2, h3, h4, .price, .money');
        
        elements.forEach(el => {
            // Target elements displaying a dollar symbol
            if (el.textContent.includes('$')) {
                // Safeguard: Ensure it's a short string (a price, not a paragraph of text)
                if (el.children.length === 0 && el.textContent.length < 20) {
                    let usdValue = parseFloat(el.textContent.replace(/[^0-9.]/g, ''));
                    
                    if (!isNaN(usdValue) && usdValue > 0) {
                        let formattedValue = (usdValue * forceBdtRate).toLocaleString('en-IN', {
                            minimumFractionDigits: 2,
                            maximumFractionDigits: 2
                        });
                        // Instantly swap out the text
                        el.textContent = `৳ ${formattedValue}`;
                    }
                }
            }
        });
    }

    // Run immediately when script loads
    huntAndConvertPrices();

    // Run again when the page window claims it is fully loaded
    window.addEventListener('load', huntAndConvertPrices);

    // Keep checking every 400ms for 5 seconds to override Storenvy's slow background scripts
    let checks = 0;
    const intervalHunter = setInterval(() => {
        huntAndConvertPrices();
        checks++;
        if (checks > 12) clearInterval(intervalHunter);
    }, 400);

    // Append the notice banner
    let banner = document.createElement('div');
    banner.style = "position:fixed; bottom:15px; right:15px; background:#111; color:#fff; padding:10px 14px; font-size:13px; z-index:999999; border-radius:6px; font-family:sans-serif; box-shadow:0 4px 10px rgba(0,0,0,0.3);";
    banner.innerHTML = `Prices converted to <b>BDT (৳)</b>. Checkout processes in USD.`;
    document.body.appendChild(banner);
})();
</script>

