/**
 * JustPiece — Modern E-Commerce Authentication
 * Inspired by Theta aesthetic with JustPiece brand green palette (#37a446).
 */

@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Outfit:wght@500;600;700;800&display=swap");

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

:root {
  --jp-brand: #37a446;
  --jp-brand-light: #46b856;
  --jp-brand-dark: #278334;
  --jp-accent: #15803d;
  --jp-accent-light: #86efac;
  --jp-mint: #dcfce7;
  --jp-cream: #f7fef9;
  --jp-bg: #f0fdf4;
  --jp-card: #ffffff;
  --jp-text: #0f2914;
  --jp-text-soft: #166534;
  --jp-muted: #52795e;
  --jp-border: rgba(55, 164, 70, 0.18);
  --jp-glow: rgba(55, 164, 70, 0.22);
  --jp-shadow: rgba(55, 164, 70, 0.12);
  --jp-error: #dc2626;
  --jp-brand-side-bg: #eaf6ed;
  --jp-brand-side-accent: #cfead5;
}

@keyframes jp-fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes jp-card-in {
  from { opacity: 0; transform: scale(0.97) translateY(14px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes jp-shine {
  0% { left: -100%; }
  100% { left: 120%; }
}

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

@keyframes jp-float-slow {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(5px, -7px) rotate(2deg); }
  66% { transform: translate(-4px, 5px) rotate(-1deg); }
}

@keyframes jp-glow-pulse {
  0%, 100% { box-shadow: 0 32px 80px rgba(15, 41, 20, 0.07), 0 0 0 1px var(--jp-border); }
  50% { box-shadow: 0 40px 100px rgba(55, 164, 70, 0.18), 0 0 0 1px var(--jp-border); }
}

@keyframes jp-orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.55; }
  25% { transform: translate(3%, -4%) scale(1.06); opacity: 0.7; }
  50% { transform: translate(-2%, 3%) scale(0.95); opacity: 0.6; }
  75% { transform: translate(2%, 4%) scale(1.03); opacity: 0.65; }
}

@keyframes jp-bg-drift {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.92; }
}

@keyframes jp-badge-float-1 {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes jp-badge-float-2 {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* Base Body */
body.jp-auth {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    linear-gradient(145deg, #ecfdf5 0%, #dcfce7 20%, #f0fdf4 50%, #dcfce7 80%, #f7fef9 100%);
}

body.jp-auth::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 100% 80% at 0% 0%, rgba(55, 164, 70, 0.09) 0%, transparent 50%),
    radial-gradient(ellipse 80% 100% at 100% 0%, rgba(70, 184, 86, 0.07) 0%, transparent 48%),
    radial-gradient(ellipse 90% 70% at 100% 100%, rgba(55, 164, 70, 0.07) 0%, transparent 45%),
    radial-gradient(ellipse 70% 90% at 0% 100%, rgba(55, 164, 70, 0.08) 0%, transparent 45%),
    radial-gradient(ellipse 60% 60% at 50% 50%, rgba(255, 255, 255, 0.88) 0%, transparent 70%);
  pointer-events: none;
  animation: jp-bg-drift 14s ease-in-out infinite;
}

/* Subtle dot grain */
.jp-grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at center, rgba(55, 164, 70, 0.04) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  opacity: 0.95;
}

/* Soft ambient green orbs */
.jp-bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.jp-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(65px);
  animation: jp-orb-float 20s ease-in-out infinite;
}

.jp-orb:nth-child(1) {
  width: 360px; height: 360px;
  top: -8%; left: -6%;
  background: radial-gradient(circle, rgba(55, 164, 70, 0.16) 0%, rgba(55, 164, 70, 0.03) 50%, transparent 70%);
  animation-duration: 22s; animation-delay: 0s;
}

