/* ============================================================
   Moon Glass Login UI Template — style.css
   Moon-mode glassmorphism login UI
   ============================================================ */


/* ── 1. CSS CUSTOM PROPERTIES (Design Tokens) ──────────────────
   Change these variables to retheme the entire UI in seconds.
   ─────────────────────────────────────────────────────────── */
:root {
  /* Background */
  --bg:            #080b12;   /* Deep navy-black base */
  --surface:       rgba(255, 255, 255, 0.045); /* Glass card fill */
  --surface-border:rgba(255, 255, 255, 0.10);  /* Card border */

  /* Accent gradient — change these two to repaint every accent */
  --accent-a:      #a78bfa;   /* Violet */
  --accent-b:      #38bdf8;   /* Cyan */
  --accent-grad:   linear-gradient(135deg, var(--accent-a), var(--accent-b));

  /* Text */
  --text-primary:  #f0f4ff;
  --text-secondary:#8892a4;
  --text-muted:    #4d5a72;

  /* Inputs */
  --input-bg:      rgba(255, 255, 255, 0.05);
  --input-border:  rgba(255, 255, 255, 0.10);
  --input-focus:   rgba(167, 139, 250, 0.45);

  /* Blobs (ambient glow) */
  --blob-1:        rgba(167, 139, 250, 0.22);  /* violet */
  --blob-2:        rgba(56, 189, 248, 0.18);   /* cyan */
  --blob-3:        rgba(244, 114, 182, 0.14);  /* pink */

  /* Social buttons */
  --social-bg:     rgba(255, 255, 255, 0.06);
  --social-hover:  rgba(255, 255, 255, 0.11);

  /* Error */
  --error:         #f87171;

  /* Typography */
  --font-display:  'Syne', sans-serif;
  --font-body:     'DM Sans', sans-serif;

  /* Spacing & shape */
  --radius-card:   24px;
  --radius-input:  12px;
  --radius-btn:    12px;
  --transition:    0.25s ease;
}


/* ── 2. RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text-primary);
  min-height: 100dvh;           /* Use dynamic viewport height on mobile */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;             /* Blobs stay clipped */
}

a {
  color: var(--accent-a);
  text-decoration: none;
  transition: opacity var(--transition);
}
a:hover { opacity: 0.75; }


/* ── 3. ANIMATED BACKGROUND BLOBS ───────────────────────────── */
/* Three large radial gradients that slowly drift for ambience. */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  will-change: transform;
  animation: drift 18s ease-in-out infinite alternate;
}

.blob-1 {
  width: 600px; height: 600px;
  background: var(--blob-1);
  top: -180px; left: -180px;
  animation-duration: 20s;
}
.blob-2 {
  width: 500px; height: 500px;
  background: var(--blob-2);
  bottom: -120px; right: -150px;
  animation-duration: 24s;
  animation-delay: -8s;
}
.blob-3 {
  width: 400px; height: 400px;
  background: var(--blob-3);
  top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 16s;
  animation-delay: -4s;
}

/* Slow drift keyframes */
@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(40px, -30px) scale(1.06); }
  100% { transform: translate(-30px, 40px) scale(0.97); }
}


/* ── 4. NOISE TEXTURE OVERLAY ────────────────────────────────── */
/* SVG-based grain gives the dark bg a premium tactile feel.     */
.noise {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}


/* ── 5. LAYOUT WRAPPER ───────────────────────────────────────── */
.wrapper {
  position: relative;
  z-index: 2;                  /* Sits above blobs */
  width: 100%;
  padding: 24px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100dvh;
}


/* ── 6. GLASSMORPHISM CARD ───────────────────────────────────── */
.card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-card);
  padding: 44px 40px 36px;

  /* Frosted-glass blur */
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);

  /* Subtle glow on top edge */
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 32px 80px rgba(0, 0, 0, 0.55),
    0 0 80px rgba(167, 139, 250, 0.06);

  /* Entrance animation */
  animation: cardIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}


/* ── 7. BRAND / LOGO ─────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.brand-icon svg { width: 100%; height: 100%; }

.brand-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}


/* ── 8. HEADING ──────────────────────────────────────────────── */
.heading {
  margin-bottom: 28px;
}

.heading h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.heading p {
  font-size: 0.925rem;
  color: var(--text-secondary);
  font-weight: 300;
}


/* ── 9. SOCIAL LOGIN BUTTONS ─────────────────────────────────── */
.social-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 16px;
  background: var(--social-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition),
    transform 0.18s ease;
}
.social-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.social-btn:hover {
  background: var(--social-hover);
  border-color: rgba(255,255,255,0.20);
  transform: translateY(-1px);
}
.social-btn:active { transform: translateY(0); }


