/* ==========================================================================
   الجمعية المغربية لهواة البحث والاستكشاف — Premium Login Page
   Compact, minimal, SaaS-style authentication
   Loads after style.css and reuses the same design tokens
   ========================================================================== */

/* ---------- 1. Page shell ---------- */
.login-page {
  min-height: 100vh;
  background:
    radial-gradient(36rem 28rem at 115% -12%, rgba(25, 184, 242, 0.14) 0%, rgba(25, 184, 242, 0) 60%),
    radial-gradient(30rem 24rem at -12% 115%, rgba(25, 184, 242, 0.10) 0%, rgba(25, 184, 242, 0) 55%),
    linear-gradient(180deg, var(--color-white) 0%, var(--color-light) 55%, var(--color-white) 100%);
  display: flex;
  flex-direction: column;
}

.login-main {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: clamp(16px, 4vh, 32px) 20px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

/* Keep the card reachable on very short screens */
@media (max-height: 640px) {
  .login-main { justify-content: flex-start; }
}

/* ---------- 2. Decorative background ---------- */
.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Subtle grid pattern that fades out at the edges */
.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(18, 59, 120, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 59, 120, 0.035) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(62% 55% at 50% 42%, #000 25%, transparent 100%);
  mask-image: radial-gradient(62% 55% at 50% 42%, #000 25%, transparent 100%);
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(46px);
  opacity: 0.6;
  will-change: transform;
}

.login-orb-1 {
  width: 260px; height: 260px;
  top: -90px; right: -60px;
  background: rgba(25, 184, 242, 0.2);
  animation: login-float 22s ease-in-out infinite;
}

.login-orb-2 {
  width: 220px; height: 220px;
  bottom: -70px; left: -50px;
  background: rgba(246, 179, 0, 0.13);
  animation: login-float 28s ease-in-out -7s infinite;
}

.login-orb-3 {
  width: 150px; height: 150px;
  top: 46%; left: 8%;
  background: rgba(25, 184, 242, 0.1);
  animation: login-float 32s ease-in-out -13s infinite;
}

/* ---------- 3. Back to home link ---------- */
.login-nav {
  width: 100%;
  display: flex;
  justify-content: flex-start;
}

.login-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-soft);
  transition: color 0.25s var(--ease);
}

.login-back-arrow {
  transition: transform 0.25s var(--ease);
}

.login-back:hover {
  color: var(--color-primary-dark);
}

.login-back:hover .login-back-arrow { transform: translateX(3px); }

/* ---------- 4. Auth card ---------- */
.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(18, 59, 120, 0.08);
  border-radius: 20px;
  box-shadow:
    0 1px 2px rgba(18, 59, 120, 0.04),
    0 8px 24px rgba(18, 59, 120, 0.06),
    0 24px 60px rgba(18, 59, 120, 0.1);
  padding: 30px 30px 24px;
  animation: login-rise 0.55s var(--ease) both;
}

.login-head {
  text-align: center;
}

.login-logo-wrap {
  display: inline-flex;
  padding: 7px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--color-white);
  border: 1px solid rgba(18, 59, 120, 0.06);
  box-shadow: 0 4px 14px rgba(18, 59, 120, 0.08);
}

.login-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  display: block;
}

.login-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--color-navy);
  line-height: 1.35;
}

.login-sub {
  margin-top: 5px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--color-text-soft);
}

/* ---------- 5. Card body ---------- */
.login-card-body {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
}

/* ---------- 6. Inputs ---------- */
.login-field {
  position: relative;
  margin-bottom: 14px;
}

.login-input {
  width: 100%;
  height: 42px;
  padding: 0 38px 0 14px;
  border: 1px solid rgba(18, 59, 120, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  font-family: var(--font-main);
  font-size: 14px;
  color: var(--color-text);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
}

.login-input::placeholder { color: var(--color-text-soft); opacity: 0.75; }

.login-field-password .login-input { padding-left: 42px; }

.login-input:hover { border-color: rgba(25, 184, 242, 0.5); }

/* Input focus glow */
.login-input:focus {
  border-color: var(--color-primary);
  background: var(--color-white);
  box-shadow: 0 0 0 3px rgba(25, 184, 242, 0.12);
}

/* Single clean glow instead of the global double ring */
.login-input:focus-visible { outline: none; }

.login-input.is-invalid {
  border-color: #E74C3C;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.login-input-icon {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  color: var(--color-text-soft);
  pointer-events: none;
  transition: color 0.25s var(--ease);
}

.login-input-icon svg { width: 16px; height: 16px; }

.login-field:focus-within .login-input-icon { color: var(--color-primary); }
.login-field.is-invalid .login-input-icon { color: #E74C3C; }

.login-field-error {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline-start: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: #E74C3C;
  white-space: nowrap;
}

.login-field-error:empty { display: none; }

/* Password visibility toggle */
.login-input-toggle {
  position: absolute;
  inset-inline-end: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--color-text-soft);
  background: transparent;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}

.login-input-toggle:hover {
  color: var(--color-primary-dark);
  background: rgba(25, 184, 242, 0.08);
}

.login-input-toggle:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.login-input-toggle svg { width: 17px; height: 17px; }

.login-input-toggle .icon-eye-off { display: none; }
.login-input-toggle.is-visible .icon-eye { display: none; }
.login-input-toggle.is-visible .icon-eye-off { display: block; }

/* ---------- 7. Options row (remember + forgot) ---------- */
.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}

