{% extends "base.html" %}
{% block title %}{{ t.dash_settings_title }} - {{ config.APP_NAME }}{% endblock %}

{% block content %}
<main class="container-page py-12">
  <h1 class="text-2xl mb-8">{{ t.dash_settings_h1 }}</h1>

  <section class="mb-10">
    <h2 class="text-xl mb-4">{{ t.dash_profile }}</h2>
    <div class="card">
      <form method="post" class="space-y-4">
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">

        <div>
          <label for="email" class="form-label">{{ t.dash_email_label }}</label>
          <input type="email" id="email" value="{{ user.email }}" class="form-input bg-soft-white" disabled>
          <p class="form-hint">{{ t.dash_email_hint }}</p>
        </div>

        <div>
          <label for="name" class="form-label">{{ t.dash_name_label }}</label>
          <input type="text" id="name" name="name" value="{{ user.name or '' }}" placeholder="{{ t.dash_name_placeholder }}" class="form-input">
        </div>

        <button type="submit" class="btn">{{ t.dash_save_changes }}</button>
      </form>
    </div>
  </section>

  <section>
    <h2 class="text-xl mb-4">{{ t.dash_danger_zone }}</h2>
    <div class="card border-danger/30">
      <p class="text-slate-dark mb-4">{{ t.dash_delete_warning }}</p>

      <details>
        <summary class="cursor-pointer text-sm font-semibold text-danger">{{ t.dash_delete_account }}</summary>
        <p class="text-sm text-slate-dark mt-3 mb-3">{{ t.dash_delete_confirm }}</p>
        <form method="post" action="{{ url_for('dashboard.delete_account') }}">
          <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
          <button type="submit" class="btn-danger btn-sm">{{ t.dash_delete_btn }}</button>
        </form>
      </details>
    </div>
  </section>
</main>
{% endblock %}