/* ── 10. DIVIDER ─────────────────────────────────────────────── */
.divider {
  position: relative;
  text-align: center;
  margin-bottom: 24px;
}
.divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: var(--input-border);
}
.divider span {
  position: relative;
  padding: 0 14px;
  background: transparent; /* transparent so blob shows through */
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}


/* ── 11. FORM FIELDS ─────────────────────────────────────────── */
form { display: flex; flex-direction: column; gap: 18px; }

/* Group: label + input wrapper + error */
.field-group { display: flex; flex-direction: column; gap: 7px; }

/* Labels */
label {
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

/* Row that holds label + "Forgot?" link side by side */
.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.forgot-link {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.forgot-link:hover { color: var(--accent-a); opacity: 1; }

/* Input wrapper (icon + input + toggle) */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

/* Left-side icon inside input */
.input-icon {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
  transition: color var(--transition);
}

/* The actual <input> element */
.input-wrap input {
  width: 100%;
  padding: 13px 16px 13px 42px; /* left padding leaves room for icon */
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.925rem;
  font-weight: 400;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

.input-wrap input::placeholder { color: var(--text-muted); }

/* Password input needs right padding for toggle button */
#password { padding-right: 44px; }

/* Focus state */
.input-wrap input:focus {
  border-color: rgba(167, 139, 250, 0.6);
  box-shadow: 0 0 0 3px var(--input-focus);
  background: rgba(255,255,255,0.07);
}

/* Icon colour change on focus */
.input-wrap:focus-within .input-icon { color: var(--accent-a); }

/* Error state */
.input-wrap.has-error input {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2);
}

/* Field error text */
.field-error {
  font-size: 0.78rem;
  color: var(--error);
  min-height: 16px;           /* Prevent layout shift */
  padding-left: 2px;
}


/* ── 12. SHOW / HIDE PASSWORD TOGGLE ─────────────────────────── */
.toggle-pw {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: color var(--transition);
}
.toggle-pw:hover { color: var(--text-primary); }
.eye-icon { width: 18px; height: 18px; }


/* ── 13. REMEMBER ME CHECKBOX ────────────────────────────────── */
.remember-row { margin-top: -4px; }

/* Hide native checkbox but keep it accessible */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Custom checkbox box */
.checkbox-custom {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 1.5px solid var(--input-border);
  border-radius: 5px;
  background: var(--input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color var(--transition),
    background var(--transition);
}

/* Checked state — gradient fill */
.checkbox-label input:checked + .checkbox-custom {
  background: var(--accent-grad);
  border-color: transparent;
}

/* Checkmark SVG drawn with pseudo-element */
.checkbox-label input:checked + .checkbox-custom::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(42deg) translateY(-1px);
}

/* Keyboard focus ring */
.checkbox-label input:focus-visible + .checkbox-custom {
  outline: 2px solid var(--accent-a);
  outline-offset: 2px;
}


/* ── 14. LOGIN BUTTON ────────────────────────────────────────── */
.btn-login {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  margin-top: 4px;
  background: var(--accent-grad);
  border: none;
  border-radius: var(--radius-btn);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  overflow: hidden;             /* Keeps shimmer inside */
  transition:
    opacity var(--transition),
    transform 0.2s ease,
    box-shadow 0.3s ease;
}

/* Gradient glow shadow */
.btn-login:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 30px rgba(167, 139, 250, 0.45),
    0 4px 12px rgba(56, 189, 248, 0.25);
}
.btn-login:active { transform: translateY(0); }

/* Shimmer sweep on hover */
.btn-login::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 80%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.18),
    transparent
  );
  transition: left 0.55s ease;
  pointer-events: none;
}
.btn-login:hover::before { left: 140%; }

/* Loading state — hides text, shows spinner */
.btn-login.loading .btn-text { opacity: 0; }
.btn-login.loading .btn-spinner { display: block; }
.btn-login.loading { pointer-events: none; opacity: 0.80; }

/* Spinner element */
.btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  position: absolute;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


/* ── 15. SIGN UP PROMPT ──────────────────────────────────────── */
.signup-prompt {
  margin-top: 22px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.signup-prompt a { font-weight: 500; }


/* ── 16. RESPONSIVE — MOBILE ─────────────────────────────────── */
/* On small screens: tighter padding, stacked social buttons. */
@media (max-width: 480px) {
  .card {
    padding: 32px 24px 28px;
    border-radius: 20px;
  }

  /* Stack social buttons vertically */
  .social-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .heading h1 { font-size: 1.6rem; }
}

/* Very small phones */
@media (max-width: 360px) {
  .card { padding: 28px 18px 24px; }
}