/* Access Modal Styles - WCAG 2.1 Compliant */

/* Modal Overlay */
.access-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.access-modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* Modal Container */
.modal-container {
  position: relative;
  background: linear-gradient(135deg, rgba(25, 27, 42, 0.98) 0%, rgba(13, 15, 24, 0.98) 100%);
  border: 1px solid rgba(116, 208, 198, 0.2);
  border-radius: 16px;
  padding: var(--space-xxl);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 10001;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.access-modal.active .modal-container {
  transform: scale(1);
}

/* Close Button */
.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: transparent;
  border: none;
  color: var(--color-white);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color var(--transition-base);
  z-index: 10002;
}

.modal-close:hover {
  background-color: rgba(116, 208, 198, 0.1);
}

.modal-close:focus {
  outline: 2px solid var(--color-teal);
  outline-offset: 2px;
}

.modal-close:focus:not(:focus-visible) {
  outline: none;
}

.modal-close:focus-visible {
  outline: 2px solid var(--color-teal);
  outline-offset: 2px;
}

/* Modal Content */
.modal-content {
  position: relative;
}

.modal-title {
  color: var(--color-white);
  font-size: 2rem;
  margin-bottom: var(--space-md);
  text-align: center;
}

.modal-description {
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--space-xl);
  line-height: 1.6;
  text-align: center;
}

.modal-description p {
  margin: 0;
}

/* Form Styles */
.access-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-group label {
  color: var(--color-white);
  font-weight: 500;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.required {
  color: var(--color-teal);
  font-weight: bold;
}

.optional {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  font-weight: normal;
}

.form-group input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background-color: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(116, 208, 198, 0.2);
  border-radius: 8px;
  color: var(--color-white);
  font-size: 1rem;
  font-family: var(--font-primary);
  transition: all var(--transition-base);
  min-height: 44px; /* WCAG touch target */
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-teal);
  background-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(116, 208, 198, 0.2);
}

.form-group input:focus:not(:focus-visible) {
  box-shadow: none;
}

.form-group input:focus-visible {
  outline: none;
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(116, 208, 198, 0.2);
}

.form-group input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.form-group input.error {
  border-color: #ff6b6b;
  background-color: rgba(255, 107, 107, 0.1);
}

.form-group input[aria-invalid="true"] {
  border-color: #ff6b6b;
}

.hint {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: calc(var(--space-xs) * -1);
}

.error-message {
  font-size: 0.85rem;
  color: #ff6b6b;
  margin-top: calc(var(--space-xs) * -1);
  min-height: 1.2em;
}

/* Form Actions */
.form-actions {
  margin-top: var(--space-md);
  display: flex;
  justify-content: center;
}

.btn-primary {
  background-color: var(--color-teal);
  color: var(--color-dark);
  padding: var(--space-sm) var(--space-xl);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  min-width: 200px;
  min-height: 44px; /* WCAG touch target */
}

.btn-primary:hover {
  background-color: var(--color-teal-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(116, 208, 198, 0.3);
}

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

.btn-primary:focus {
  outline: 2px solid var(--color-teal-light);
  outline-offset: 2px;
}

.btn-primary:focus:not(:focus-visible) {
  outline: none;
}

.btn-primary:focus-visible {
  outline: 2px solid var(--color-teal-light);
  outline-offset: 2px;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Form Status */
.form-status {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
  min-height: 1.5em;
}

.form-status.success {
  background-color: rgba(116, 208, 198, 0.2);
  color: var(--color-teal-light);
  border: 1px solid var(--color-teal);
}

.form-status.error {
  background-color: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
  border: 1px solid #ff6b6b;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
  .modal-container {
    padding: var(--space-xl) var(--space-lg);
    width: 95%;
    max-height: 95vh;
  }

  .modal-title {
    font-size: 1.5rem;
  }

  .modal-close {
    top: var(--space-sm);
    right: var(--space-sm);
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .access-modal,
  .modal-container,
  .form-group input,
  .btn-primary {
    transition: none;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .modal-container {
    border: 2px solid var(--color-white);
  }

  .form-group input {
    border: 2px solid var(--color-white);
  }

  .form-group input:focus {
    border: 3px solid var(--color-teal);
  }
}

/* Success Animation - 3D Star with Sparkles */
.success-animation {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10003;
  pointer-events: none;
  animation: floatIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes floatIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3) translateY(50px);
  }
  60% {
    transform: translate(-50%, -50%) scale(1.1) translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) translateY(0);
  }
}

/* 3D Star */
.star-3d {
  position: relative;
  width: 120px;
  height: 120px;
  transform-style: preserve-3d;
  animation: starRotate 3s ease-in-out infinite, starFloat 2s ease-in-out infinite;
  margin-bottom: var(--space-lg);
}

@keyframes starRotate {
  0%, 100% {
    transform: rotateY(0deg) rotateX(10deg);
  }
  50% {
    transform: rotateY(180deg) rotateX(-10deg);
  }
}

@keyframes starFloat {
  0%, 100% {
    transform: translateY(0) rotateY(0deg) rotateX(10deg);
  }
  50% {
    transform: translateY(-15px) rotateY(180deg) rotateX(-10deg);
  }
}

.star-face {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 40px solid transparent;
  border-right: 40px solid transparent;
  border-bottom: 28px solid var(--color-teal);
  transform-origin: center;
  filter: drop-shadow(0 0 10px rgba(116, 208, 198, 0.6));
}

.star-face::after {
  content: '';
  position: absolute;
  left: -40px;
  top: 28px;
  width: 0;
  height: 0;
  border-left: 40px solid transparent;
  border-right: 40px solid transparent;
  border-top: 28px solid var(--color-teal);
}

/* Star faces positioned in 3D space */
.star-front {
  transform: translateZ(20px);
}

.star-back {
  transform: translateZ(-20px) rotateY(180deg);
}

.star-top {
  transform: rotateX(90deg) translateZ(20px);
}

.star-bottom {
  transform: rotateX(-90deg) translateZ(20px);
}

.star-left {
  transform: rotateY(-90deg) translateZ(20px);
}

.star-right {
  transform: rotateY(90deg) translateZ(20px);
}

/* Sparkles */
.sparkle-container {
  position: absolute;
  width: 200px;
  height: 200px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--color-teal);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--color-teal), 0 0 20px var(--color-teal);
  animation: sparkleFloat 2s ease-in-out infinite;
}

