/* Page-specific styles — shared theme lives in common.css */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

button, input { font: inherit; }
.login-page {
  width: 100%;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding:
    max(16px, env(safe-area-inset-top))
    20px
    max(22px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

/* Header */

.topbar {
  height: 52px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
}

.brand {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-size: 19px;
  font-weight: 800;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--primary-soft);
  font-size: 19px;
}

.back-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 20px;
}

.topbar-space {
  width: 40px;
}

/* Main */

.login-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 0 15px;
}

/* Mobile illustration */

.hero {
  width: 100%;
  height: 190px;
  position: relative;
  margin-bottom: 7px;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  width: 175px;
  height: 175px;
  border-radius: 50%;
  background: var(--primary-soft);
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
}

.python-avatar {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 22px;
  transform: translateX(-50%) rotate(-5deg);
  width: 112px;
  height: 112px;
  border-radius: 46% 54% 50% 50%;
  display: grid;
  place-items: center;
  background: var(--secondary-soft);
  border: 4px solid var(--secondary);
  font-size: 65px;
  box-shadow: 0 14px 28px rgba(73,108,38,.14);
}

.code-card {
  position: absolute;
  z-index: 3;
  left: 50%;
  transform: translateX(-50%);
  bottom: 4px;
  width: min(235px, 72%);
  padding: 10px 15px;
  border-radius: 12px;
  background: var(--code);
  color: #f4f2ff;
  direction: ltr;
  text-align: left;
  font-family: Consolas, monospace;
  font-size: 11px;
  line-height: 1.65;
  box-shadow: 0 10px 22px rgba(37,38,58,.18);
}

.keyword { color: var(--accent); }

.spark {
  position: absolute;
  z-index: 4;
  color: var(--primary);
  font-size: 20px;
}

.spark-one { top: 24px; right: 16%; }
.spark-two { top: 72px; left: 15%; color: var(--accent); }
.spark-three { bottom: 24px; right: 10%; color: var(--secondary); }

.orbit-one,
.orbit-two {
  position: absolute;
  border-radius: 50%;
  border: 2px dashed rgba(107,77,230,.12);
}

.orbit-one {
  width: 190px;
  height: 120px;
  left: 50%;
  top: 32px;
  transform: translateX(-50%) rotate(-10deg);
}

.orbit-two {
  width: 220px;
  height: 150px;
  left: 50%;
  top: 18px;
  transform: translateX(-50%) rotate(12deg);
  border-color: rgba(140,203,69,.10);
}

/* Heading */

.heading {
  text-align: center;
  margin: 0 0 25px;
}

.heading h1 {
  margin: 0 0 8px;
  font-size: 25px;
  font-weight: 800;
}

.heading p {
  margin: 0 auto;
  max-width: 320px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.9;
}

/* Form */

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label,
.label-row label {
  font-size: 12px;
  font-weight: 600;
}

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

.label-row a {
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
}

.input-wrap {
  height: 51px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  transition: .2s ease;
}

.input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(107,77,230,.08);
}

.input-icon {
  color: #9994a7;
  font-size: 17px;
}

.input-wrap input {
  width: 100%;
  height: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.input-wrap input::placeholder {
  color: #aaa6b5;
}

.password-toggle {
  border: 0;
  padding: 4px;
  background: transparent;
  color: #9994a7;
  cursor: pointer;
}

.remember {
  display: flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  color: var(--text-soft);
  font-size: 11px;
}

.remember input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
}

.login-button {
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 14px;
  background: var(--primary);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 8px 18px rgba(107,77,230,.22);
  transition: .2s ease;
}

.login-button:active {
  transform: scale(.985);
}

.signup-link {
  margin-top: 21px;
  text-align: center;
  color: var(--text-soft);
  font-size: 12px;
}

.signup-link a {
  color: var(--primary);
  font-weight: 700;
  margin-right: 4px;
}

/* Gamification accents */

.bottom-decoration {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 5px;
}

.badge {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  background: white;
  border: 1px solid var(--border);
}

.badge-purple { color: var(--primary); }
.badge-yellow { color: #9a6a0b; background: var(--accent-soft); }
.badge-green { color: #4f7f22; background: var(--secondary-soft); }

/* Very small phones */

@media (max-height: 700px) {
  .hero {
    height: 135px;
  }

  .python-avatar {
    width: 78px;
    height: 78px;
    font-size: 46px;
    top: 10px;
  }

  .code-card {
    bottom: 0;
    font-size: 9px;
    padding: 7px 11px;
  }

  .hero::before {
    width: 125px;
    height: 125px;
  }

  .heading {
    margin-bottom: 17px;
  }

  .heading h1 {
    font-size: 22px;
  }

  .login-form {
    gap: 12px;
  }

  .input-wrap,
  .login-button {
    height: 47px;
  }
}

/* ===== Desktop improvements ===== */
@media (min-width: 768px) {
  .login-page {
    max-width: 440px;
    padding-top: 28px;
    padding-bottom: 32px;
  }

  .topbar {
    height: 56px;
    margin-bottom: 8px;
  }

  .brand {
    font-size: 21px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 21px;
  }

  .hero {
    height: 210px;
    margin-bottom: 14px;
  }

  .hero::before {
    width: 190px;
    height: 190px;
  }

  .python-avatar {
    width: 124px;
    height: 124px;
    font-size: 72px;
    top: 24px;
  }

  .code-card {
    width: min(260px, 75%);
    font-size: 12.5px;
    padding: 11px 16px;
  }

  .heading {
    margin-bottom: 26px;
  }

  .heading h1 {
    font-size: 28px;
  }

  .heading p {
    font-size: 14.5px;
    margin-top: 8px;
  }

  .login-form {
    gap: 16px;
  }

  .field label {
    font-size: 13.5px;
  }

  .input-wrap {
    height: 54px;
    border-radius: 14px;
  }

  .input-wrap input {
    font-size: 14.5px;
  }

  .login-button {
    height: 54px;
    font-size: 15px;
    border-radius: 15px;
  }

  .signup-link {
    margin-top: 24px;
    font-size: 13.5px;
  }
}

@media (min-width: 1024px) {
  .login-page {
    max-width: 460px;
  }

  .hero {
    height: 220px;
  }

  .python-avatar {
    width: 132px;
    height: 132px;
    font-size: 76px;
  }

  .heading h1 {
    font-size: 30px;
  }
}

.login-page {
  position: relative;
  overflow: hidden;
}

.login-page > *:not(.bg-orb) {
  position: relative;
  z-index: 2;
}

.orb-3 {
  width: 130px;
  height: 130px;
  background: var(--accent);
  top: 42%;
  right: -40px;
  opacity: 0.22;
  animation: orb-float 13s ease-in-out infinite;
}

/* Enhanced animations */
.python-avatar {
  animation: float-avatar 3.2s ease-in-out infinite;
}

.spark {
  animation: twinkle 2.4s ease-in-out infinite;
}

.spark-two {
  animation-delay: 0.7s;
}

.spark-three {
  animation-delay: 1.3s;
}

.hero-orbit {
  animation: spin-orbit 14s linear infinite;
}

.orbit-two {
  animation: spin-orbit 20s linear infinite reverse;
}

@keyframes float-avatar {
  0%, 100% { transform: translateX(-50%) rotate(-5deg) translateY(0); }
  50% { transform: translateX(-50%) rotate(-5deg) translateY(-7px); }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.45; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.2); }
}

@keyframes spin-orbit {
  from { transform: translateX(-50%) rotate(0deg); }
  to { transform: translateX(-50%) rotate(360deg); }
}

@keyframes orb-float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(12px, -10px); }
}
