/* ============================================================
   LOGIN.CSS  —  Authentication Page
   Clean & Corporate · Dark mode · Micro-interactions
   Depends on base.css design tokens
   ============================================================ */

/* ── Google Font ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&display=swap');

/* ── Local Tokens (standalone page) ─────────────────────── */
:root {
  --blue:         #2563EB;
  --blue-2:       #1D4ED8;
  --blue-3:       #1E40AF;
  --blue-soft:    #EFF6FF;
  --blue-border:  #BFDBFE;
  --text:         #0F172A;
  --text-sec:     #334155;
  --muted:        #64748B;
  --faint:        #94A3B8;
  --border:       #E2E8F0;
  --bg:           #F8FAFC;
  --card:         #FFFFFF;
  --danger:       #DC2626;
  --danger-bg:    #FEF2F2;
  --danger-border:#FECACA;
  --focus-ring:   0 0 0 3px rgba(37,99,235,0.18);
  --shadow-card:  0 1px 4px rgba(15,23,42,0.06),
                  0 8px 24px rgba(15,23,42,0.08),
                  0 24px 48px rgba(15,23,42,0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --blue:         #3B82F6;
    --blue-2:       #60A5FA;
    --blue-3:       #93C5FD;
    --blue-soft:    #1E3A5F;
    --blue-border:  #1D4ED8;
    --text:         #F1F5F9;
    --text-sec:     #CBD5E1;
    --muted:        #94A3B8;
    --faint:        #475569;
    --border:       #2D3F55;
    --bg:           #0F172A;
    --card:         #1E293B;
    --danger:       #EF4444;
    --danger-bg:    #1C0505;
    --danger-border:#7F1D1D;
    --focus-ring:   0 0 0 3px rgba(59,130,246,0.28);
    --shadow-card:  0 1px 4px rgba(0,0,0,0.40),
                    0 8px 24px rgba(0,0,0,0.35),
                    0 24px 48px rgba(0,0,0,0.30);
  }
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

/* ── Body & Background ───────────────────────────────────── */
body {
  font-family: 'DM Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  /* Layered radial gradient mesh */
  background-image:
    radial-gradient(ellipse 800px 600px at 10%  0%,  rgba(37,99,235,0.10) 0%, transparent 65%),
    radial-gradient(ellipse 600px 500px at 90%  10%, rgba(37,99,235,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 500px 400px at 50% 100%, rgba(37,99,235,0.05) 0%, transparent 60%);
  background-attachment: fixed;
}

@media (prefers-color-scheme: dark) {
  body {
    background-image:
      radial-gradient(ellipse 800px 600px at 10%  0%,  rgba(59,130,246,0.08) 0%, transparent 65%),
      radial-gradient(ellipse 600px 500px at 90%  10%, rgba(59,130,246,0.05) 0%, transparent 60%),
      radial-gradient(ellipse 500px 400px at 50% 100%, rgba(59,130,246,0.04) 0%, transparent 60%);
  }
}

/* ── Page Wrapper ────────────────────────────────────────── */
.page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: var(--space-6, 24px);
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  padding: 32px;
  animation: cardReveal 0.45s cubic-bezier(0.16,1,0.3,1) both;
  position: relative;
  overflow: hidden;
}

/* Subtle top shimmer line */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(37,99,235,0.35) 40%,
    rgba(37,99,235,0.35) 60%,
    transparent 100%
  );
}

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* ── Brand ───────────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.logo {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.16,1,0.3,1),
              box-shadow 0.2s cubic-bezier(0.16,1,0.3,1);
}

.logo:hover {
  transform: scale(1.06) rotate(-2deg);
  box-shadow: 0 4px 14px rgba(37,99,235,0.20);
}

.logo svg, .logo img {
  width: 26px;
  height: 26px;
}

.brand-text h1 {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.4px;
  color: var(--text);
}

.brand-text p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
  border-radius: 1px;
}

