/* PDF download modal & trigger */
.pdf-fab {
  position: fixed;
  right: max(2.4rem, var(--safe-right));
  bottom: max(2.4rem, var(--safe-bottom));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 2rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(14px);
  color: var(--color-brand-black);
  font-size: 1.6rem;
  box-shadow: 0 12px 40px rgba(41, 52, 90, 0.15);
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
  cursor: pointer;
}

.pdf-fab:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 50px rgba(41, 52, 90, 0.2);
}

.pdf-fab svg {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
}

.pdf-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(2rem, var(--safe-top)) max(2rem, var(--safe-right)) max(2rem, var(--safe-bottom))
    max(2rem, var(--safe-left));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.pdf-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.pdf-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 17, 37, 0.55);
  backdrop-filter: blur(8px);
}

.pdf-modal__panel {
  position: relative;
  width: 100%;
  max-width: 52rem;
  max-height: min(90vh, 90dvh);
  overflow-y: auto;
  padding: 3.6rem;
  border-radius: 2.4rem;
  background: linear-gradient(145deg, #f8f6ff 0%, #e8e4f8 100%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 32px 80px rgba(41, 52, 90, 0.25);
}

.pdf-modal__close {
  position: absolute;
  top: 1.6rem;
  right: 1.6rem;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(41, 52, 90, 0.1);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-brand-black);
}

.pdf-modal__title {
  font-size: 2.6rem;
  letter-spacing: -0.02em;
  color: var(--color-brand-black);
  margin-bottom: 0.8rem;
}

.pdf-modal__sub {
  font-size: 1.5rem;
  color: rgba(41, 52, 90, 0.75);
  margin-bottom: 2.4rem;
  line-height: 1.5;
}

.pdf-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pdf-option {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  width: 100%;
  text-align: left;
  padding: 1.6rem 2rem;
  border-radius: 1.6rem;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}

.pdf-option:hover {
  background: rgba(255, 255, 255, 0.75);
  transform: translateX(4px);
  border-color: var(--color-brand-blue-500);
}

.pdf-option img {
  height: 3.6rem;
  width: auto;
  object-fit: contain;
}

.pdf-option__text strong {
  display: block;
  font-size: 1.7rem;
  color: var(--color-brand-black);
  margin-bottom: 0.3rem;
}

.pdf-option__text span {
  font-size: 1.35rem;
  color: rgba(41, 52, 90, 0.7);
}

.pdf-step-email {
  display: none;
}

.pdf-modal[data-step="email"] .pdf-step-choose {
  display: none;
}

.pdf-modal[data-step="email"] .pdf-step-email {
  display: block;
}

.pdf-email-form label {
  display: block;
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-brand-blue-500);
  margin-bottom: 0.8rem;
}

.pdf-email-form input {
  width: 100%;
  padding: 1.4rem 1.6rem;
  font-size: 1.7rem;
  font-family: inherit;
  border-radius: 1.2rem;
  border: 1px solid rgba(41, 52, 90, 0.15);
  background: #fff;
  color: var(--color-brand-black);
  margin-bottom: 1.6rem;
}

.pdf-email-form input:focus {
  outline: 2px solid var(--color-brand-blue-500);
  outline-offset: 2px;
}

.pdf-email-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.pdf-btn {
  padding: 1.2rem 2.4rem;
  font-size: 1.5rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.pdf-btn--primary {
  background: var(--color-brand-blue-500);
  color: #fff;
}

.pdf-btn--primary:hover:not(:disabled) {
  transform: translateY(-2px);
}

.pdf-btn--primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.pdf-btn--ghost {
  background: transparent;
  border-color: rgba(41, 52, 90, 0.2);
  color: var(--color-brand-black);
}

.pdf-status {
  margin-top: 1.2rem;
  font-size: 1.4rem;
  min-height: 2rem;
}

.pdf-status.is-error {
  color: #8b1a1a;
}

.pdf-status.is-success {
  color: var(--color-brand-blue-500);
}

.pdf-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1.6rem;
  background: rgba(196, 197, 241, 0.92);
  backdrop-filter: blur(12px);
}

.pdf-loading-overlay.is-active {
  display: flex;
}

.pdf-loading-overlay p {
  font-size: 1.8rem;
  color: var(--color-brand-black);
}

.pdf-spinner {
  width: 4rem;
  height: 4rem;
  border: 3px solid rgba(41, 52, 90, 0.15);
  border-top-color: var(--color-brand-blue-500);
  border-radius: 50%;
  animation: pdfSpin 0.8s linear infinite;
}

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

.pdf-option--both .pdf-option__text {
  padding-left: 0;
}

@media (max-width: 767px) {
  .pdf-fab {
    right: max(1.6rem, var(--safe-right));
    bottom: max(1.6rem, var(--safe-bottom));
    padding: 1rem 1.4rem;
    font-size: 1.4rem;
  }

  .pdf-modal {
    align-items: flex-end;
    padding: 0;
  }

  .pdf-modal__panel {
    width: 100%;
    max-height: min(92vh, 92dvh);
    border-radius: 2.4rem 2.4rem 0 0;
    padding: 2.8rem 2rem calc(2.4rem + var(--safe-bottom));
    margin-bottom: 0;
  }

  .pdf-modal__title {
    font-size: 2.2rem;
    padding-right: 3rem;
  }

  .pdf-modal__sub {
    font-size: 1.4rem;
  }

  .pdf-option {
    padding: 1.4rem 1.4rem;
    gap: 1rem;
  }

  .pdf-option img {
    height: 3rem;
  }

  .pdf-option__text strong {
    font-size: 1.55rem;
  }

  .pdf-email-actions {
    flex-direction: column;
  }

  .pdf-email-actions .pdf-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 479px) {
  .pdf-modal__panel {
    padding: 2.4rem 1.6rem calc(2rem + var(--safe-bottom));
  }

  .pdf-modal__close {
    top: max(1.2rem, var(--safe-top));
    right: max(1.2rem, var(--safe-right));
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .pdf-modal__panel {
    max-width: 48rem;
    padding: 3rem 2.8rem;
  }
}

@media (min-width: 1024px) {
  .pdf-fab {
    right: max(2.8rem, var(--safe-right));
    bottom: max(2.8rem, var(--safe-bottom));
  }
}
