<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Cleaner Cleaner Ltd. – Price Calculator</title>

  <!-- Minimal styling to avoid conflicts -->
  <style>
    /* Basic responsive container */
    #cleaner-calculator-container {
      max-width: 600px;
      margin: 0 auto;
      padding: 15px;
      border: 1px solid #ddd;
    }

    /* Form and field styling */
    .calculator-section {
      margin-bottom: 1rem;
    }

    .calculator-section h3 {
      margin-bottom: 0.5rem;
      font-size: 1.1rem;
    }

    .item-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 0.5rem;
    }

    .item-row label {
      flex: 1;
      margin-right: 0.5rem;
    }

    .item-row input[type="number"] {
      width: 60px;
      text-align: right;
    }

    /* Result area */
    #result-area {
      margin-top: 1rem;
      padding: 1rem;
      background-color: #f9f9f9;
      display: none; /* Hidden by default */
    }

    #estimated-cost {
      font-weight: bold;
      font-size: 1.2rem;
      margin-bottom: 0.5rem;
    }

    /* Contact button */
    #contact-button {
      display: inline-block;
      padding: 0.6rem 1rem;
      text-decoration: none;
      border: none;
      background-color: #007BFF; /* Example primary color */
      color: #fff;
      font-size: 1rem;
      cursor: pointer;
      margin-top: 0.5rem;
    }

    #contact-button:hover {
      background-color: #0056b3;
    }

    /* Responsive rules for smaller devices */
    @media (max-width: 480px) {
      .item-row {
        flex-direction: column;
        align-items: flex-start;
      }
      .item-row label {
        margin-bottom: 0.3rem;
      }
      .item-row input[type="number"] {
        margin-bottom: 0.5rem;
      }
    }
  </style>
</head>
<body>