.sparkle::before,
.sparkle::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 2px;
  background: var(--color-teal);
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  box-shadow: 0 0 5px var(--color-teal);
}

.sparkle::after {
  transform: translateY(-50%) rotate(90deg);
}

/* Sparkle positions and animations */
.sparkle-1 {
  top: 10%;
  left: 50%;
  animation-delay: 0s;
  animation-duration: 1.5s;
}

.sparkle-2 {
  top: 20%;
  right: 15%;
  animation-delay: 0.2s;
  animation-duration: 1.8s;
}

.sparkle-3 {
  bottom: 20%;
  right: 20%;
  animation-delay: 0.4s;
  animation-duration: 2s;
}

.sparkle-4 {
  bottom: 15%;
  left: 50%;
  animation-delay: 0.1s;
  animation-duration: 1.7s;
}

.sparkle-5 {
  bottom: 25%;
  left: 15%;
  animation-delay: 0.3s;
  animation-duration: 1.9s;
}

.sparkle-6 {
  top: 30%;
  left: 10%;
  animation-delay: 0.5s;
  animation-duration: 1.6s;
}

.sparkle-7 {
  top: 50%;
  right: 5%;
  animation-delay: 0.15s;
  animation-duration: 2.1s;
}

.sparkle-8 {
  top: 60%;
  left: 5%;
  animation-delay: 0.35s;
  animation-duration: 1.8s;
}

@keyframes sparkleFloat {
  0%, 100% {
    opacity: 0.3;
    transform: translate(0, 0) scale(0.8);
  }
  50% {
    opacity: 1;
    transform: translate(10px, -10px) scale(1.2);
  }
}

/* Success Message */
.success-message {
  text-align: center;
  margin-top: var(--space-lg);
  animation: messageFadeIn 0.6s ease-out 0.4s both;
}

@keyframes messageFadeIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.success-text {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-teal);
  margin: 0 0 var(--space-xs) 0;
  text-shadow: 0 0 20px rgba(116, 208, 198, 0.5);
  animation: textPulse 2s ease-in-out infinite;
}

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

.success-subtext {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  font-weight: 500;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .success-animation,
  .star-3d,
  .sparkle,
  .success-text,
  .success-message {
    animation: none;
  }
  
  .star-3d {
    transform: rotateY(45deg);
  }
  
  .sparkle {
    opacity: 0.8;
  }
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
  .star-3d {
    width: 80px;
    height: 80px;
  }
  
  .star-face {
    border-left-width: 26px;
    border-right-width: 26px;
    border-bottom-width: 18px;
  }
  
  .star-face::after {
    left: -26px;
    top: 18px;
    border-left-width: 26px;
    border-right-width: 26px;
    border-top-width: 18px;
  }
  
  .success-text {
    font-size: 1.5rem;
  }
  
  .success-subtext {
    font-size: 1rem;
  }
  
  .sparkle-container {
    width: 150px;
    height: 150px;
  }
}

