/**
 * @file
 * Styles for marketing protected pages.
 */

/* Hide page content completely on protected pages until unlocked */
body:not(.marketing-protected-page-unlocked) .region-content {
  display: none !important;
}

body:not(.marketing-protected-page-unlocked) #content article.full > div.content {
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Prevent scrolling when overlay is active */
body.marketing-protected-page-active {
  overflow: hidden;
  height: 100vh;
}

/* Show content when unlocked with fade-in animation */
body.marketing-protected-page-unlocked .region-content {
  display: block !important;
  animation: fadeInContent 0.5s ease;
}

body.marketing-protected-page-unlocked #content article.full > div.content {
  visibility: visible !important;
  opacity: 1 !important;
  animation: fadeInContent 0.5s ease;
}

@keyframes fadeInContent {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Full-screen overlay with blur effect */
#marketing-protected-page-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(57 64 52 / 94%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#marketing-protected-page-overlay.active {
  display: flex;
  opacity: 1;
}

/* Modal container */
.protected-page-modal {
  background: #fff;
  padding: 40px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
  position: relative;
  transform: scale(0.9);
  opacity: 0;
  animation: modalFadeIn 0.3s ease forwards;
}

/* Keep modal visible during success state */
#marketing-protected-page-overlay.success-mode .protected-page-modal {
  opacity: 1 !important;
  transform: scale(1) !important;
}

@keyframes modalFadeIn {
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Success state animation */
.protected-page-modal.success {
  animation: modalSuccess 0.5s ease forwards;
}

@keyframes modalSuccess {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* Modal media image */
.protected-page-media {
  margin-bottom: 24px;
}

.protected-page-media img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

/* Modal title */
.protected-page-modal h2 {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 16px 0;
  color: #333;
}

/* Modal description */
.protected-page-modal p {
  font-size: 16px;
  color: #666;
  margin: 0 0 32px 0;
  line-height: 1.5;
}

/* Form styling */
.protected-page-modal form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.protected-page-modal input[type="password"] {
  padding: 14px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.2s ease;
  outline: none;
}

.protected-page-modal input[type="password"]:focus {
  border-color: #007bff;
}

.protected-page-modal button[type="submit"]:active {
  transform: translateY(0);
}

.protected-page-modal button[type="submit"]:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Loading state for button */
.protected-page-modal button[type="submit"].loading::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

/* Error message */
.error-message {
  display: none;
  padding: 12px 16px;
  background: #fee;
  color: #c33;
  border: 1px solid #fcc;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* Redirect link */
.redirect-link-wrapper {
  margin-top: 20px;
  text-align: center;
}

.redirect-link {
  color: #666;
  font-size: 14px;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.redirect-link:hover {
  color: #333;
  text-decoration: underline;
}

/* Success wrapper */
.success-wrapper {
  text-align: center;
}

/* Success checkmark animation */
.success-checkmark {
  width: 50px;
  height: 50px;
  margin: 0 auto 20px;
  animation: checkmarkPop 0.5s ease;
}

/* Success message text */
.success-message {
  font-size: 16px;
  color: #333;
  margin: 0;
  line-height: 1.5;
}

@keyframes checkmarkPop {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

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

.checkmark-circle {
  stroke: #4CAF50;
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: checkmarkCircle 0.6s ease forwards;
}

@keyframes checkmarkCircle {
  to {
    stroke-dashoffset: 0;
  }
}

.checkmark-check {
  stroke: #4CAF50;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: checkmarkCheck 0.3s 0.3s ease forwards;
}

@keyframes checkmarkCheck {
  to {
    stroke-dashoffset: 0;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .protected-page-modal {
    padding: 32px 24px;
    max-width: 90%;
  }

  .protected-page-modal h2 {
    font-size: 24px;
  }

  .protected-page-modal p {
    font-size: 14px;
    margin-bottom: 24px;
  }
}