<div id="cleaner-calculator-container">

  <h2>Cleaner Cleaner Ltd. – Price Calculator</h2>
  <p style="font-size: 0.9rem;">
    Enter your cleaning needs below to get an <strong>approximate</strong> cost. 
    Actual quote may vary. <br />
    <em>Prices shown are "from" and may be adjusted on inspection.</em>
  </p>

  <!-- Calculator Form -->
  <form id="cleaner-calculator-form" onsubmit="event.preventDefault(); calculateTotal();">
    
    <!-- End of Tenancy Section (Group A) -->
    <div class="calculator-section">
      <h3>End of Tenancy Cleaning</h3>
      <!--
        No minimum charge or VAT mentioned specifically for this category.
        "From" prices are used.
      -->
      <div class="item-row">
        <label for="studioFlat">Studio Flat (from £175): </label>
        <input type="number" id="studioFlat" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="oneBedFlat">1 Bed, 1 Bath Flat (from £195): </label>
        <input type="number" id="oneBedFlat" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="twoBedFlat">2 Bed, 1 Bath Flat (from £230): </label>
        <input type="number" id="twoBedFlat" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="threeBedFlat">3 Bed, 1 Bath Flat (from £290): </label>
        <input type="number" id="threeBedFlat" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="fourBedFlat">4 Bed, 1 Bath Flat (from £310): </label>
        <input type="number" id="fourBedFlat" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="flatshareRoom">Flatshare Bedroom (from £120): </label>
        <input type="number" id="flatshareRoom" min="0" value="0">
      </div>
    </div>

    <!-- Carpet Cleaning Section (Group B) -->
    <div class="calculator-section">
      <h3>Carpet Cleaning</h3>
      <!--
        "Minimum charge: £80 + VAT" applies when using Carpet/Upholstery/Leather services.
        We'll calculate them together in the script (Group B).
        Basic 20% VAT assumption.
      -->
      <div class="item-row">
        <label for="bedroomCarpet">Bedroom (up to 12x12) – £75 each: </label>
        <input type="number" id="bedroomCarpet" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="livingRoomCarpet">Living Room (up to 15x15) – £85 each: </label>
        <input type="number" id="livingRoomCarpet" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="hallwayCarpet">Hallway (up to 4x10) – £50 each: </label>
        <input type="number" id="hallwayCarpet" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="stairsCarpet">Set of Stairs (12 steps) – £75 each: </label>
        <input type="number" id="stairsCarpet" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="landingCarpet">Landing (up to 4x4) – £35 each: </label>
        <input type="number" id="landingCarpet" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="rugCarpet">Rug (from £40) – each: </label>
        <input type="number" id="rugCarpet" min="0" value="0">
      </div>
    </div>

    <!-- Upholstery & Sofa Cleaning (Group B) -->
    <div class="calculator-section">
      <h3>Upholstery & Sofa Cleaning</h3>
      <div class="item-row">
        <label for="twoSeaterUph">2-Seater Fabric Sofa (from £140): </label>
        <input type="number" id="twoSeaterUph" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="threeSeaterUph">3-Seater Fabric Sofa (from £160): </label>
        <input type="number" id="threeSeaterUph" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="armchairUph">Armchair (from £85): </label>
        <input type="number" id="armchairUph" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="diningChairUph">Dining Chair (from £50): </label>
        <input type="number" id="diningChairUph" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="doubleMattressUph">Double Mattress (from £120): </label>
        <input type="number" id="doubleMattressUph" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="singleMattressUph">Single Mattress (from £90): </label>
        <input type="number" id="singleMattressUph" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="romanBlindsUph">Roman Blinds (from £30): </label>
        <input type="number" id="romanBlindsUph" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="stainRemovalUph">Professional Stain Removal (from £90): </label>
        <input type="number" id="stainRemovalUph" min="0" value="0">
      </div>
    </div>

    <!-- Leather Upholstery Cleaning (Group B) -->
    <div class="calculator-section">
      <h3>Leather Upholstery Cleaning</h3>
      <div class="item-row">
        <label for="twoSeaterLeather">2-Seater Leather Sofa (from £120): </label>
        <input type="number" id="twoSeaterLeather" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="threeSeaterLeather">3-Seater Leather Sofa (from £140): </label>
        <input type="number" id="threeSeaterLeather" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="armchairLeather">Leather Armchair (from £80): </label>
        <input type="number" id="armchairLeather" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="diningChairLeather">Leather Dining Chair (from £55): </label>
        <input type="number" id="diningChairLeather" min="0" value="0">
      </div>
      <div class="item-row">
        <label for="footstoolLeather">Leather Footstool (from £35): </label>
        <input type="number" id="footstoolLeather" min="0" value="0">
      </div>
    </div>

    <!-- Calculate Button -->
    <button type="submit" style="padding: 0.6rem 1rem;">Calculate</button>
  </form>

  <!-- Result Area -->
  <div id="result-area">
    <div id="estimated-cost"></div>
    <p style="font-size: 0.9rem;">
      This is a preliminary calculation. For an accurate quote, please contact our representative.
    </p>
    <button id="contact-button" onclick="window.location.href='tel:+441234567890';">
      Call Now to Confirm Your Quote
    </button>
  </div>

  <!-- Summary / Disclaimers -->
  <div style="margin-top: 1rem; font-size: 0.8rem; color: #666;">
    <strong>General Information:</strong> 7-day guarantee, materials & equipment included, 
    free antiviral & antibacterial spray. Payments via BACS, Cash, Crypto. No hidden charges.
    <br />
    <strong>Minimum Charge:</strong> For Carpet, Upholstery & Leather cleaning, £80 + VAT applies.
  </div>

</div>