/* ── Alert ───────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 18px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  animation: shakeIn 0.4s cubic-bezier(0.36,0.07,0.19,0.97) both;
}

@keyframes shakeIn {
  0%  { transform: translateX(0);   opacity: 0; }
  15% { transform: translateX(-5px); opacity: 1; }
  30% { transform: translateX(5px);  }
  45% { transform: translateX(-3px); }
  60% { transform: translateX(3px);  }
  75% { transform: translateX(-1px); }
  100%{ transform: translateX(0);   }
}

/* ── Form ────────────────────────────────────────────────── */
.form {
  display: grid;
  gap: 14px;
}

label {
  display: block;
}

label span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sec);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

/* ── Input ───────────────────────────────────────────────── */
input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 130ms ease,
              box-shadow    130ms ease,
              background    130ms ease;
}

input::placeholder {
  color: var(--faint);
  font-weight: 400;
}

input:hover {
  border-color: var(--faint);
}

input:focus {
  border-color: var(--blue);
  background: var(--card);
  box-shadow: var(--focus-ring);
}

/* Password field wrapper */
.input-wrap {
  position: relative;
}

.input-wrap input {
  padding-right: 44px;
}

.input-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--faint);
  font-size: 16px;
  padding: 4px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  transition: color 120ms ease, background 120ms ease;
  width: auto;
  margin: 0;
}

.input-toggle:hover {
  color: var(--muted);
  background: rgba(100,116,139,0.10);
  transform: translateY(-50%) scale(1.05);
}

/* ── Remember / Forgot row ───────────────────────────────── */
.form-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.form-meta label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  user-select: none;
}

.form-meta label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.form-meta a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
  transition: color 120ms ease;
}

.form-meta a:hover {
  color: var(--blue-2);
  text-decoration: underline;
}

/* ── Submit Button ───────────────────────────────────────── */
button[type="submit"],
.login-btn {
  margin-top: 4px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background     130ms ease,
              box-shadow     130ms ease,
              transform      80ms  ease;
  position: relative;
  overflow: hidden;
}

button[type="submit"]:hover,
.login-btn:hover {
  background: var(--blue-2);
  box-shadow: 0 4px 14px rgba(37,99,235,0.30);
}

button[type="submit"]:active,
.login-btn:active {
  background: var(--blue-3);
  transform: translateY(1px);
  box-shadow: none;
}

button[type="submit"]:focus-visible,
.login-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Ripple on click */
button[type="submit"]::after,
.login-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.12);
  opacity: 0;
  transition: opacity 300ms ease;
  border-radius: inherit;
}

button[type="submit"]:active::after,
.login-btn:active::after {
  opacity: 1;
  transition: none;
}

/* Loading state */
button[type="submit"].loading,
.login-btn.loading {
  pointer-events: none;
  opacity: 0.75;
}

button[type="submit"].loading::before,
.login-btn.loading::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  margin-top: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.footer a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
  transition: color 120ms ease;
}

.footer a:hover {
  color: var(--blue-2);
  text-decoration: underline;
}

/* ── SSO / OAuth Buttons ─────────────────────────────────── */
.sso-btn {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text-sec);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 130ms ease,
              border-color 130ms ease,
              box-shadow   130ms ease;
  margin: 0;
}

.sso-btn:hover {
  background: var(--bg);
  border-color: var(--faint);
  box-shadow: 0 1px 4px rgba(15,23,42,0.06);
}

/* ── OR Separator ────────────────────────────────────────── */
.or-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
  color: var(--faint);
  font-size: 12px;
  font-weight: 500;
}

.or-sep::before,
.or-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  border-radius: 1px;
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 767px) {
  body {
    background-attachment: scroll;
  }

  .page {
    padding: 16px;
  }

  .card {
    padding: 24px;
    border-radius: 16px;
  }

  input {
    font-size: 16px;
  }
}
