<div class="max-w-4xl mx-auto">
  <h1 class="text-2xl font-bold text-gray-800 mb-6">Store Settings</h1>
  <div class="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
    <form action="/admin/settings" method="POST">
      <h2 class="font-semibold text-gray-800 mb-4">General</h2>
      <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
        <div><label class="block text-sm font-medium text-gray-700 mb-1">Store Name</label><input type="text" name="store_name" value="<%= typeof settings.store_name !== 'undefined' ? settings.store_name : appName %>" class="w-full px-4 py-2 border border-gray-300 rounded-lg"></div>
        <div><label class="block text-sm font-medium text-gray-700 mb-1">Store Email</label><input type="email" name="store_email" value="<%= typeof settings.store_email !== 'undefined' ? settings.store_email : '' %>" class="w-full px-4 py-2 border border-gray-300 rounded-lg"></div>
        <div><label class="block text-sm font-medium text-gray-700 mb-1">Store Phone</label><input type="text" name="store_phone" value="<%= typeof settings.store_phone !== 'undefined' ? settings.store_phone : '' %>" class="w-full px-4 py-2 border border-gray-300 rounded-lg"></div>
        <div><label class="block text-sm font-medium text-gray-700 mb-1">Currency</label><select name="currency" class="w-full px-4 py-2 border border-gray-300 rounded-lg"><option value="INR" <%= settings.currency === 'INR' || !settings.currency ? 'selected' : '' %>>INR (₹)</option><option value="USD" <%= settings.currency === 'USD' ? 'selected' : '' %>>USD ($)</option></select></div>
        <div class="md:col-span-2"><label class="block text-sm font-medium text-gray-700 mb-1">Store Address</label><textarea name="store_address" rows="2" class="w-full px-4 py-2 border border-gray-300 rounded-lg"><%= typeof settings.store_address !== 'undefined' ? settings.store_address : '' %></textarea></div>
      </div>

      <h2 class="font-semibold text-gray-800 mb-4">Tax & Shipping</h2>
      <div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
        <div><label class="block text-sm font-medium text-gray-700 mb-1">Tax Rate (%)</label><input type="number" step="0.01" name="tax_rate" value="<%= typeof settings.tax_rate !== 'undefined' ? settings.tax_rate : 18 %>" class="w-full px-4 py-2 border border-gray-300 rounded-lg"></div>
        <div><label class="block text-sm font-medium text-gray-700 mb-1">Flat Shipping Rate (₹)</label><input type="number" step="0.01" name="shipping_flat_rate" value="<%= typeof settings.shipping_flat_rate !== 'undefined' ? settings.shipping_flat_rate : 50 %>" class="w-full px-4 py-2 border border-gray-300 rounded-lg"></div>
        <div><label class="block text-sm font-medium text-gray-700 mb-1">Free Shipping Min (₹)</label><input type="number" step="0.01" name="shipping_free_min_amount" value="<%= typeof settings.shipping_free_min_amount !== 'undefined' ? settings.shipping_free_min_amount : 500 %>" class="w-full px-4 py-2 border border-gray-300 rounded-lg"></div>
      </div>

      <h2 class="font-semibold text-gray-800 mb-4">Razorpay</h2>
      <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
        <div><label class="block text-sm font-medium text-gray-700 mb-1">Key ID</label><input type="text" name="razorpay_key_id" value="<%= typeof settings.razorpay_key_id !== 'undefined' ? settings.razorpay_key_id : '' %>" class="w-full px-4 py-2 border border-gray-300 rounded-lg"></div>
        <div><label class="block text-sm font-medium text-gray-700 mb-1">Key Secret</label><input type="password" name="razorpay_key_secret" value="<%= typeof settings.razorpay_key_secret !== 'undefined' ? settings.razorpay_key_secret : '' %>" class="w-full px-4 py-2 border border-gray-300 rounded-lg"></div>
      </div>

      <button type="submit" class="bg-indigo-600 text-white px-8 py-2.5 rounded-lg font-medium hover:bg-indigo-700">Save Settings</button>
    </form>
  </div>
</div>