<!-- JavaScript Section -->
<script>
  // All "from" prices for End of Tenancy (Group A, no minimum, no extra VAT specified)
  const endOfTenancyPrices = {
    studioFlat: 175,
    oneBedFlat: 195,
    twoBedFlat: 230,
    threeBedFlat: 290,
    fourBedFlat: 310,    // "from" 310-345; we use 310 for an estimate
    flatshareRoom: 120
  };

  // Carpet Cleaning Prices, Upholstery & Leather (Group B, min charge £80 + 20% VAT)
  // We'll do a combined sum for these categories.
  const groupBPrices = {
    // Carpet
    bedroomCarpet: 75,
    livingRoomCarpet: 85,
    hallwayCarpet: 50,
    stairsCarpet: 75,
    landingCarpet: 35,
    rugCarpet: 40,        // "from" price

    // Upholstery
    twoSeaterUph: 140,
    threeSeaterUph: 160,
    armchairUph: 85,
    diningChairUph: 50,
    doubleMattressUph: 120,
    singleMattressUph: 90,
    romanBlindsUph: 30,   // "from" 30-70
    stainRemovalUph: 90,  // "from"

    // Leather
    twoSeaterLeather: 120,
    threeSeaterLeather: 140,
    armchairLeather: 80,
    diningChairLeather: 55,
    footstoolLeather: 35   // "from" 35-70
  };

  // Calculate the total cost
  function calculateTotal() {
    // 1) Calculate End of Tenancy (Group A)
    let endOfTenancyTotal = 0;
    endOfTenancyTotal += endOfTenancyPrices.studioFlat     * getValue('studioFlat');
    endOfTenancyTotal += endOfTenancyPrices.oneBedFlat     * getValue('oneBedFlat');
    endOfTenancyTotal += endOfTenancyPrices.twoBedFlat     * getValue('twoBedFlat');
    endOfTenancyTotal += endOfTenancyPrices.threeBedFlat   * getValue('threeBedFlat');
    endOfTenancyTotal += endOfTenancyPrices.fourBedFlat    * getValue('fourBedFlat');
    endOfTenancyTotal += endOfTenancyPrices.flatshareRoom  * getValue('flatshareRoom');

    // 2) Calculate combined Carpet/Upholstery/Leather (Group B)
    let groupBTotal = 0;
    groupBTotal += groupBPrices.bedroomCarpet        * getValue('bedroomCarpet');
    groupBTotal += groupBPrices.livingRoomCarpet     * getValue('livingRoomCarpet');
    groupBTotal += groupBPrices.hallwayCarpet        * getValue('hallwayCarpet');
    groupBTotal += groupBPrices.stairsCarpet         * getValue('stairsCarpet');
    groupBTotal += groupBPrices.landingCarpet        * getValue('landingCarpet');
    groupBTotal += groupBPrices.rugCarpet            * getValue('rugCarpet');

    groupBTotal += groupBPrices.twoSeaterUph         * getValue('twoSeaterUph');
    groupBTotal += groupBPrices.threeSeaterUph       * getValue('threeSeaterUph');
    groupBTotal += groupBPrices.armchairUph          * getValue('armchairUph');
    groupBTotal += groupBPrices.diningChairUph       * getValue('diningChairUph');
    groupBTotal += groupBPrices.doubleMattressUph    * getValue('doubleMattressUph');
    groupBTotal += groupBPrices.singleMattressUph    * getValue('singleMattressUph');
    groupBTotal += groupBPrices.romanBlindsUph       * getValue('romanBlindsUph');
    groupBTotal += groupBPrices.stainRemovalUph      * getValue('stainRemovalUph');

    groupBTotal += groupBPrices.twoSeaterLeather     * getValue('twoSeaterLeather');
    groupBTotal += groupBPrices.threeSeaterLeather   * getValue('threeSeaterLeather');
    groupBTotal += groupBPrices.armchairLeather      * getValue('armchairLeather');
    groupBTotal += groupBPrices.diningChairLeather   * getValue('diningChairLeather');
    groupBTotal += groupBPrices.footstoolLeather     * getValue('footstoolLeather');

    // 2a) If groupBTotal is greater than 0, apply minimum charge logic + VAT
    //     Minimum charge is £80, then 20% VAT on top.
    let groupBFinal = 0;
    if (groupBTotal > 0) {
      let rawGroupB = (groupBTotal < 80) ? 80 : groupBTotal; // apply minimum
      groupBFinal = rawGroupB * 1.20; // add 20% VAT
    }

    // 3) Final total is sum of Group A + Group B
    let finalTotal = endOfTenancyTotal + groupBFinal;

    // 4) Display the result
    const resultArea = document.getElementById("result-area");
    const estimatedCost = document.getElementById("estimated-cost");
    resultArea.style.display = "block";

    // Round to 2 decimals for clarity
    estimatedCost.textContent = "Estimated Total: £" + finalTotal.toFixed(2);
  }

  // Helper function: safely get the numeric value from an input
  function getValue(id) {
    const val = parseInt(document.getElementById(id).value, 10);
    return isNaN(val) ? 0 : val;
  }
</script>

</body>
</html>
