{% extends 'base.html' %} {% load static %} {% block content %}
<div class="profile-container">
  <div class="profile-header">
    <h1>Profile Settings</h1>
  </div>

  <div class="profile-content">
    <form method="POST" enctype="multipart/form-data" class="profile-form">
      {% csrf_token %}

      <div class="profile-section">
        <div class="profile-image">
          {% if user.profile.profile_image %}
          <img
            src="{{ user.profile.profile_image.url }}"
            alt="Profile Picture"
          />
          {% else %}
          <div class="profile-avatar">{{ user.first_name|first|upper }}</div>
          {% endif %}
          <div class="image-upload">
            <label for="{{ form.profile_image.id_for_label }}"
              >Change Photo</label
            >
            {{ form.profile_image }}
          </div>
        </div>

        <div class="form-group">
          <label for="{{ form.name.id_for_label }}">Full Name</label>
          {{ form.name }} {{ form.name.errors }}
        </div>

        <div class="form-group">
          <label for="{{ form.email.id_for_label }}">Email Address</label>
          {{ form.email }} {{ form.email.errors }}
        </div>

        <div class="form-group">
          <label for="{{ form.phone_number.id_for_label }}">Phone Number</label>
          {{ form.phone_number }} {{ form.phone_number.errors }}
        </div>

        <div class="form-group">
          <label for="{{ form.bio.id_for_label }}">Bio</label>
          {{ form.bio }} {{ form.bio.errors }}
        </div>
      </div>

      <div class="notification-preferences">
        <h2>Notification Preferences</h2>
        <div class="form-group checkbox">
          {{ form.email_notifications }}
          <label for="{{ form.email_notifications.id_for_label }}">
            Email Notifications
          </label>
        </div>
        <div class="form-group checkbox">
          {{ form.push_notifications }}
          <label for="{{ form.push_notifications.id_for_label }}">
            Push Notifications
          </label>
        </div>
      </div>

      <div class="form-actions">
        <button type="submit" class="save-button">Save Changes</button>
      </div>
    </form>
  </div>
</div>

<style>
  .profile-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
  }

  .profile-header {
    margin-bottom: 30px;
  }

  .profile-content {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .profile-section {
    margin-bottom: 30px;
  }

  .profile-image {
    text-align: center;
    margin-bottom: 20px;
  }

  .profile-image img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
  }

  .profile-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: #6366f1;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin: 0 auto;
  }

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

  .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
  }

  .form-group input,
  .form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
  }

  .verification-warning {
    color: #f59e0b;
    font-size: 14px;
    margin-top: 5px;
    display: block;
  }

  .notification-preferences {
    border-top: 1px solid #eee;
    padding-top: 20px;
    margin-top: 20px;
  }

  .checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .checkbox input {
    width: auto;
  }

  .form-actions {
    margin-top: 30px;
    text-align: right;
  }

  .save-button {
    background: #6366f1;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
  }

  .save-button:hover {
    background: #4f46e5;
  }

  .error-message {
    color: #dc2626;
    font-size: 14px;
    margin-top: 5px;
  }
</style>
{% endblock %}
