<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>M&A Cleaning Services London - Multi-Service Calculator</title>
  <style>
    /* Scoped styles for the Cleaning Service Calculator */
    #ma-cleaning-calculator {
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      max-width: 600px;
      margin: 40px auto;
      padding: 25px;
      border: 1px solid #e0e0e0;
      border-radius: 12px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
      background-color: #ffffff;
    }

    #ma-cleaning-calculator h2 {
      text-align: center;
      margin-bottom: 25px;
      color: #2c3e50;
      font-size: 1.8em;
    }

    .service-group {
      margin-bottom: 20px;
    }

    .service-item {
      display: flex;
      align-items: center;
      margin-bottom: 10px;
      padding: 10px;
      border: 1px solid #f0f0f0;
      border-radius: 8px;
      transition: background-color 0.3s ease;
    }

    .service-item:hover {
      background-color: #f9f9f9;
    }

    .service-item input[type="checkbox"] {
      margin-right: 15px;
      transform: scale(1.2);
    }

    .service-details {
      flex: 1;
      display: flex;
      flex-direction: column;
    }

    .service-name {
      font-weight: 600;
      color: #34495e;
    }

    .service-rate {
      font-size: 0.9em;
      color: #7f8c8d;
    }

    .quantity-input {
      margin-top: 8px;
      display: flex;
      align-items: center;
    }

    .quantity-input label {
      margin-right: 8px;
      font-size: 0.9em;
      color: #555555;
    }

    .quantity-input input[type="number"] {
      width: 60px;
      padding: 6px;
      border: 1px solid #ccc;
      border-radius: 4px;
      font-size: 1em;
    }

    #calculate-btn {
      width: 100%;
      padding: 12px;
      background-color: #28a745;
      color: white;
      border: none;
      border-radius: 6px;
      cursor: pointer;
      font-size: 1.1em;
      transition: background-color 0.3s ease;
      margin-top: 10px;
    }

    #calculate-btn:hover {
      background-color: #218838;
    }

    #result-container {
      margin-top: 25px;
      padding: 15px;
      border: 1px solid #e0e0e0;
      border-radius: 8px;
      background-color: #f8f9fa;
      display: none;
      animation: fadeIn 0.5s ease-in-out;
    }

    #result-container p {
      margin: 10px 0;
      font-size: 1em;
      color: #2c3e50;
    }

    #result-container p strong {
      color: #16a085;
      font-size: 1.2em;
    }

    #result-container p.info {
      font-size: 0.9em;
      color: #555555;
    }

    #contact-btn {
      width: 100%;
      padding: 12px;
      background-color: #007bff;
      color: white;
      border: none;
      border-radius: 6px;
      cursor: pointer;
      font-size: 1.1em;
      transition: background-color 0.3s ease;
      margin-top: 10px;
    }

    #contact-btn:hover {
      background-color: #0069d9;
    }

    /* Animation */
    @keyframes fadeIn {
      from { opacity: 0; }
      to { opacity: 1; }
    }

    /* Responsive Design */
    @media (max-width: 600px) {
      #ma-cleaning-calculator {
        margin: 20px;
        padding: 20px;
      }

      #ma-cleaning-calculator h2 {
        font-size: 1.5em;
      }

      .service-item {
        flex-direction: column;
        align-items: flex-start;
      }

      .quantity-input {
        margin-top: 10px;
      }

      .quantity-input input[type="number"] {
        width: 100%;
      }
    }
  </style>
