@import url("https://fonts.googleapis.com/css2?family=Cairo:wght@500;600;700&display=swap");

:root {
  --bg: #f4f8fc;
  --bg-soft: #eaf2fa;
  --text: #0f172a;
  --muted: #5d6f89;
  --line: #d2deeb;
  --brand: #0d5da6;
  --brand-strong: #074f8f;
  --error: #c92a2a;
  --success: #16a34a;
  --shadow-lg: 0 26px 64px rgba(14, 30, 64, 0.14);
  --shadow-md: 0 14px 30px rgba(14, 30, 64, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Cairo", "Tajawal", "Noto Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 12%, rgba(13, 93, 166, 0.14), transparent 42%),
    radial-gradient(circle at 84% 80%, rgba(13, 93, 166, 0.08), transparent 45%),
    linear-gradient(180deg, var(--bg), var(--bg-soft));
}

.page-accent {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.24), transparent 36%),
    linear-gradient(320deg, rgba(13, 93, 166, 0.04), transparent 42%);
}

.login-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.login-card {
  width: min(460px, 100%);
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 28px 26px 22px;
}

.brand-head {
  text-align: center;
  margin-bottom: 20px;
}

.brand-logo {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  object-fit: cover;
  box-shadow: 0 14px 30px rgba(13, 93, 166, 0.26);
}

.brand-head h1 {
  margin: 14px 0 4px;
  font-size: 1.66rem;
  letter-spacing: -0.02em;
}

.brand-head p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.arabic-text {
  font-family: "Cairo", "Noto Naskh Arabic", "Geeza Pro", Tahoma, sans-serif;
  font-weight: 600;
}

.form-block h2 {
  margin: 0;
  font-size: 1.56rem;
  letter-spacing: -0.02em;
}

.form-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.field-group {
  margin-top: 16px;
}

.field-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 1rem;
}

.field-input {
  width: 100%;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 180ms ease;
}

.field-input::placeholder {
  color: #8ea0b6;
}

.field-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(13, 93, 166, 0.14);
}

.field-hint {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.password-wrap {
  position: relative;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--brand);
  font-weight: 700;
  font-size: 0.86rem;
  padding: 6px 8px;
  cursor: pointer;
}

.password-toggle:hover {
  background: rgba(13, 93, 166, 0.08);
}

.submit-btn {
  margin-top: 18px;
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--brand), var(--brand-strong));
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  transition: transform 130ms ease, box-shadow 170ms ease, opacity 160ms ease;
}

.submit-btn:hover {
  transform: translateY(-1px);
}

.submit-btn.loading {
  pointer-events: none;
  opacity: 0.95;
}

.btn-loader {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  display: none;
  animation: spin 0.8s linear infinite;
}

.submit-btn.loading .btn-loader {
  display: inline-block;
}

.error-textline {
  margin: 12px 0 0;
  color: var(--error);
  font-size: 0.9rem;
  font-weight: 600;
}

.card-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.24);
  text-align: center;
  color: var(--muted);
  font-size: 0.84rem;
}

.status-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 18, 40, 0.22);
  display: grid;
  place-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.status-overlay.show {
  opacity: 1;
}

.status-mark {
  width: min(240px, calc(100% - 30px));
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 58px rgba(8, 20, 45, 0.25);
  padding: 20px 16px;
  text-align: center;
}

.status-icon {
  width: 82px;
  height: 82px;
  margin: 0 auto 10px;
  display: none;
}

.status-icon circle,
.status-icon path {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status-mark.success .status-icon-success,
.status-mark.error .status-icon-error {
  display: block;
}

.status-mark.success .status-icon-success circle,
.status-mark.success .status-icon-success path {
  stroke: var(--success);
}

.status-mark.error .status-icon-error circle,
.status-mark.error .status-icon-error path {
  stroke: var(--error);
}

.status-mark p {
  margin: 0;
  font-weight: 700;
  font-size: 0.98rem;
}

.status-mark.success p {
  color: #12733a;
}

.status-mark.error p {
  color: #9a1f1f;
}

.status-mark.success .status-icon-success path,
.status-mark.success .status-icon-success circle,
.status-mark.error .status-icon-error path,
.status-mark.error .status-icon-error circle {
  stroke-dasharray: 180;
  stroke-dashoffset: 180;
  animation: draw 420ms ease-out forwards;
}

.status-mark.error {
  animation: shake 320ms ease;
}

@media (max-width: 520px) {
  .login-card {
    border-radius: 18px;
    padding: 22px 14px 16px;
  }

  .brand-logo {
    width: 74px;
    height: 74px;
  }

  .brand-head h1 {
    font-size: 1.42rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .submit-btn,
  .field-input,
  .status-overlay,
  .status-mark {
    transition: none !important;
    animation: none !important;
  }

  .btn-loader {
    animation: none !important;
  }
}

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

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}
