@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --green: #2ECC71;
  --green-dark: #27ae60;
  --green-glow: rgba(46, 204, 113, 0.18);
  --black: #ffffff;
  --surface: #f4f6f5;
  --card: #ffffff;
  --border: rgba(46, 204, 113, 0.25);
  --text: #111814;
  --muted: #5a6e60;

  /* ── Shared easing tokens ── */
  --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);   /* bouncy spring         */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);        /* fast-out, slow finish */
  --ease-in-out:   cubic-bezier(0.65, 0, 0.35, 1);       /* smooth arc            */
  --ease-snap:     cubic-bezier(0.22, 1, 0.36, 1);       /* original — kept       */

  /* ── Duration scale ── */
  --dur-instant: 80ms;
  --dur-fast:    160ms;
  --dur-normal:  280ms;
  --dur-slow:    480ms;
  --dur-enter:   620ms;
}

/* ─────────────────────────────────────────────────────────────
   BASE
───────────────────────────────────────────────────────────── */

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  background-color: white;
}

/* Ambient background glow blobs */
body::before {
  content: '';
  position: fixed;
  top: -20%; left: -10%;
  width: 60vw; height: 60vw;
  pointer-events: none;
  animation: bgpulse 8s ease-in-out infinite alternate;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  bottom: -10%; right: -10%;
  width: 50vw; height: 50vw;
  pointer-events: none;
  animation: bgpulse 10s 2s ease-in-out infinite alternate-reverse;
  z-index: 0;
}

.dot-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-size: 36px 36px;
}

@keyframes bgpulse {
  from { transform: scale(1); }
  to   { transform: scale(1.15) translate(3%, 3%); }
}

/* ─────────────────────────────────────────────────────────────
   PAGE-ENTER  — orchestrated stagger
   Each element enters on its own curve + delay so the eye
   follows a natural reading path: left panel → right panel.
───────────────────────────────────────────────────────────── */

/* Card wrapper rises from below with slight blur dissolve */
@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(36px) scale(0.97);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Left panel wipes in from the left */
@keyframes panelLeft {
  from {
    opacity: 0;
    transform: translateX(-32px);
    clip-path: inset(0 100% 0 0);
  }
  to {
    opacity: 1;
    transform: translateX(0);
    clip-path: inset(0 0% 0 0);
  }
}