.jp-orb:nth-child(2) {
  width: 300px; height: 300px;
  top: 40%; right: -6%;
  background: radial-gradient(circle, rgba(70, 184, 86, 0.14) 0%, rgba(70, 184, 86, 0.02) 50%, transparent 70%);
  animation-duration: 18s; animation-delay: 3s;
}

.jp-orb:nth-child(3) {
  width: 280px; height: 280px;
  bottom: -6%; left: 28%;
  background: radial-gradient(circle, rgba(55, 164, 70, 0.12) 0%, transparent 60%);
  animation-duration: 25s; animation-delay: 6s;
}

.jp-orb:nth-child(4) {
  width: 230px; height: 230px;
  top: 56%; left: -4%;
  background: radial-gradient(circle, rgba(55, 164, 70, 0.1) 0%, transparent 60%);
  animation-duration: 20s; animation-delay: 2s;
}

.jp-orb:nth-child(5) {
  width: 320px; height: 320px;
  top: 10%; right: 16%;
  background: radial-gradient(circle, rgba(55, 164, 70, 0.09) 0%, transparent 55%);
  animation-duration: 24s; animation-delay: 4s;
}

/* Floating geometric accent shapes */
.jp-shapes {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.jp-shape {
  position: absolute;
  border: 1.5px solid rgba(55, 164, 70, 0.22);
  opacity: 0.45;
  animation: jp-float 14s ease-in-out infinite;
}

.jp-shape:nth-child(1) { width: 95px; height: 95px; top: 12%; left: 7%; border-radius: 50% 0 50% 50%; animation-delay: 0s; animation-duration: 12s; }
.jp-shape:nth-child(2) { width: 60px; height: 60px; top: 78%; right: 10%; border-radius: 0 50% 50% 50%; animation-delay: 2.5s; animation-duration: 16s; }
.jp-shape:nth-child(3) { width: 80px; height: 80px; bottom: 18%; left: 9%; border-radius: 50%; animation-delay: 5s; animation: jp-float-slow 18s ease-in-out infinite; }
.jp-shape:nth-child(4) { width: 70px; height: 70px; top: 34%; right: 14%; border-radius: 50% 50% 0 50%; animation-delay: 1s; animation-duration: 13s; }
.jp-shape:nth-child(5) { width: 85px; height: 85px; top: 56%; left: 4%; border-radius: 50% 50% 50% 0; animation-delay: 3s; animation-duration: 15s; }
.jp-shape:nth-child(6) { width: 50px; height: 50px; top: 18%; right: 7%; border-radius: 50%; animation-delay: 4s; animation: jp-float-slow 14s ease-in-out infinite; }

/* Main Login Wrap */
.jp-login-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1020px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--jp-card);
  border-radius: 28px;
  overflow: hidden;
  min-height: 600px;
  box-shadow:
    0 32px 80px rgba(15, 41, 20, 0.07),
    0 0 0 1px var(--jp-border);
  animation: jp-card-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards, jp-glow-pulse 8s ease-in-out 1s infinite;
}

/* Left Brand Panel */
.jp-brand-side {
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(165deg, #f3faf5 0%, var(--jp-brand-side-bg) 40%, #d8edd9 65%, var(--jp-brand-side-accent) 100%);
}

.jp-brand-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(55, 164, 70, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 60% 80% at 80% 80%, rgba(70, 184, 86, 0.08) 0%, transparent 50%),
    linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.5) 50%, transparent 100%);
  z-index: 0;
}

.jp-brand-content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 360px;
}

