{% extends "base.html" %}
{% block title %}Settings - Bybit MCP{% endblock %}
{% block content %}
<h1>Bybit API Settings</h1>
<p class="subtitle">Configure your Bybit API credentials</p>
{% if error %}
<div class="error">{{ error }}</div>
{% endif %}
{% if success %}
<div class="success">{{ success }}</div>
{% endif %}
<form method="post" action="/settings">
  <label for="api_key">API Key</label>
  <input type="text" id="api_key" name="api_key" value="{{ api_key or '' }}" placeholder="Enter your Bybit API key" required>
  <label for="api_secret">API Secret</label>
  <input type="password" id="api_secret" name="api_secret" placeholder="{% if has_credentials %}(unchanged if empty){% else %}Enter your Bybit API secret{% endif %}">
  <div class="toggle">
    <input type="checkbox" id="testnet" name="testnet" {% if testnet %}checked{% endif %}>
    <label for="testnet">Testnet mode</label>
  </div>
  <label for="mode">Permission Mode</label>
  <select id="mode" name="mode">
    <option value="read" {% if mode == 'read' %}selected{% endif %}>Read only</option>
    <option value="trade" {% if mode == 'trade' %}selected{% endif %}>Trade (read + orders)</option>
    <option value="full" {% if mode == 'full' %}selected{% endif %}>Full (read + trade + transfers)</option>
  </select>
  <label for="recv_window">Receive Window (ms, optional)</label>
  <input type="text" id="recv_window" name="recv_window" value="{{ recv_window or '' }}" placeholder="5000">
  <button type="submit">Save</button>
</form>
{% endblock %}