/* Right panel wipes in from the right */
@keyframes panelRight {
  from {
    opacity: 0;
    transform: translateX(32px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Gentle float-up for text rows inside panels */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Stat numbers count-snap in */
@keyframes statPop {
  0%   { opacity: 0; transform: translateY(10px) scale(0.85); }
  70%  { opacity: 1; transform: translateY(-3px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}

/* ─────────────────────────────────────────────────────────────
   LAYOUT
───────────────────────────────────────────────────────────── */

.login-wrapper {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

/* ─── Card ─── */
.login-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 900px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;

  animation: cardEnter var(--dur-enter) var(--ease-out-expo) both;

  /* Smooth hover lift — separate property list for performance */
  transition:
    border-color var(--dur-normal) var(--ease-in-out),
    box-shadow   var(--dur-normal) var(--ease-in-out),
    transform    var(--dur-normal) var(--ease-in-out);
  will-change: transform, box-shadow;
}
.login-card:hover {
  border-color: rgba(46, 204, 113, 0.5);
  box-shadow: 0 24px 64px rgba(46, 204, 113, 0.10), 0 6px 20px rgba(0,0,0,0.04);
  transform: translateY(-2px);
}

/* ─────────────────────────────────────────────────────────────
   LEFT PANEL
───────────────────────────────────────────────────────────── */

.left-box {
  background: linear-gradient(160deg, #f0faf4 0%, #e8f5ee 100%);
  border-right: 1px solid var(--border);
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  animation: panelLeft var(--dur-enter) 80ms var(--ease-out-expo) both;
}

.brand-name {
  font-family: 'Syne', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 4px;
  color: var(--text);
  transition: color var(--dur-fast) ease;
}
.brand-name span { color: var(--green); }

.brand-sub {
  font-family: 'Syne', sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.35em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 40px;
  animation: fadeIn var(--dur-slow) 200ms ease both;
}

/* ── Featured image — smooth float + depth shift on hover ── */
.featured-image img {
  width: 160px;
  border-radius: 16px;
  opacity: 0.92;
  filter: drop-shadow(0 8px 24px rgba(46,204,113,0.20));
  margin-bottom: 36px;

  transition:
    opacity     var(--dur-normal) ease,
    filter      var(--dur-normal) ease,
    transform   var(--dur-slow)   var(--ease-spring);
  will-change: transform;
}
.featured-image img:hover {
  opacity: 1;
  filter: drop-shadow(0 16px 40px rgba(46,204,113,0.38));
  transform: scale(1.05) translateY(-4px);
}

.tagline {
  font-family: 'Syne', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 14px;
  color: var(--text);
  animation: fadeUp var(--dur-slow) 180ms var(--ease-snap) both;
}
.tagline em { font-style: normal; color: var(--green); }

.tagline-desc {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.7;
  animation: fadeUp var(--dur-slow) 260ms var(--ease-snap) both;
}

.stats {
  display: flex;
  gap: 28px;
  margin-top: 40px;
}
.stat-item { display: flex; flex-direction: column; gap: 3px; }

.stat-num {
  font-family: 'Syne', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--green);
  transition: transform var(--dur-fast) var(--ease-spring);
}
.stat-item:hover .stat-num { transform: scale(1.12) translateY(-1px); }

/* Staggered stat pop-in */
.stat-item:nth-child(1) .stat-num { animation: statPop 0.5s 380ms var(--ease-snap) both; }
.stat-item:nth-child(2) .stat-num { animation: statPop 0.5s 460ms var(--ease-snap) both; }
.stat-item:nth-child(3) .stat-num { animation: statPop 0.5s 540ms var(--ease-snap) both; }

.stat-label { font-size: 0.7rem; color: var(--muted); }

/* ─────────────────────────────────────────────────────────────
   RIGHT PANEL
───────────────────────────────────────────────────────────── */

.right-box {
  padding: 52px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #ffffff;
  animation: panelRight var(--dur-enter) 80ms var(--ease-out-expo) both;
}

.header-text {
  margin-bottom: 32px;
  animation: fadeUp var(--dur-slow) 220ms var(--ease-snap) both;
}
.header-text h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}
.header-text p {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
}

/* ─────────────────────────────────────────────────────────────
   FORM FIELDS
───────────────────────────────────────────────────────────── */

/* Field labels — shift green when parent has focus */
.field-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 7px;
  display: block;
  transition:
    color       var(--dur-fast) ease,
    letter-spacing var(--dur-normal) ease;
}
.input-group:focus-within .field-label {
  color: var(--green);
  letter-spacing: 0.10em;  /* subtle label expand on focus */
}

/* Input group — staggered entrance */
.input-group {
  position: relative;
  margin-bottom: 20px !important;
}
.input-group                       { animation: fadeUp 0.46s 340ms var(--ease-snap) both; }
.input-group ~ .input-group        { animation-delay: 420ms; }
.input-group ~ .input-group ~ .input-group { animation-delay: 500ms; }

/* Icon — slides slightly on focus and tints green */
.input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  color: var(--muted);
  pointer-events: none;
  transition:
    color     var(--dur-fast) ease,
    transform var(--dur-normal) var(--ease-spring);
}
.input-group:focus-within .input-icon {
  color: var(--green);
  transform: translateY(-50%) scale(1.15);
}

/* Input base */
.form-control {
  background: var(--surface) !important;
  border: 1px solid rgba(0,0,0,0.10) !important;
  border-radius: 10px !important;
  color: var(--text) !important;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 0.9rem !important;
  padding: 12px 14px 12px 42px !important;

  transition:
    border-color var(--dur-fast) ease,
    box-shadow   var(--dur-normal) ease,
    background   var(--dur-normal) ease,
    transform    var(--dur-fast)   var(--ease-spring) !important;
}
.form-control::placeholder { color: #aabbb2 !important; }
.form-control:focus {
  border-color: var(--green) !important;
  box-shadow: 0 0 0 3px var(--green-glow) !important;
  outline: none !important;
  background: #f9fdfb !important;
  transform: translateY(-1px);  /* subtle lift on focus */
}
.form-control:focus:not(.input-error) {
  /* only lift when there's no error */
  transform: translateY(-1px);
}

/* Toggle-password eye button */
.toggle-pw {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  background: none; border: none;
  cursor: pointer; color: var(--muted);
  padding: 0; display: flex; align-items: center;

  transition:
    color     var(--dur-fast) ease,
    transform var(--dur-normal) var(--ease-spring),
    opacity   var(--dur-fast) ease;
}
.toggle-pw:hover {
  color: var(--green);
  transform: translateY(-50%) scale(1.18) rotate(8deg);
}
.toggle-pw:active {
  transform: translateY(-50%) scale(0.92);
  transition-duration: var(--dur-instant);
}

/* ─────────────────────────────────────────────────────────────
   REMEMBER / FORGOT ROW
───────────────────────────────────────────────────────────── */

.extras-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  margin-top: -4px;
  animation: fadeIn var(--dur-slow) 560ms ease both;
}
.remember-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.82rem; color: var(--muted); cursor: pointer;
  transition: color var(--dur-fast) ease;
}
.remember-label:hover { color: var(--text); }
.remember-label input[type="checkbox"] {
  accent-color: var(--green);
  width: 14px; height: 14px;
  transition: transform var(--dur-normal) var(--ease-spring);
}
.remember-label:hover input[type="checkbox"] { transform: scale(1.2); }

.forgot-link {
  font-size: 0.82rem;
  color: var(--green);
  text-decoration: none;
  position: relative;

  transition:
    opacity        var(--dur-fast) ease,
    letter-spacing var(--dur-normal) ease;
}
/* Underline grows from left on hover */
.forgot-link::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0;
  width: 0; height: 1px;
  background: var(--green);
  transition: width var(--dur-normal) var(--ease-out-expo);
}
.forgot-link:hover {
  opacity: 0.8;
  letter-spacing: 0.01em;
}
.forgot-link:hover::after { width: 100%; }

