.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.auth-modal.open {
  opacity: 1;
  visibility: visible;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 32, 25, 0.45);
  backdrop-filter: blur(6px);
}

.auth-dialog {
  position: relative;
  width: min(100%, 420px);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 2rem 1.75rem 1.75rem;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(24px);
  box-shadow:
    0 24px 60px rgba(16, 32, 25, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: translateY(18px) scale(0.97);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-modal.open .auth-dialog {
  transform: translateY(0) scale(1);
}

.auth-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  color: #4d5c55;
  transition: background 0.2s ease, transform 0.2s ease;
}

.auth-close svg {
  width: 18px;
  height: 18px;
}

.auth-close:hover {
  background: #fff;
  transform: rotate(90deg);
}

.auth-title {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  letter-spacing: -0.03em;
}

.auth-subtitle {
  margin: 0 0 1.5rem;
  color: #66756d;
  font-size: 0.92rem;
}

.auth-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid #e3ece7;
  border-radius: 14px;
  background: #fff;
  color: #1c2421;
  font-weight: 600;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.auth-google svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.auth-google:hover {
  border-color: #c8d9cf;
  box-shadow: 0 8px 24px rgba(28, 36, 33, 0.08);
  transform: translateY(-1px);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0;
  color: #8a978f;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #dbe8e0, transparent);
}

.auth-form {
  display: grid;
  gap: 0.35rem;
}

.auth-field {
  margin-bottom: 0.5rem;
  transition: opacity 0.35s ease, max-height 0.35s ease, margin 0.35s ease;
}

.auth-field-signup {
  max-height: 90px;
  opacity: 1;
  overflow: hidden;
}

.auth-modal[data-mode="login"] .auth-field-signup {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  pointer-events: none;
}

.field-wrap {
  position: relative;
}

.field-wrap input {
  width: 100%;
  padding: 1.15rem 2.75rem 0.55rem 1rem;
  border: 1.5px solid #e3ece7;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
  color: #1c2421;
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field-wrap label {
  position: absolute;
  left: 1rem;
  top: 50%;
  color: #8a978f;
  font-size: 0.95rem;
  pointer-events: none;
  transform: translateY(-50%);
  transition: top 0.2s ease, font-size 0.2s ease, color 0.2s ease;
}

.field-wrap input:focus,
.field-wrap input:not(:placeholder-shown) {
  outline: none;
  border-color: #3cb179;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(60, 177, 121, 0.12);
}

.field-wrap input:focus + label,
.field-wrap input:not(:placeholder-shown) + label {
  top: 0.65rem;
  font-size: 0.72rem;
  color: #3cb179;
  transform: translateY(0);
}

.field-wrap input.is-valid {
  border-color: #3cb179;
  padding-right: 2.75rem;
}

.field-wrap input.is-invalid {
  border-color: #e05252;
  box-shadow: 0 0 0 4px rgba(224, 82, 82, 0.1);
}

.field-wrap input.is-invalid + label {
  color: #c73838;
}

.field-icon {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%) scale(0.6);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.field-icon-success {
  width: 22px;
  height: 22px;
  color: #3cb179;
}

.field-icon-success svg {
  width: 100%;
  height: 100%;
}

.field-wrap input.is-valid ~ .field-icon-success {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.field-error {
  min-height: 1.15rem;
  margin: 0.35rem 0 0;
  padding-left: 0.25rem;
  color: #c73838;
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.field-error.visible {
  opacity: 1;
  transform: translateY(0);
}

.auth-submit {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.95rem 1rem;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #3cb179, #2d9663);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(60, 177, 121, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(60, 177, 121, 0.32);
}

.auth-toggle {
  margin: 1.35rem 0 0;
  text-align: center;
  color: #66756d;
  font-size: 0.9rem;
}

.auth-toggle-btn {
  margin-left: 0.35rem;
  padding: 0;
  border: 0;
  background: none;
  color: #2d9663;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.2s ease;
}

.auth-toggle-btn:hover {
  color: #1f4d3a;
  text-decoration: underline;
}

.auth-content {
  animation: authFadeIn 0.45s ease;
}

@keyframes authFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  .auth-dialog {
    padding: 1.75rem 1.25rem 1.25rem;
    border-radius: 20px;
  }

  .auth-title {
    font-size: 1.4rem;
  }
}