.jp-brand-content .logo-link {
  display: inline-block;
  margin-bottom: 24px;
  animation: jp-fade-up 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.jp-brand-content .logo-link:hover {
  transform: scale(1.04);
  filter: drop-shadow(0 8px 22px rgba(55, 164, 70, 0.28));
}

.jp-brand-content .logo-link img {
  max-width: 190px;
  width: 100%;
  height: auto;
}

/* E-Commerce Visual Hub */
.jp-ecommerce-visual {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 12px 0 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #ffffff 45%, #eaf6ed 100%);
  border-radius: 50%;
  border: 2px solid rgba(55, 164, 70, 0.25);
  box-shadow: 0 16px 36px rgba(55, 164, 70, 0.16);
  animation: jp-float 6s ease-in-out infinite;
}

.jp-ecommerce-icon {
  font-size: 68px;
  color: var(--jp-brand);
  filter: drop-shadow(0 6px 14px rgba(55, 164, 70, 0.2));
}

.jp-badge {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--jp-text);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(55, 164, 70, 0.2);
  white-space: nowrap;
}

.jp-badge i {
  font-size: 14px;
  color: var(--jp-brand);
}

.jp-badge-1 {
  top: -6px;
  right: -24px;
  animation: jp-badge-float-1 5s ease-in-out infinite;
}

.jp-badge-2 {
  bottom: 0px;
  left: -28px;
  animation: jp-badge-float-2 5.5s ease-in-out infinite;
}

.jp-brand-tagline {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--jp-text);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
  animation: jp-fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
}

.jp-brand-subtitle {
  font-size: 13px;
  color: var(--jp-muted);
  line-height: 1.5;
  font-weight: 500;
  animation: jp-fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.18s both;
}

.jp-brand-side .jp-corner {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-right: 2px solid var(--jp-brand);
  border-bottom: 2px solid var(--jp-brand);
  border-radius: 0 0 12px 0;
  opacity: 0.5;
}

/* Right Form Panel */
.jp-form-side {
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(180deg, #ffffff 0%, #f7fef9 40%, #f0fdf4 100%);
  border-left: 1px solid var(--jp-border);
  position: relative;
}

.jp-form-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(236, 253, 245, 0.95) 0%, transparent 55%),
    radial-gradient(ellipse 50% 80% at 0% 100%, rgba(55, 164, 70, 0.05) 0%, transparent 50%);
  pointer-events: none;
}

.jp-form-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 370px;
  margin: 0 auto;
}

.jp-form-header {
  margin-bottom: 32px;
}

.jp-form-title {
  font-family: 'Outfit', sans-serif;
  font-size: 30px;
  font-weight: 700;
  color: var(--jp-text);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  line-height: 1.2;
  animation: jp-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.jp-form-subtitle {
  font-size: 14px;
  color: var(--jp-muted);
  font-weight: 500;
  animation: jp-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.06s both;
}

/* Input groups */
.jp-input-group {
  margin-bottom: 20px;
  animation: jp-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.jp-form-inner form .jp-input-group:nth-of-type(2) { animation-delay: 0.1s; }

.jp-input-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--jp-text-soft);
  margin-bottom: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.jp-input-wrap {
  position: relative;
  border-radius: 14px;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
}

.jp-input-wrap:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px var(--jp-shadow);
}

.jp-input-wrap .icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--jp-muted);
  font-size: 19px;
  pointer-events: none;
  transition: color 0.25s ease, transform 0.25s ease;
}

.jp-input-wrap:focus-within .icon {
  color: var(--jp-brand);
  transform: translateY(-50%) scale(1.08);
}

.jp-input-wrap input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  background: var(--jp-cream);
  border: 2px solid var(--jp-border);
  border-radius: 14px;
  color: var(--jp-text);
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  outline: none;
}

.jp-input-wrap input::placeholder {
  color: #8da995;
  font-weight: 400;
}

.jp-input-wrap input:focus {
  border-color: var(--jp-brand);
  background: #ffffff;
  box-shadow: 0 0 0 4px var(--jp-glow);
}

.jp-input-wrap input.is-invalid {
  border-color: var(--jp-error);
}

.jp-toggle-password {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--jp-muted);
  cursor: pointer;
  font-size: 18px;
  transition: color 0.2s ease, transform 0.2s ease;
  user-select: none;
}

