/* Designed by Abdalrahman Alqashi */
:root {
  color-scheme: only light;
  --just-green: #006f4f;
  --just-green-dark: #004e38;
  --ramadan-gold: #e3c565;
  --night: #0e2a3e;
  --night-soft: #16344a;
  --cream: #f8f4e8;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color-scheme: only light;
}

body {
  font-family: "Cairo", sans-serif;
  background:
    radial-gradient(circle at 18% 16%, rgba(227, 197, 101, 0.18), transparent 34%),
    radial-gradient(circle at 82% 8%, rgba(255, 255, 255, 0.12), transparent 28%),
    linear-gradient(160deg, var(--night) 0%, var(--night-soft) 55%, #0f3b48 100%);
  background-size: 130% 130%;
  color: var(--cream);
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-x: hidden;
  animation: bgShift 12s ease-in-out infinite alternate;
}

body::before {
  content: "";
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  left: -180px;
  top: -130px;
  background: radial-gradient(circle, rgba(227, 197, 101, 0.25), rgba(227, 197, 101, 0));
  pointer-events: none;
}

.login-bg-stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.3;
  background-image:
    radial-gradient(circle at 20px 20px, rgba(255, 255, 255, 0.35) 1px, transparent 0),
    radial-gradient(circle at 80px 60px, rgba(255, 255, 255, 0.25) 1px, transparent 0);
  background-size: 130px 95px;
}

.login-shell {
  width: min(460px, 100%);
  position: relative;
  z-index: 1;
  animation: shellFloat 4.2s ease-in-out infinite;
}

.login-ornaments {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.orbit {
  position: absolute;
  border: 1px solid rgba(227, 197, 101, 0.28);
  border-radius: 50%;
  animation: spin 26s linear infinite;
}

.orbit-a {
  width: 260px;
  height: 260px;
  right: -90px;
  top: 18%;
}

.orbit-b {
  width: 170px;
  height: 170px;
  left: -60px;
  bottom: 12%;
  animation-duration: 18s;
  animation-direction: reverse;
}

.tiny-lantern {
  position: absolute;
  width: 24px;
  height: 40px;
  border-radius: 7px;
  background: linear-gradient(180deg, #f6da84, #c99f3a);
  box-shadow: 0 7px 14px rgba(0, 0, 0, 0.28);
  animation: lanternSwing 2.5s ease-in-out infinite;
}

.tiny-lantern::before {
  content: "";
  position: absolute;
  width: 2px;
  height: 22px;
  top: -22px;
  left: 11px;
  background: rgba(255, 255, 255, 0.7);
}

.tiny-lantern-a {
  left: 10%;
  top: 18%;
}

.tiny-lantern-b {
  right: 12%;
  top: 12%;
  animation-delay: 0.6s;
}

.login-card {
  border-radius: 20px;
  border: 1px solid rgba(227, 197, 101, 0.34);
  background: rgba(7, 36, 52, 0.78);
  backdrop-filter: blur(8px);
  box-shadow: 0 24px 60px rgba(2, 18, 32, 0.38);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 16px;
  border: 1px solid rgba(227, 197, 101, 0.2);
  pointer-events: none;
}

.login-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 24%, rgba(255, 255, 255, 0.18) 45%, transparent 66%);
  transform: translateX(-120%);
  animation: sweep 5.4s ease-in-out infinite;
}

.login-enter {
  animation: cardIn 0.8s ease, cardBreath 3.4s ease-in-out infinite;
}

.ramadan-seal {
  width: fit-content;
  margin: 0 auto 10px;
  padding: 6px 14px;
  border-radius: 999px;
  color: #1a3f36;
  background: linear-gradient(90deg, #f3dd94, #f9ebb9);
  font-weight: 800;
  font-size: 0.88rem;
  box-shadow: 0 6px 14px rgba(227, 197, 101, 0.3);
  animation: sealPop 2.8s ease-in-out infinite;
}

.login-head {
  text-align: center;
  margin-bottom: 14px;
}

.login-logo {
  width: 76px;
  height: 76px;
  object-fit: contain;
  border-radius: 50%;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28);
  animation: logoPulse 2.8s ease-in-out infinite;
}

