<section id="service_features" class="py-24 bg-white relative overflow-hidden">
  <!-- Background elements -->
  <div class="absolute inset-0 bg-gradient-to-br from-purple-50 to-indigo-50 opacity-30"></div>
  <div class="absolute inset-0 overflow-hidden">
    <div class="absolute inset-0 opacity-[0.03]" aria-hidden="true">
      <svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
        <defs>
          <pattern id="service-features-grid" width="40" height="40" patternUnits="userSpaceOnUse">
            <path d="M0 0h40v40H0z" fill="none" />
            <path d="M0 0h1v40H0zm40 0v1H0V0zm0 40h-1V0h1zM0 40v-1h40v1z" fill="currentColor" />
          </pattern>
        </defs>
        <rect width="100%" height="100%" fill="url(#service-features-grid)" />
      </svg>
    </div>
  </div>
  
  <div class="relative z-10 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
    <!-- Section header -->
    <div class="text-center max-w-3xl mx-auto mb-16" data-aos="fade-up">
      {% if sections.service_features.badge %}
      <span class="inline-block px-4 py-1 rounded-full text-sm font-medium bg-indigo-100 text-indigo-700 mb-4">
        {{ sections.service_features.badge }}
      </span>
      {% endif %}
      <h2 class="text-4xl font-bold text-gray-900 mb-4">
        {{ sections.service_features.title }}
      </h2>
      <p class="text-lg text-gray-600 max-w-2xl mx-auto">
        {{ sections.service_features.subtitle }}
      </p>
    </div>
    
    <!-- Service features layout options -->
    {% if sections.service_features.layout == 'alternating' %}
    <!-- Alternating layout -->
    <div class="space-y-24">
      {% for feature in sections.service_features.items %}
      <div class="grid lg:grid-cols-2 gap-12 items-center {% if loop.index is even %}lg:flex-row-reverse{% endif %}">
        <!-- Content column -->
        <div class="space-y-6" data-aos="fade-{% if loop.index is even %}left{% else %}right{% endif %}">
          {% if feature.badge %}
          <span class="inline-block px-4 py-1 rounded-full text-sm font-medium bg-indigo-100 text-indigo-700">
            {{ feature.badge }}
          </span>
          {% endif %}
          <h3 class="text-3xl font-bold text-gray-900">{{ feature.title }}</h3>
          <p class="text-lg text-gray-600">{{ feature.description }}</p>
          
          <!-- Feature benefits if available -->
          {% if feature.benefits %}
          <ul class="space-y-4 mt-6">
            {% for benefit in feature.benefits %}
            <li class="flex items-start">
              <div class="flex-shrink-0 w-6 h-6 rounded-full bg-indigo-100 flex items-center justify-center text-indigo-600 mr-3">
                <svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
                </svg>
              </div>
              <div>
                <h4 class="text-lg font-medium text-gray-900">{{ benefit.title }}</h4>
                <p class="text-gray-600">{{ benefit.description }}</p>
              </div>
            </li>
            {% endfor %}
          </ul>
          {% endif %}
          
          <!-- CTA button if available -->
          {% if feature.cta_url and feature.cta_text %}
          <div class="mt-8">
            <a 
              href="{{ feature.cta_url }}" 
              class="inline-flex items-center px-6 py-3 bg-indigo-600 text-white font-medium rounded-lg hover:bg-indigo-700 transition-colors duration-300"
            >
              {{ feature.cta_text }}
              <svg class="w-4 h-4 ml-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 5l7 7m0 0l-7 7m7-7H3" />
              </svg>
            </a>
          </div>
          {% endif %}
        </div>
        
        <!-- Media column -->
        <div class="relative" data-aos="fade-{% if loop.index is even %}right{% else %}left{% endif %}">
          {% if feature.image %}
          <div class="rounded-2xl overflow-hidden shadow-xl">
            <img 
              src="{{ feature.image }}" 
              alt="{{ feature.title }}" 
              class="w-full h-auto"
              loading="lazy"
            >
          </div>
          
          <!-- Decorative elements -->
          <div class="absolute -top-6 -right-6 w-32 h-32 bg-indigo-200 rounded-full opacity-70 -z-10"></div>
          <div class="absolute -bottom-6 -left-6 w-32 h-32 bg-purple-200 rounded-full opacity-70 -z-10"></div>
          {% endif %}
        </div>
      </div>
      {% endfor %}
    </div>
    
    {% elif sections.service_features.layout == 'grid' %}
    <!-- Grid layout -->
    <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-8">
      {% for feature in sections.service_features.items %}
      <div 
        class="bg-white rounded-xl shadow-md p-8 border border-gray-100 transition-all duration-300 hover:shadow-lg hover:border-indigo-200"
        data-aos="fade-up" 
        data-aos-delay="{{ loop.index0 * 100 }}"
      >
        <div class="w-16 h-16 rounded-lg bg-indigo-100 flex items-center justify-center text-indigo-600 mb-6">
          <i class="{{ feature.icon }}" aria-hidden="true"></i>
        </div>
        <h3 class="text-xl font-semibold text-gray-900 mb-3">{{ feature.title }}</h3>
        <p class="text-gray-600 mb-6">{{ feature.description }}</p>
        
        {% if feature.image %}
        <div class="mt-6 rounded-lg overflow-hidden">
          <img 
            src="{{ feature.image }}" 
            alt="{{ feature.title }}" 
            class="w-full h-auto"
            loading="lazy"
          >
        </div>
        {% endif %}
        
        {% if feature.cta_url and feature.cta_text %}
        <div class="mt-6">
          <a href="{{ feature.cta_url }}" class="text-indigo-600 font-medium hover:text-indigo-700 inline-flex items-center">
            {{ feature.cta_text }}
            <svg class="w-4 h-4 ml-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 5l7 7m0 0l-7 7m7-7H3" />
            </svg>
          </a>
        </div>
        {% endif %}
      </div>
      {% endfor %}
    </div>
    
    {% else %}
    <!-- Default cards layout -->
    <div class="space-y-12">
      {% for feature in sections.service_features.items %}
      <div 
        class="bg-white rounded-xl shadow-md overflow-hidden border border-gray-100 transition-all duration-300 hover:shadow-lg hover:border-indigo-200"
        data-aos="fade-up" 
        data-aos-delay="{{ loop.index0 * 100 }}"
      >
        <div class="grid md:grid-cols-2 items-center">
          <!-- Media column -->
          {% if feature.image %}
          <div class="aspect-[4/3] w-full h-full">
            <img 
              src="{{ feature.image }}" 
              alt="{{ feature.title }}" 
              class="w-full h-full object-cover"
              loading="lazy"
            >
          </div>
          {% endif %}
          
          <!-- Content column -->
          <div class="p-8 md:p-12">
            {% if feature.badge %}
            <span class="inline-block px-4 py-1 rounded-full text-sm font-medium bg-indigo-100 text-indigo-700 mb-4">
              {{ feature.badge }}
            </span>
            {% endif %}
            <h3 class="text-2xl font-bold text-gray-900 mb-4">{{ feature.title }}</h3>
            <p class="text-gray-600 mb-6">{{ feature.description }}</p>
            
            <!-- Feature benefits if available -->
            {% if feature.benefits %}
            <ul class="space-y-3 mb-6">
              {% for benefit in feature.benefits %}
              <li class="flex items-center">
                <svg class="w-5 h-5 text-indigo-500 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
                </svg>
                <span class="text-gray-600">{{ benefit }}</span>
              </li>
              {% endfor %}
            </ul>
            {% endif %}
            
            <!-- CTA button if available -->
            {% if feature.cta_url and feature.cta_text %}
            <div>
              <a 
                href="{{ feature.cta_url }}" 
                class="inline-flex items-center px-6 py-3 bg-indigo-600 text-white font-medium rounded-lg hover:bg-indigo-700 transition-colors duration-300"
              >
                {{ feature.cta_text }}
                <svg class="w-4 h-4 ml-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 5l7 7m0 0l-7 7m7-7H3" />
                </svg>
              </a>
            </div>
            {% endif %}
          </div>
        </div>
      </div>
      {% endfor %}
    </div>
    {% endif %}
    
    <!-- CTA section if available -->
    {% if sections.service_features.cta %}
    <div class="mt-24 bg-indigo-600 rounded-2xl shadow-xl p-8 md:p-12 text-white" data-aos="fade-up" data-aos-delay="300">
      <div class="max-w-3xl mx-auto text-center">
        <h3 class="text-3xl font-bold mb-4">{{ sections.service_features.cta.title }}</h3>
        <p class="text-indigo-100 mb-8">{{ sections.service_features.cta.description }}</p>
        <div class="flex flex-col sm:flex-row gap-4 justify-center">
          {% for button in sections.service_features.cta.buttons %}
          <a 
            href="{{ button.url }}" 
            class="inline-flex items-center justify-center px-6 py-3 rounded-lg font-medium transition-all duration-300 {% if button.style == 'primary' %}bg-white text-indigo-600 hover:bg-indigo-50{% else %}bg-indigo-700 text-white border border-indigo-500 hover:bg-indigo-800{% endif %}"
          >
            {% if button.icon %}
            <i class="{{ button.icon }} mr-2" aria-hidden="true"></i>
            {% endif %}
            {{ button.label }}
          </a>
          {% endfor %}
        </div>
      </div>
    </div>
    {% endif %}
  </div>
</section>