.jp-toggle-password:hover {
  color: var(--jp-brand);
  transform: translateY(-50%) scale(1.1);
}

.jp-input-wrap.has-toggle input {
  padding-right: 46px;
}

.jp-invalid-feedback {
  color: var(--jp-error);
  font-size: 12px;
  margin-top: 6px;
  font-weight: 500;
}

/* Remember me & Options */
.jp-remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  animation: jp-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

.jp-remember {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--jp-text-soft);
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}

.jp-remember input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--jp-brand);
  cursor: pointer;
}

/* Submit Button */
.jp-submit {
  width: 100%;
  padding: 16px 22px;
  background: var(--jp-brand);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, background 0.25s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(55, 164, 70, 0.35);
  animation: jp-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.26s both;
}

.jp-submit::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.32), transparent);
  animation: jp-shine 4s ease-in-out infinite;
  pointer-events: none;
}

.jp-submit:hover {
  background: var(--jp-brand-light);
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(55, 164, 70, 0.45);
}

.jp-submit:active {
  transform: translateY(0);
}

/* Alerts */
.jp-alert {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 500;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.2);
  color: var(--jp-error);
  animation: jp-fade-up 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Auth Divider */
.jp-auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 22px 0 16px;
  animation: jp-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

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

.jp-auth-divider span {
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--jp-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Google Sign-in Button */
.jp-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  background: #ffffff;
  border: 1.5px solid var(--jp-border);
  border-radius: 14px;
  color: var(--jp-text);
  font-size: 14px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 4px 14px rgba(15, 41, 20, 0.04);
  animation: jp-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.34s both;
}

.jp-google-btn:hover {
  background: var(--jp-cream);
  border-color: var(--jp-brand-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px var(--jp-shadow);
  color: var(--jp-brand-dark);
}

.jp-google-btn:active {
  transform: translateY(0);
}

.jp-google-icon {
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.jp-google-btn:hover .jp-google-icon {
  transform: scale(1.08);
}

/* Social Login Group */
.jp-social-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* Apple Sign-in Button */
.jp-apple-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  background: #000000;
  border: 1.5px solid #000000;
  border-radius: 14px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  animation: jp-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.38s both;
}

.jp-apple-btn:hover {
  background: #1f1f1f;
  border-color: #1f1f1f;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
  color: #ffffff;
}

.jp-apple-btn:active {
  transform: translateY(0);
}

.jp-apple-icon {
  flex-shrink: 0;
  font-size: 20px;
  line-height: 1;
  transition: transform 0.25s ease;
}

.jp-apple-btn:hover .jp-apple-icon {
  transform: scale(1.08);
}

/* Responsive */
@media (max-width: 900px) {
  .jp-login-wrap {
    grid-template-columns: 1fr;
    max-width: 440px;
    min-height: auto;
    border-radius: 22px;
  }

  .jp-brand-side {
    padding: 36px 24px;
    min-height: auto;
  }

  .jp-brand-content .logo-link img {
    max-width: 150px;
  }

  .jp-ecommerce-visual {
    width: 130px;
    height: 130px;
    margin: 8px 0 20px;
  }

  .jp-ecommerce-icon {
    font-size: 48px;
  }

  .jp-badge {
    padding: 4px 8px;
    font-size: 10px;
  }

  .jp-badge-1 {
    right: -10px;
  }

  .jp-badge-2 {
    left: -12px;
  }

  .jp-form-side {
    padding: 36px 28px;
    border-left: none;
    border-top: 1px solid var(--jp-border);
  }

  .jp-form-title {
    font-size: 24px;
  }

  .jp-brand-side .jp-corner {
    display: none;
  }
}

@media (max-width: 480px) {
  body.jp-auth {
    padding: 14px;
  }

  .jp-brand-side,
  .jp-form-side {
    padding: 26px 18px;
  }

  .jp-form-title {
    font-size: 22px;
  }
}