/* ─────────────────────────────────────────────────────────────
   LOGIN BUTTON
   State machine: idle → hover → active → loading → success
───────────────────────────────────────────────────────────── */

@keyframes shimmer {
  from { transform: translateX(-160%); }
  to   { transform: translateX(260%);  }
}

@keyframes spinRing {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Success pulse ring */
@keyframes successRing {
  0%   { box-shadow: 0 0 0 0   rgba(46,204,113,0.5); }
  70%  { box-shadow: 0 0 0 12px rgba(46,204,113,0);   }
  100% { box-shadow: 0 0 0 0   rgba(46,204,113,0);    }
}

@keyframes btnSuccess {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.035); }
  100% { transform: scale(1); }
}

@keyframes loadPulse {
  0%, 100% { opacity: 0.88; }
  50%       { opacity: 0.70; }
}

.custom-btn {
  position: relative;
  width: 100%;
  padding: 13px;
  background: var(--green);
  color: #000;
  font-family: 'Syne', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;  /* new stacking context — keeps shimmer clipped */

  transition:
    background      var(--dur-fast)   ease,
    transform       var(--dur-normal) var(--ease-spring),
    box-shadow      var(--dur-normal) ease,
    letter-spacing  var(--dur-normal) ease,
    opacity         var(--dur-fast)   ease;

  animation: fadeUp 0.46s 620ms var(--ease-snap) both;
}

/* Shimmer layer — runs only on hover via animation */
.custom-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  width: 40%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.28),
    transparent
  );
  transform: translateX(-160%);
  border-radius: inherit;
  pointer-events: none;
}

/* ── Hover ── */
.custom-btn:hover {
  background: var(--green-dark) !important;
  box-shadow: 0 8px 28px rgba(46,204,113,0.38);
  transform: translateY(-2px) scale(1.01);
  letter-spacing: 0.07em;
  color: #000;
}
.custom-btn:hover::before {
  animation: shimmer 0.6s var(--ease-in-out) forwards;
}

