*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #16a34a;
  --primary-light: #f0fdf4;
  --primary-dark: #15803d;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger-bg: #fee2e2;
  --danger-text: #dc2626;
  --danger-border: #e74c3c;
  --success-bg: #dcfce7;
  --success-text: #16a34a;
  --success-border: #22c55e;
  --brand-panel-bg: #0f172a;
  --brand-panel-text: #f8fafc;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
  --primary: #4ade80;
  --primary-light: rgba(74, 222, 128, 0.12);
  --primary-dark: #22c55e;
  --bg: #090d16;
  --card: #111827;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: #1e293b;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  --danger-bg: #2a1010;
  --danger-text: #ff6b6b;
  --danger-border: #ff4444;
  --success-bg: #062817;
  --success-text: #4ade80;
  --success-border: #4ade80;
  --brand-panel-bg: #050911;
  --brand-panel-text: #f1f5f9;
}

html, body {
  height: 100%;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
}

.auth-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.auth-brand-panel {
  background: var(--brand-panel-bg);
  color: var(--brand-panel-text);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px;
  position: relative;
  overflow: hidden;
}

.auth-brand-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(560px circle at 10% 20%, rgba(22, 163, 74, 0.18), transparent 55%),
    radial-gradient(400px circle at 90% 80%, rgba(22, 163, 74, 0.10), transparent 55%);
  pointer-events: none;
}

.brand-logo {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: #4ade80;
  text-decoration: none;
  letter-spacing: -0.5px;
  position: relative;
  z-index: 1;
}

.brand-body {
  position: relative;
  z-index: 1;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.25);
  color: #4ade80;
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 24px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.brand-headline {
  font-size: 40px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin-bottom: 18px;
  color: #ffffff;
}

.brand-headline span {
  color: #4ade80;
}

.brand-sub {
  color: #94a3b8;
  font-size: 15px;
  line-height: 1.7;
  max-width: 380px;
  margin-bottom: 32px;
}

.brand-features {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-feat {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #cbd5e1;
  font-weight: 500;
}

.brand-feat svg {
  color: #4ade80;
  flex-shrink: 0;
}

.brand-footer-note {
  position: relative;
  z-index: 1;
  font-size: 12.5px;
  color: #475569;
}

.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  overflow-y: auto;
}

.auth-wrap {
  width: 100%;
  max-width: 440px;
  position: relative;
}

.mobile-logo {
  display: none;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: var(--primary);
  text-decoration: none;
  text-align: center;
  letter-spacing: -0.5px;
  margin-bottom: 24px;
}

.auth-card {
  background: var(--card);
  border-radius: 24px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.auth-card-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 24px;
}

.auth-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border: 1px solid rgba(22, 163, 74, 0.2);
}

h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--muted);
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 14.5px;
  background: var(--card);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  margin-bottom: 0;
}

.google-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.12);
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.opt-label {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.label-row label {
  margin-bottom: 0;
}

.forgot-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

.forgot-link:hover {
  text-decoration: underline;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  pointer-events: none;
  flex-shrink: 0;
}

.input-wrap input,
.input-wrap select {
  width: 100%;
  padding: 13px 16px 13px 40px;
  font-size: 15px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.input-wrap input:focus,
.input-wrap select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
  background: var(--card);
}

.pw-toggle {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.2s;
}

.pw-toggle:hover {
  color: var(--text);
}

.select-wrap .select-arrow {
  position: absolute;
  right: 12px;
  color: var(--muted);
  pointer-events: none;
}

.select-wrap select {
  padding-right: 36px;
}

.field-hint {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.4;
}

.error-msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--danger-bg);
  color: var(--danger-text);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 18px;
  border-left: 3px solid var(--danger-border);
}

.error-msg svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 15.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  margin-top: 6px;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  min-height: 52px;
  letter-spacing: 0.1px;
  position: relative;
}

.submit-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.3);
}

.submit-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.submit-btn.is-loading {
  color: transparent !important;
  pointer-events: none;
}

.submit-btn.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  margin-left: -11px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: btnSpin 0.65s linear infinite;
}

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

.otp-note {
  display: flex;
  align-items: center;
  gap: 7px;
  text-align: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13.5px;
  color: var(--muted);
}

.auth-footer a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.theme-toggle-wrapper {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
}

.theme-toggle-btn {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 0;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  transition: background 0.2s, border-color 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  color: var(--text);
}

.theme-toggle-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

[data-theme="dark"] .theme-toggle-btn {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .input-wrap input:focus,
[data-theme="dark"] .input-wrap select:focus {
  background: var(--card) !important;
}

body.is-folding {
  overflow: hidden !important;
  pointer-events: none;
}

.auth-card.shake {
  animation: cardShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes cardShake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

.auth-wrap.paper-folding {
  animation: paperFold 0.85s cubic-bezier(0.4, 0, 0.8, 0.6) forwards;
  transform-origin: center top;
  pointer-events: none;
}

@keyframes paperFold {
  0% {
    transform: perspective(900px) rotateX(0deg) scale(1) translateY(0);
    opacity: 1;
    filter: brightness(1);
  }
  28% {
    transform: perspective(900px) rotateX(-22deg) scale(0.93) translateY(-10px);
    opacity: 1;
    filter: brightness(0.96);
  }
  60% {
    transform: perspective(900px) rotateX(-85deg) scale(0.72) translateY(-30px);
    opacity: 0.82;
    filter: brightness(0.88);
  }
  85% {
    transform: perspective(900px) rotateX(-140deg) scale(0.42) translateY(-50px);
    opacity: 0.35;
    filter: brightness(0.75);
  }
  100% {
    transform: perspective(900px) rotateX(-180deg) scale(0.08) translateY(-70px);
    opacity: 0;
  }
}

.paper-plane-flyer {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;
  margin-top: -60px;
  margin-left: -60px;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.3));
}

.paper-plane-flyer.active {
  animation: planeCrash 0.78s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes planeCrash {
  0% {
    opacity: 0;
    transform: translate(-180px, 90px) rotate(-38deg) scale(0.35);
  }
  15% {
    opacity: 1;
    transform: translate(-130px, 55px) rotate(-32deg) scale(0.6);
  }
  38% {
    opacity: 1;
    transform: translate(50px, -45px) rotate(12deg) scale(0.85);
  }
  58% {
    opacity: 1;
    transform: translate(15px, -12px) rotate(-6deg) scale(1.3);
  }
  76% {
    opacity: 1;
    transform: translate(3px, -2px) rotate(-2deg) scale(3.5);
    filter: drop-shadow(0 0 30px rgba(34, 197, 94, 0.7));
  }
  92% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(10);
    filter: brightness(2.5) drop-shadow(0 0 80px rgba(255, 255, 255, 0.95));
  }
  100% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg) scale(16);
    filter: brightness(5);
  }
}

.crash-impact-flash {
  position: fixed;
  inset: 0;
  background: white;
  opacity: 0;
  pointer-events: none;
  z-index: 10000;
  transition: opacity 0.12s ease-in;
}

.crash-impact-flash.active {
  opacity: 1;
}

@media (max-width: 900px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-brand-panel {
    display: none;
  }

  .mobile-logo {
    display: block;
  }

  .auth-form-panel {
    min-height: 100vh;
    padding: 24px 16px;
    align-items: flex-start;
    padding-top: 60px;
  }

  .auth-wrap {
    max-width: 480px;
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 28px 20px;
    border-radius: 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
