@font-face {
  font-family: 'Noto Sans Arabic';
  src: url('/fonts/NotoSansArabic-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Noto Sans Arabic';
  src: url('/fonts/NotoSansArabic-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --brand: #4274d9;
  --brand-deep: #2f5bb8;
  --page: #eef3fc;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e2e9f7;
  --track: #e3e8f1;
  --field: #f8faff;
  --success: #16a34a;
  --success-tint: #e5f6ec;
  --error: #dc2626;
  --error-tint: #fdecec;
  --brand-tint: #e6eefb;
  --shadow: 0 18px 50px rgba(66, 116, 217, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0b1020;
    --card: #151b2e;
    --text: #e8ecf6;
    --muted: #9aa3b8;
    --line: rgba(255, 255, 255, 0.1);
    --track: rgba(255, 255, 255, 0.14);
    --field: rgba(255, 255, 255, 0.04);
    --success: #22c55e;
    --success-tint: rgba(34, 197, 94, 0.16);
    --error: #f87171;
    --error-tint: rgba(239, 68, 68, 0.16);
    --brand-tint: rgba(66, 116, 217, 0.2);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--page);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans Arabic', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 28px 24px 26px;
  text-align: center;
  animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.miami {
  display: block;
  width: 112px;
  height: 112px;
  margin: -4px auto 6px;
  animation: bob 2.6s ease-in-out infinite alternate;
}

h1 { font-size: 23px; line-height: 1.3; margin: 6px 0 4px; }

.sub { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }

.local {
  direction: rtl;
  font-family: 'Noto Sans Arabic', Tahoma, sans-serif;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
  margin: 4px 0 0;
}

.local.title { color: var(--text); font-weight: 700; font-size: 17px; }

.email { color: var(--text); font-weight: 700; word-break: break-all; }

form { margin-top: 20px; text-align: start; }

label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 6px;
}

label .local { font-size: 13px; font-weight: 400; margin: 0; line-height: 1.4; }

.field { position: relative; margin-bottom: 14px; }

input[type='password'], input[type='text'] {
  width: 100%;
  height: 52px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: var(--field);
  color: var(--text);
  font-size: 16px;
  padding: 0 52px 0 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }

input[aria-invalid='true'] { border-color: var(--error); }

.peek {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.peek:hover { background: var(--brand-tint); color: var(--brand); }

.peek:focus-visible { outline: 2px solid var(--brand); }

.meter { display: flex; gap: 5px; margin: -4px 0 6px; }

.meter span { flex: 1; height: 5px; border-radius: 9px; background: var(--track); transition: background 0.3s; }

.rules { list-style: none; padding: 0; margin: 0 0 14px; font-size: 13px; color: var(--muted); }

.rules li { display: flex; align-items: center; gap: 6px; margin: 3px 0; transition: color 0.2s; }

.rules li.ok { color: var(--success); }

.rules svg { flex: none; }

.error {
  display: none;
  background: var(--error-tint);
  color: var(--error);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 14px;
}

.error.show { display: block; animation: shake 0.35s; }

.button {
  width: 100%;
  height: 54px;
  border: 0;
  border-radius: 16px;
  background: var(--brand);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--brand-deep);
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
}

.button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--brand-deep); }

.button[disabled] { opacity: 0.7; cursor: progress; }

.button:focus-visible { outline: 3px solid var(--brand-tint); outline-offset: 3px; }

.badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 8px auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.badge.ok { background: var(--success-tint); color: var(--success); }

.badge.bad { background: var(--error-tint); color: var(--error); }

.state { padding: 6px 0 2px; }

.state .button { margin-top: 20px; }

.spinner {
  width: 34px;
  height: 34px;
  margin: 10px auto 4px;
  border-radius: 50%;
  border: 3px solid var(--brand-tint);
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}

.button .spinner { width: 20px; height: 20px; margin: 0; border-width: 2.5px; border-color: rgba(255, 255, 255, 0.4); border-top-color: #ffffff; }

.footer { margin: 18px 0 0; font-size: 13px; color: var(--muted); }

.footer a { color: var(--muted); }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-6px); } }

@keyframes pop { from { opacity: 0; transform: scale(0.5); } }

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