/* ── Active (press) ── */
.custom-btn:active {
  transform: translateY(1px) scale(0.985);
  box-shadow: 0 2px 8px rgba(46,204,113,0.18);
  transition-duration: var(--dur-instant);
}

/* ── Loading ── */
.custom-btn.btn-loading {
  pointer-events: none;
  cursor: not-allowed;
  background: var(--green-dark) !important;
  color: transparent !important;
  box-shadow: none;
  transform: none;
  animation: loadPulse 1.4s var(--ease-in-out) infinite !important;
}

/* Spinner — proper centering, no translate shift */
.custom-btn.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 19px; height: 19px;
  margin: -9.5px 0 0 -9.5px;  /* offset instead of transform, avoids conflict */
  border-radius: 50%;
  border: 2.5px solid rgba(0, 0, 0, 0.18);
  border-top-color: #000;
  animation: spinRing 0.65s linear infinite;
}
.custom-btn.btn-loading::before { display: none; }

/* ── Success flash ── */
.custom-btn.btn-success-flash {
  background: var(--green-dark) !important;
  color: #000 !important;
  pointer-events: none;
  animation: btnSuccess 0.45s var(--ease-spring) both,
             successRing  0.6s ease both !important;
}

/* ── Card overlay while loading ── */
.login-card.form-loading { pointer-events: none; }
.login-card.form-loading .right-box { position: relative; }
.login-card.form-loading .right-box::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.48);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border-radius: 0;
  z-index: 10;
  animation: fadeIn var(--dur-fast) ease both;
}

/* ─────────────────────────────────────────────────────────────
   INPUT ERROR STATE
───────────────────────────────────────────────────────────── */

@keyframes inputShake {
  0%  { transform: translateX(0); }
  15% { transform: translateX(-7px); }
  35% { transform: translateX(6px); }
  55% { transform: translateX(-4px); }
  75% { transform: translateX(3px); }
  90% { transform: translateX(-1px); }
  100%{ transform: translateX(0); }
}

.form-control.input-error {
  border-color: #e74c3c !important;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.14) !important;
  animation: inputShake 0.45s var(--ease-snap) both;
  transform: none !important;  /* no lift when errored */
}

/* ─────────────────────────────────────────────────────────────
   SECURE BADGE
───────────────────────────────────────────────────────────── */

.secure-badge {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 20px;
  font-size: 0.74rem; color: var(--muted);
  animation: fadeIn var(--dur-slow) 740ms ease both;
  transition: color var(--dur-fast) ease;
}
.secure-badge:hover { color: var(--text); }
.secure-badge svg {
  color: var(--green);
  flex-shrink: 0;
  transition: transform var(--dur-normal) var(--ease-spring);
}
.secure-badge:hover svg { transform: scale(1.2) rotate(-8deg); }



@media (max-width: 767px) {
  .login-card { grid-template-columns: 1fr; }
  .left-box   { display: none; }
  .right-box  { padding: 40px 28px; }
}



@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration:       0.01ms !important;
    animation-iteration-count: 1     !important;
    transition-duration:      0.01ms !important;
  }
}

.custom-alert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.custom-alert-box {
    background: #fff;
    border-radius: 16px;
    padding: 2rem 2rem 1.5rem;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.custom-alert-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.8rem;
}
.custom-alert-icon.success { background: #d4edda; color: #28a745; }
.custom-alert-icon.error   { background: #f8d7da; color: #dc3545; }
.custom-alert-icon.warning { background: #fff3cd; color: #fd7e14; }
.custom-alert-icon.info    { background: #d1ecf1; color: #17a2b8; }

.custom-alert-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.4rem;
}

.custom-alert-message {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.custom-alert-btn {
    border: none;
    border-radius: 8px;
    padding: 0.5rem 2rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s;
}
.custom-alert-btn:hover { filter: brightness(0.9); }
.custom-alert-btn.success { background: #28a745; color: #fff; }
.custom-alert-btn.error   { background: #dc3545; color: #fff; }
.custom-alert-btn.warning { background: #fd7e14; color: #fff; }
.custom-alert-btn.info    { background: #17a2b8; color: #fff; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn  { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }