/**
 * MedAudPro login modal — fly-up sheet, restrained glass.
 */

.mp-login {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  visibility: hidden;
}

.mp-login.is-open,
.mp-login:target {
  pointer-events: auto;
  visibility: visible;
}

body:has(.mp-login.is-open),
body:has(.mp-login:target),
body.mp-login-open {
  overflow: hidden;
}

.mp-login__overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 31, 70, 0.34);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  backdrop-filter: blur(12px) saturate(130%);
  opacity: 0;
  transition: opacity 0.2s ease;
  transform: translate3d(0, 0, 0);
}

.mp-login.is-open .mp-login__overlay,
.mp-login:target .mp-login__overlay {
  opacity: 1;
}

.mp-login__sheet {
  position: relative;
  width: min(480px, 100%);
  max-height: min(92vh, 720px);
  margin: 0;
  padding: 28px 28px 32px;
  border-radius: 24px 24px 0 0;
  background: #fff;
  box-shadow:
    0 -16px 48px rgba(7, 31, 70, 0.12),
    0 0 0 1px rgba(23, 37, 79, 0.06);
  overflow: hidden;
  transform: translate3d(0, 100%, 0);
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

@media (min-width: 560px) {
  .mp-login {
    align-items: center;
    padding: 24px;
  }

  .mp-login__sheet {
    border-radius: 20px;
    transform: translate3d(0, 20px, 0);
    opacity: 0;
    transition:
      transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.22s ease;
  }

  .mp-login.is-open .mp-login__sheet,
  .mp-login:target .mp-login__sheet {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

.mp-login.is-open .mp-login__sheet,
.mp-login:target .mp-login__sheet {
  transform: translate3d(0, 0, 0);
}

.mp-login__accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(47, 120, 189, 0.45) 50%,
    transparent 100%
  );
  opacity: 0.7;
  pointer-events: none;
}

.mp-login__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(23, 37, 79, 0.06);
  cursor: pointer;
  transition: background 0.16s ease;
}

.mp-login__close:hover {
  background: rgba(23, 37, 79, 0.1);
}

.mp-login__close span {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
}

.mp-login__close span::before,
.mp-login__close span::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 1.5px;
  background: var(--mp-navy);
  transform-origin: center;
}

.mp-login__close span::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.mp-login__close span::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.mp-login__header {
  position: relative;
  z-index: 1;
  margin-bottom: 24px;
  text-align: center;
}

.mp-login__brand {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.mp-login__brand .mp-brand__image {
  height: 48px;
  max-width: 240px;
}

.mp-login__title {
  margin: 0 0 6px;
  color: var(--mp-navy);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.mp-login__desc {
  margin: 0;
  color: var(--mp-muted);
  font-size: 14px;
  line-height: 1.5;
}

.mp-login__form {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
}

.mp-login__field {
  opacity: 0;
  transform: translate3d(0, 8px, 0);
  transition:
    opacity 0.24s ease,
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.mp-login.is-open .mp-login__field:nth-child(1),
.mp-login:target .mp-login__field:nth-child(1) {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition-delay: 0.04s;
}

.mp-login.is-open .mp-login__field:nth-child(2),
.mp-login:target .mp-login__field:nth-child(2) {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition-delay: 0.08s;
}

.mp-login__row,
.mp-login__message,
.mp-login__submit {
  opacity: 0;
  transform: translate3d(0, 8px, 0);
  transition:
    opacity 0.24s ease,
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.mp-login.is-open .mp-login__row,
.mp-login:target .mp-login__row {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition-delay: 0.12s;
}

.mp-login.is-open .mp-login__message:not([hidden]),
.mp-login:target .mp-login__message:not([hidden]) {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.mp-login.is-open .mp-login__submit,
.mp-login:target .mp-login__submit {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition-delay: 0.16s;
}

.mp-login__label {
  display: block;
  margin-bottom: 6px;
  color: var(--mp-navy);
  font-size: 13px;
  font-weight: 600;
}

.mp-login__input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--mp-border);
  border-radius: 12px;
  background: #fff;
  color: var(--mp-ink);
  font-size: 16px;
  line-height: 1.4;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.mp-login__input:focus {
  outline: none;
  border-color: var(--mp-blue);
  box-shadow: 0 0 0 3px rgba(47, 120, 189, 0.14);
}

.mp-login__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.mp-login__remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--mp-muted);
  font-size: 13px;
  cursor: pointer;
}

.mp-login__remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--mp-blue);
}

.mp-login__forgot {
  color: var(--mp-blue);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.mp-login__forgot:hover {
  text-decoration: underline;
}

.mp-login__message {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(220, 38, 38, 0.08);
  color: #b42318;
  font-size: 13px;
  line-height: 1.45;
}

.mp-login__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  padding: 0 18px;
  border: none;
  border-radius: 999px;
  background: var(--mp-blue);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(47, 120, 189, 0.22);
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.mp-login__submit:hover:not(:disabled) {
  background: #286ba8;
  box-shadow: 0 8px 24px rgba(47, 120, 189, 0.28);
}

.mp-login__submit:disabled {
  opacity: 0.72;
  cursor: wait;
}

/* Success state */
.mp-login__success {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 28px 32px;
  text-align: center;
  opacity: 0;
  transform: translate3d(0, 10px, 0);
  pointer-events: none;
  transition:
    opacity 0.32s ease 0.08s,
    transform 0.36s cubic-bezier(0.22, 1, 0.36, 1) 0.08s;
}

.mp-login__success[hidden] {
  display: none !important;
}

.mp-login__sheet.is-success .mp-login__header,
.mp-login__sheet.is-success .mp-login__form {
  opacity: 0;
  transform: translate3d(0, -6px, 0);
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    transform 0.24s ease;
}

.mp-login__sheet.is-success .mp-login__success {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.mp-login__sheet.is-success .mp-login__close {
  opacity: 0;
  pointer-events: none;
}

.mp-login__sheet.is-success .mp-login__accent {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(22, 163, 74, 0.55) 50%,
    transparent 100%
  );
  opacity: 1;
}

.mp-login__success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: rgba(22, 163, 74, 0.1);
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.12);
}

.mp-login__success-ring {
  display: block;
}

.mp-login__success-circle {
  stroke: rgba(22, 163, 74, 0.35);
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  transform-origin: center;
  transform: rotate(-90deg);
}

.mp-login__success-check {
  stroke: #16a34a;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
}

.mp-login__sheet.is-success .mp-login__success-circle {
  animation: mp-login-ring-draw 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.mp-login__sheet.is-success .mp-login__success-check {
  animation: mp-login-check-draw 0.38s cubic-bezier(0.22, 1, 0.36, 1) 0.28s forwards;
}

@keyframes mp-login-ring-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes mp-login-check-draw {
  to {
    stroke-dashoffset: 0;
  }
}

.mp-login__success-title {
  margin: 0;
  color: var(--mp-navy);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.mp-login__success-desc {
  margin: 0;
  color: var(--mp-muted);
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .mp-login__overlay,
  .mp-login__sheet,
  .mp-login__field,
  .mp-login__row,
  .mp-login__submit {
    transition: none;
    transform: none;
    opacity: 1;
  }

  .mp-login__success-circle,
  .mp-login__success-check {
    animation: none;
    stroke-dashoffset: 0;
  }
}