</head>
<body>

  <!-- Cleaning Service Calculator -->
  <div id="ma-cleaning-calculator">
    <h2>Cleaning Service Calculator</h2>
    
    <!-- Service Selection -->
    <div class="service-group">
      <div class="service-item">
        <input type="checkbox" id="service-domestic" data-service="domestic">
        <div class="service-details">
          <span class="service-name">Domestic Cleaning</span>
          <span class="service-rate">£17 per hour</span>
          <div class="quantity-input" id="quantity-domestic" style="display: none;">
            <label for="input-domestic">Hours:</label>
            <input type="number" id="input-domestic" min="1" value="3">
          </div>
        </div>
      </div>

      <div class="service-item">
        <input type="checkbox" id="service-commercial" data-service="commercial">
        <div class="service-details">
          <span class="service-name">Commercial Cleaning</span>
          <span class="service-rate">£18 per hour</span>
          <div class="quantity-input" id="quantity-commercial" style="display: none;">
            <label for="input-commercial">Hours:</label>
            <input type="number" id="input-commercial" min="1" value="3">
          </div>
        </div>
      </div>

      <div class="service-item">
        <input type="checkbox" id="service-deep" data-service="deep">
        <div class="service-details">
          <span class="service-name">Deep Cleaning</span>
          <span class="service-rate">£20 per hour</span>
          <div class="quantity-input" id="quantity-deep" style="display: none;">
            <label for="input-deep">Hours:</label>
            <input type="number" id="input-deep" min="1" value="3">
          </div>
        </div>
      </div>

      <div class="service-item">
        <input type="checkbox" id="service-oven" data-service="oven">
        <div class="service-details">
          <span class="service-name">Oven Cleaning</span>
          <span class="service-rate">£65 per service</span>
          <div class="quantity-input" id="quantity-oven" style="display: none;">
            <label for="input-oven">Quantity:</label>
            <input type="number" id="input-oven" min="1" value="1">
          </div>
        </div>
      </div>

      <div class="service-item">
        <input type="checkbox" id="service-carpet" data-service="carpet">
        <div class="service-details">
          <span class="service-name">Carpet Cleaning</span>
          <span class="service-rate">£50 per service</span>
          <div class="quantity-input" id="quantity-carpet" style="display: none;">
            <label for="input-carpet">Quantity:</label>
            <input type="number" id="input-carpet" min="1" value="1">
          </div>
        </div>
      </div>

      <!-- Add more services similarly -->
      <div class="service-item">
        <input type="checkbox" id="service-office" data-service="office">
        <div class="service-details">
          <span class="service-name">Office Cleaning</span>
          <span class="service-rate">£18 per hour</span>
          <div class="quantity-input" id="quantity-office" style="display: none;">
            <label for="input-office">Hours:</label>
            <input type="number" id="input-office" min="1" value="3">
          </div>
        </div>
      </div>

      <div class="service-item">
        <input type="checkbox" id="service-window_inside" data-service="window_inside">
        <div class="service-details">
          <span class="service-name">Window Cleaning (Inside)</span>
          <span class="service-rate">£13 per hour</span>
          <div class="quantity-input" id="quantity-window_inside" style="display: none;">
            <label for="input-window_inside">Hours:</label>
            <input type="number" id="input-window_inside" min="1" value="3">
          </div>
        </div>
      </div>

      <div class="service-item">
        <input type="checkbox" id="service-window_outside" data-service="window_outside">
        <div class="service-details">
          <span class="service-name">Window Cleaning (Outside)</span>
          <span class="service-rate">£40 per service</span>
          <div class="quantity-input" id="quantity-window_outside" style="display: none;">
            <label for="input-window_outside">Quantity:</label>
            <input type="number" id="input-window_outside" min="1" value="1">
          </div>
        </div>
      </div>

      <div class="service-item">
        <input type="checkbox" id="service-end_tenancy" data-service="end_tenancy">
        <div class="service-details">
          <span class="service-name">End of Tenancy Cleaning</span>
          <span class="service-rate">£130 per service</span>
          <div class="quantity-input" id="quantity-end_tenancy" style="display: none;">
            <label for="input-end_tenancy">Quantity:</label>
            <input type="number" id="input-end_tenancy" min="1" value="1">
          </div>
        </div>
      </div>

      <div class="service-item">
        <input type="checkbox" id="service-holiday" data-service="holiday">
        <div class="service-details">
          <span class="service-name">Holiday Rental Cleaning</span>
          <span class="service-rate">£16 per hour</span>
          <div class="quantity-input" id="quantity-holiday" style="display: none;">
            <label for="input-holiday">Hours:</label>
            <input type="number" id="input-holiday" min="1" value="3">
          </div>
        </div>
      </div>

      <div class="service-item">
        <input type="checkbox" id="service-party" data-service="party">
        <div class="service-details">
          <span class="service-name">Pre/Post Party Clean-ups</span>
          <span class="service-rate">£18 per hour</span>
          <div class="quantity-input" id="quantity-party" style="display: none;">
            <label for="input-party">Hours:</label>
            <input type="number" id="input-party" min="1" value="3">
          </div>
        </div>
      </div>

      <div class="service-item">
        <input type="checkbox" id="service-builders" data-service="builders">
        <div class="service-details">
          <span class="service-name">Builders Cleaning</span>
          <span class="service-rate">£20 per hour</span>
          <div class="quantity-input" id="quantity-builders" style="display: none;">
            <label for="input-builders">Hours:</label>
            <input type="number" id="input-builders" min="1" value="3">
          </div>
        </div>
      </div>

      <div class="service-item">
        <input type="checkbox" id="service-gardening" data-service="gardening">
        <div class="service-details">
          <span class="service-name">Gardening Services</span>
          <span class="service-rate">£40 per service</span>
          <div class="quantity-input" id="quantity-gardening" style="display: none;">
            <label for="input-gardening">Quantity:</label>
            <input type="number" id="input-gardening" min="1" value="1">
          </div>
        </div>
      </div>
    </div>
    
    <!-- Calculate Button -->
    <button id="calculate-btn">Calculate Total</button>
    
    <!-- Result Display -->
    <div id="result-container">
      <p>Estimated Total Cost: <strong id="estimated-cost"></strong></p>
      <p class="info">This is a preliminary estimate. For an accurate quote, please contact our representatives.</p>
      <button id="contact-btn">Contact Us Now</button>
    </div>
  </div>
  
  <!-- Calculator Script -->
  <script>
    // Get references to DOM elements
    const calculator = document.getElementById('ma-cleaning-calculator');
    const serviceItems = calculator.querySelectorAll('.service-item input[type="checkbox"]');
    const calculateBtn = document.getElementById('calculate-btn');
    const resultContainer = document.getElementById('result-container');
    const estimatedCost = document.getElementById('estimated-cost');
    const contactBtn = document.getElementById('contact-btn');

    // Define service rates
    const serviceRates = {
      domestic: { type: 'hourly', rate: 17, minHours: 3 },
      commercial: { type: 'hourly', rate: 18, minHours: 3 },
      deep: { type: 'hourly', rate: 20, minHours: 3 },
      oven: { type: 'service', rate: 65 },
      carpet: { type: 'service', rate: 50 },
      office: { type: 'hourly', rate: 18, minHours: 3 },
      window_inside: { type: 'hourly', rate: 13, minHours: 3 },
      window_outside: { type: 'service', rate: 40 },
      end_tenancy: { type: 'service', rate: 130 },
      holiday: { type: 'hourly', rate: 16, minHours: 3 },
      party: { type: 'hourly', rate: 18, minHours: 3 },
      builders: { type: 'hourly', rate: 20, minHours: 3 },
      gardening: { type: 'service', rate: 40 }
    };

    // Function to toggle quantity input visibility
    function toggleQuantityInput(event) {
      const checkbox = event.target;
      const service = checkbox.getAttribute('data-service');
      const quantityContainer = document.getElementById(`quantity-${service}`);
      if (checkbox.checked) {
        quantityContainer.style.display = 'flex';
      } else {
        quantityContainer.style.display = 'none';
      }
      // Hide result when selection changes
      resultContainer.style.display = 'none';
    }

    // Attach event listeners to checkboxes
    serviceItems.forEach(checkbox => {
      checkbox.addEventListener('change', toggleQuantityInput);
    });

    // Calculate estimated cost
    calculateBtn.addEventListener('click', function() {
      let totalCost = 0;
      let selectedServices = false;

      serviceItems.forEach(checkbox => {
        if (checkbox.checked) {
          selectedServices = true;
          const service = checkbox.getAttribute('data-service');
          const serviceInfo = serviceRates[service];
          const quantityInput = document.getElementById(`input-${service}`);
          let quantity = parseInt(quantityInput.value);

          if (isNaN(quantity) || quantity < 1) {
            alert(`Please enter a valid quantity for ${getServiceName(service)}.`);
            totalCost = null;
            return;
          }

          if (serviceInfo.type === 'hourly') {
            const hours = Math.max(quantity, serviceInfo.minHours);
            totalCost += hours * serviceInfo.rate;
          } else if (serviceInfo.type === 'service') {
            totalCost += quantity * serviceInfo.rate;
          }
        }
      });

      if (!selectedServices) {
        alert('Please select at least one service.');
        return;
      }

      if (totalCost === null) {
        // Invalid input encountered
        return;
      }

      // Format cost to GBP
      const formattedCost = '£' + totalCost.toFixed(2);
      estimatedCost.textContent = formattedCost;

      // Show result container with animation
      resultContainer.style.display = 'block';
    });

    // Handle contact button click
    contactBtn.addEventListener('click', function() {
      // Redirect to contact page or open a contact form
      // Option 1: Open phone dialer
      window.location.href = 'tel:02088034690';

      // Option 2: Redirect to contact form
      // window.location.href = 'https://www.mnacleanerslondon.co.uk/contact';
    });

    // Utility function to get service name (for alerts)
    function getServiceName(serviceKey) {
      const serviceElements = {
        domestic: 'Domestic Cleaning',
        commercial: 'Commercial Cleaning',
        deep: 'Deep Cleaning',
        oven: 'Oven Cleaning',
        carpet: 'Carpet Cleaning',
        office: 'Office Cleaning',
        window_inside: 'Window Cleaning (Inside)',
        window_outside: 'Window Cleaning (Outside)',
        end_tenancy: 'End of Tenancy Cleaning',
        holiday: 'Holiday Rental Cleaning',
        party: 'Pre/Post Party Clean-ups',
        builders: 'Builders Cleaning',
        gardening: 'Gardening Services'
      };
      return serviceElements[serviceKey] || 'Selected Service';
    }
  </script>

</body>
</html>