.login-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.login-check-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.login-check-box {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 1.5px solid rgba(18, 59, 120, 0.3);
  background: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
}

.login-check-box svg {
  width: 10px;
  height: 10px;
  color: var(--color-white);
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.login-check:hover .login-check-box { border-color: var(--color-primary); }

.login-check-input:checked + .login-check-box {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.login-check-input:checked + .login-check-box svg {
  opacity: 1;
  transform: scale(1);
}

.login-check-input:focus-visible + .login-check-box {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

.login-check-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.login-forgot {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-primary-dark);
  transition: color 0.25s var(--ease);
}

.login-forgot:hover {
  color: var(--color-navy);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- 8. Buttons ---------- */
.login-btn {
  position: relative;
  overflow: hidden;
}

.login-submit {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  background: var(--gradient-primary);
  color: var(--color-white);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(25, 184, 242, 0.24);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), filter 0.25s var(--ease);
}

.login-submit:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 10px 24px rgba(25, 184, 242, 0.32);
}

.login-submit:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(25, 184, 242, 0.24);
}

.login-submit:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

.login-submit-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--color-white);
  border-radius: 50%;
  animation: login-spin 0.7s linear infinite;
}

.login-submit.is-loading { cursor: progress; pointer-events: none; }
.login-submit.is-loading .login-submit-spinner { display: inline-block; }

/* ---------- 9. Inline status message ---------- */
.login-status {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--color-primary-dark);
  text-align: center;
  background: rgba(25, 184, 242, 0.07);
  border: 1px dashed rgba(25, 184, 242, 0.4);
  border-radius: 10px;
  padding: 8px 12px;
}

.login-status[hidden] { display: none; }

/* ---------- 10. Divider ---------- */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-divider-line {
  flex: 1;
  height: 1px;
  background: rgba(18, 59, 120, 0.1);
}

.login-divider-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-soft);
}

/* ---------- 11. Google button ---------- */
.login-google {
  --login-ripple-color: rgba(25, 184, 242, 0.16);
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--color-white);
  color: var(--color-text);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid rgba(18, 59, 120, 0.12);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(18, 59, 120, 0.05);
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
}

.login-google:hover {
  transform: translateY(-1px);
  border-color: rgba(25, 184, 242, 0.45);
  background: var(--color-light);
  box-shadow: 0 6px 16px rgba(25, 184, 242, 0.14);
}

.login-google:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(18, 59, 120, 0.05);
}

.login-google:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

.login-google-icon {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
}

.login-google-icon svg { width: 18px; height: 18px; display: block; }

.login-google-text {
  display: block;
  width: 100%;
  text-align: center;
}

.login-google-spinner {
  display: none;
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  margin-top: -8px;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(18, 59, 120, 0.16);
  border-top-color: var(--color-primary-dark);
  border-radius: 50%;
  animation: login-spin 0.7s linear infinite;
}

.login-google.is-loading .login-google-icon { display: none; }
.login-google.is-loading .login-google-spinner { display: block; }
.login-google.is-loading { cursor: progress; pointer-events: none; }

/* ---------- 12. Register link ---------- */
.login-register {
  text-align: center;
  font-size: 13px;
  color: var(--color-text-soft);
  padding: 2px 0;
}

.login-register-link {
  margin-inline-start: 5px;
  color: var(--color-accent);
  font-weight: 700;
  transition: color 0.25s var(--ease);
}

.login-register-link:hover {
  color: var(--color-navy);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-register-link:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- 13. Ripple ink (JS) ---------- */
.login-ripple-ink {
  position: absolute;
  border-radius: 50%;
  background: var(--login-ripple-color, rgba(255, 255, 255, 0.45));
  transform: scale(0);
  opacity: 1;
  animation: login-ripple 0.55s var(--ease) forwards;
  pointer-events: none;
}

@keyframes login-ripple {
  to { transform: scale(1); opacity: 0; }
}

/* ---------- 14. Footer ---------- */
.login-footer {
  width: 100%;
  display: flex;
  justify-content: center;
  text-align: center;
  font-size: 11.5px;
  color: rgba(91, 107, 124, 0.75);
}

/* ---------- 15. Animations ---------- */
@keyframes login-rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes login-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(14px, -16px) scale(1.04); }
  66%      { transform: translate(-10px, 12px) scale(0.97); }
}

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

/* ---------- 16. Responsive ---------- */
@media (max-width: 480px) {
  .login-main { padding-inline: 16px; }

  .login-card { padding: 24px 22px 20px; }

  .login-logo-wrap { margin-bottom: 12px; }
  .login-logo { width: 46px; height: 46px; }

  .login-title { font-size: 20px; }
  .login-sub { font-size: 13px; }

  .login-card-body { margin-top: 18px; gap: 12px; }

  .login-input { height: 42px; }

  .login-submit, .login-google { height: 44px; }

  .login-orb-1 { width: 190px; height: 190px; top: -70px; right: -50px; }
  .login-orb-2 { width: 170px; height: 170px; bottom: -60px; left: -40px; }
  .login-orb-3 { width: 120px; height: 120px; }
}
