<!DOCTYPE html>
<html lang="en">
<head> 
  <meta charset="UTF-8"> 
  <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"> 
  <title>{{env('APP_NAME')}} | Password</title> 

  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/layui@2.8.17/dist/css/layui.css">
  <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">

  <style>
    :root {
      --accent-black: #1a1a1a;
      --accent-gradient: linear-gradient(135deg, #1a1a1a 0%, #3a3a3a 100%);
      --bg-light: #f8fafc;
      --text-dark: #1e293b;
    }

    * {
      box-sizing: border-box;
    }

    body {
      font-family: 'Roboto', sans-serif;
      background-color: var(--bg-light);
      margin: 0; padding: 0;
      color: var(--text-dark);
      animation: fadeInBody 0.5s ease;
    }

    @keyframes fadeInBody {
      from { opacity: 0; }
      to { opacity: 1; }
    }

    @keyframes fadeInUp {
      from { opacity: 0; transform: translateY(15px); }
      to { opacity: 1; transform: translateY(0); }
    }

    @keyframes popIn {
      from { opacity: 0; transform: scale(0.9); }
      to { opacity: 1; transform: scale(1); }
    }

    @keyframes slideDown {
      from { opacity: 0; transform: translateY(-12px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* 🔹 Header Section - Matching Home */
    .top-header {
      padding: 15px 20px;
      background: #fff;
      display: flex;
      align-items: center;
      border-bottom: 1px solid #f1f5f9;
      animation: slideDown 0.4s ease both;
    }
    .top-header .left-side {
      display: flex;
      align-items: center;
      gap: 15px;
    }
    .top-header h2 {
      font-size: 20px;
      font-weight: 700;
      color: var(--accent-black);
      margin: 0;
    }
    .back-btn {
      color: #333; font-size: 20px; text-decoration: none; width: 30px;
      transition: transform 0.2s ease;
      display: inline-block;
    }
    .back-btn:hover { transform: translateX(-3px); }

    /* 🔹 Form Container */
    .card-main {
      padding: 20px;
    }

    .form-container {
      background: #fff;
      border-radius: 20px;
      padding: 25px 20px;
      box-shadow: 0 4px 15px rgba(0,0,0,0.03);
      animation: fadeInUp 0.4s ease 0.1s both;
    }

    .form-title {
        text-align: center;
        margin-bottom: 25px;
        animation: popIn 0.4s ease 0.15s both;
    }
    .form-title i {
        font-size: 45px;
        color: var(--accent-black);
        margin-bottom: 10px;
    }
    .form-title p {
        font-size: 14px;
        color: #64748b;
        margin-top: 5px;
    }

    /* 🔹 Input Styling */
    .input-group {
      position: relative;
      margin-bottom: 18px;
      animation: fadeInUp 0.4s ease both;
    }
    .input-group:nth-of-type(1) { animation-delay: 0.2s; }
    .input-group:nth-of-type(2) { animation-delay: 0.25s; }
    .input-group:nth-of-type(3) { animation-delay: 0.3s; }

    .input-group i {
      position: absolute;
      left: 15px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--accent-black);
      font-size: 18px;
      transition: transform 0.25s ease;
    }
    .input-group input {
      width: 100%;
      padding: 15px 15px 15px 45px;
      border: 1px solid #e2e8f0;
      border-radius: 12px;
      font-size: 15px;
      outline: none;
      background: #fcfdfe;
      transition: 0.3s;
      box-sizing: border-box;
    }
    .input-group input:focus {
      border-color: var(--accent-black);
      background: #fff;
      box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.06);
    }
    .input-group input:focus ~ i { transform: translateY(-50%) scale(1.1); }
    .input-group input:disabled {
        background: #f1f5f9;
        color: #94a3b8;
        cursor: not-allowed;
    }

    /* 🔹 Submit Button */
    .card-btn {
      width: 100%;
      padding: 16px;
      background: var(--accent-gradient);
      color: white;
      border: none;
      border-radius: 50px;
      font-size: 16px;
      font-weight: 700;
      cursor: pointer;
      box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
      margin-top: 10px;
      transition: 0.3s;
      animation: fadeInUp 0.4s ease 0.35s both;
    }
    .card-btn:hover { box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28); }
    .card-btn:active { transform: scale(0.98); }

    /* Security Notice */
    .security-notice {
        margin-top: 25px;
        padding: 15px;
        background: #fdf2f2;
        border-radius: 12px;
        border: 1px solid #fee2e2;
        animation: fadeInUp 0.4s ease 0.4s both;
    }
    .security-notice p {
        font-size: 12px;
        color: #b91c1c;
        margin: 0;
        display: flex;
        gap: 8px;
        line-height: 1.4;
    }
  </style>
</head>

<body>

  @php $user = auth()->user(); @endphp

  <div class="top-header">
    <div class="left-side">
        <a href="{{ route('dashboard') }}" class="back-btn"><i class="layui-icon layui-icon-left"></i></a>
        <h2>Security</h2>
    </div>
  </div>

  <div class="card-main">
    <div class="form-container">
      
      <div class="form-title">
          <i class="fa-solid fa-shield-halved"></i>
          <h3>Reset Password</h3>
          <p>Update your account security</p>
      </div>

      <form id="passwordForm">
        <div class="input-group">
          <i class="fa-solid fa-phone"></i>
          <input type="text" disabled value="{{ $user->phone }}">
        </div>

        <div class="input-group">
          <i class="fa-solid fa-lock"></i>
          <input type="password" name="password" id="newPass" placeholder="Enter new password" required>
        </div>

        <div class="input-group">
          <i class="fa-solid fa-circle-check"></i>
          <input type="password" name="repassword" id="confirmPass" placeholder="Confirm new password" required>
        </div>

        <button type="button" class="card-btn" onclick="submitUpdate()">Update Password</button>
      </form>

      <div class="security-notice">
          <p>
              <i class="fa-solid fa-triangle-exclamation"></i>
              Never share your password with anyone, including IQOO staff.
          </p>
      </div>
    </div>
  </div>

  <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/layui@2.8.17/dist/layui.js"></script>

  <script>
    function submitUpdate() {
        const pass = $('#newPass').val();
        const repass = $('#confirmPass').val();

        if(!pass || !repass) {
            layui.layer.msg('Please fill all fields', {icon: 2});
            return;
        }

        if(pass !== repass) {
            layui.layer.msg('Passwords do not match', {icon: 2});
            return;
        }

        layui.layer.load(2);
        
        // Mocking the AJAX call
        setTimeout(() => {
            layui.layer.closeAll('loading');
            layui.layer.msg('Security Updated Successfully', {icon: 1});
        }, 1500);
    }
  </script>

</body>
</html>