.login-eyebrow {
  margin: 10px 0 2px;
  font-size: 0.8rem;
  color: #cfe2d8;
}

h1 {
  margin: 0;
  font-family: "Amiri", serif;
  color: var(--ramadan-gold);
  font-size: 2rem;
  text-shadow: 0 0 18px rgba(227, 197, 101, 0.3);
}

.login-head p {
  margin: 4px 0 0;
}

.login-ramadan-line {
  margin-top: 4px;
  color: #f8e6b0;
  font-size: 0.9rem;
}

form {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  color: #e6efe8;
}

input {
  width: 100%;
  padding: 12px;
  border-radius: 11px;
  border: 1px solid #8ab1a2;
  background: #ffffff;
  color: #143040;
  font-family: inherit;
  font-size: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input:focus {
  outline: none;
  border-color: var(--just-green);
  box-shadow: 0 0 0 3px rgba(0, 111, 79, 0.18);
  transform: translateY(-1px);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #d2e7da;
}

.remember-row input {
  width: auto;
}

.login-btn {
  border: none;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--just-green-dark), var(--just-green));
  color: var(--white);
  padding: 13px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0, 79, 56, 0.3);
}

.login-btn.loading {
  pointer-events: none;
  opacity: 0.9;
}

.login-btn.loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.login-btn.success {
  background: linear-gradient(90deg, #0d7a55, #14a06e);
}

.login-message {
  min-height: 20px;
  margin: 0;
  font-weight: 700;
}

.login-message.error {
  color: #ff9cb1;
}

.login-message.success {
  color: #95f5c9;
}

.login-credit {
  text-align: center;
  margin: 14px 0 0;
  color: #d1e4db;
  font-size: 0.85rem;
}

.field-error {
  animation: shakeX 0.35s ease;
  border-color: #c93553 !important;
  box-shadow: 0 0 0 3px rgba(201, 53, 83, 0.15) !important;
}

@keyframes sweep {
  0%, 70% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─────────────── Login Transition Overlay ─────────────── */
.login-transition {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(160deg, #004f38 0%, #007a56 50%, #00b37a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  transform: translateY(100%);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.login-transition.active {
  transform: translateY(0);
  pointer-events: all;
}

.lt-crescent {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  box-shadow: -18px 4px 0 4px #ffd166;
  background: transparent;
  animation: ltCrescentPop 0.5s ease 0.3s both;
}

.lt-welcome {
  color: #ffffff;
  font-size: 1.7rem;
  font-weight: 800;
  font-family: 'Cairo', sans-serif;
  opacity: 0;
  transform: translateY(16px);
  animation: ltTextIn 0.45s ease 0.45s both;
}

@keyframes ltCrescentPop {
  from { opacity: 0; transform: scale(0.4) rotate(-30deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes ltTextIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes bgShift {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 100% 100%;
  }
}

@keyframes shellFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes cardBreath {
  0%,
  100% {
    box-shadow: 0 24px 60px rgba(2, 18, 32, 0.38);
  }
  50% {
    box-shadow: 0 28px 68px rgba(2, 18, 32, 0.48);
  }
}

@keyframes sealPop {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

@keyframes shakeX {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

@keyframes logoPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes lanternSwing {
  0% {
    transform: rotate(3deg);
  }
  100% {
    transform: rotate(-3deg);
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 18px;
  }

  .tiny-lantern {
    display: none;
  }

  h1 {
    font-size: 1.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .login-shell,
  .login-card::after,
  .login-logo,
  .orbit,
  .tiny-lantern,
  .login-btn.loading::after,
  .login-enter,
  .ramadan-seal,
  .field-error {
    animation: none;
  }
}
