/**
 * Styles for Cloudflare Turnstile integration
 * Added to existing contact-form.css
 */

/* Turnstile error message styling */
#turnstile-error {
  color: #ff4444;
  font-family: 'Share Tech Mono', monospace;
  text-align: center;
  padding: 10px;
  margin: 15px 0;
  border: 1px solid #ff4444;
  background-color: rgba(255, 68, 68, 0.1);
  position: relative;
  overflow: hidden;
  letter-spacing: 1px;
  animation: errorPulse 2s infinite;
}

#turnstile-error:before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 68, 68, 0.2),
    transparent
  );
  animation: errorShine 3s infinite;
}

#turnstile-error.glitch-text {
  animation: errorGlitch 0.5s infinite;
}

/* Button states */
.form-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  position: relative;
  display: flex !important; /* Force display even when disabled */
  visibility: visible !important; /* Ensure button is visible */
  background: rgba(0, 0, 0, 0.6);
  color: rgba(0, 255, 255, 0.4);
  border: 2px dashed var(--glitch-color1);
  text-shadow: none;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.form-btn:disabled::after {
  content: "VERIFY";
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8em;
  color: var(--glitch-color1);
  white-space: nowrap;
  text-shadow: 0 0 3px var(--glitch-color1);
  animation: text-flicker 2s infinite;
}

.form-btn.waiting-verification {
  border-color: var(--glitch-color1);
  color: rgba(0, 255, 255, 0.6);
  animation: pulse 2s infinite alternate;
  background: rgba(0, 0, 0, 0.6);
}

.form-btn.ready {
  border-color: var(--glitch-color1);
  color: var(--glitch-color1);
  background-color: transparent;
  box-shadow: 0 0 8px var(--glitch-color1);
  animation: pulse 2s infinite alternate;
}

/* Sound icon and waves */
.form-btn .sound-icon {
  display: flex;
  align-items: center;
  margin-right: 10px;
  position: relative;
  width: 20px;
  height: 20px;
}

.form-btn .sound-wave {
  position: absolute;
  background: #ffffff; /* Pure white for sound waves */
  width: 3px;
  height: 100%;
  left: 0;
  animation: sound-wave 1.5s infinite;
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.8); /* Add glow to sound waves */
}

.form-btn .sound-wave:nth-child(2) {
  left: 8px;
  animation-delay: 0.2s;
}

.form-btn .sound-wave:nth-child(3) {
  left: 16px;
  animation-delay: 0.4s;
}

.form-btn.ready .sound-wave {
  background: #ffffff; /* Keep white in ready state */
  box-shadow: 0 0 8px rgba(255, 255, 255, 1); /* Stronger glow in ready state */
}

.form-btn .sound-label {
  font-family: 'Share Tech Mono', monospace;
  color: #ffffff; /* Pure white text */
  font-size: 0.9rem;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.9); /* Stronger white glow */
  letter-spacing: 1px;
}

.form-btn.ready .sound-label {
  color: #ffffff; /* Keep white in ready state */
  text-shadow: 0 0 10px rgba(255, 255, 255, 1); /* Even stronger glow when ready */
  font-weight: bold; /* Make text bolder when ready */
}

/* Disabled state for sound waves */
.form-btn:disabled .sound-wave {
  background: rgba(0, 255, 255, 0.3);
  animation: none;
  height: 30%;
}

.form-btn:disabled .sound-label {
  color: rgba(0, 255, 255, 0.4);
  text-shadow: none;
}

@keyframes sound-wave {
  0% { height: 20%; }
  50% { height: 100%; }
  100% { height: 20%; }
}

/* Custom styles for Turnstile widget */
.cf-turnstile {
  margin: 20px auto;
  display: flex;
  justify-content: center;
}

/* Make widget fit better in cyberpunk theme */
.cf-turnstile iframe {
  border: 1px solid var(--glitch-color1) !important;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

/* Animations */
@keyframes errorGlitch {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(2px, -2px); }
  100% { transform: translate(0); }
}

@keyframes errorPulse {
  0% { box-shadow: 0 0 0 rgba(255, 68, 68, 0.4); }
  50% { box-shadow: 0 0 10px rgba(255, 68, 68, 0.7); }
  100% { box-shadow: 0 0 0 rgba(255, 68, 68, 0.4); }
}

@keyframes errorShine {
  0% { left: -100%; }
  20% { left: 100%; }
  100% { left: 100%; }
}

/* Center the submit button and apply sound button style */
.form-group.text-center {
  text-align: center;
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

/* Sound button style for submit button */
.form-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  border: 3px solid #ffffff; /* Brighter white border */
  padding: 10px 20px;
  border-radius: 2px;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.8); /* Stronger white glow */
  transition: all 0.3s;
  animation: pulse-bright 2s infinite alternate;
  min-width: 220px;
  text-align: center;
  margin: 0 auto;
  font-family: 'Share Tech Mono', monospace;
  color: #ffffff; /* Pure white text */
  font-size: 1.1rem;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.9); /* Stronger white text glow */
  letter-spacing: 1px;
  text-transform: uppercase;
  position: relative;
}

/* Sound wave elements for the button */
.form-btn::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-left: 10px;
  position: relative;
}

/* Hover effect */
.form-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(255, 255, 255, 1); /* Intense white glow on hover */
  border-color: #ffffff;
  background: rgba(30, 30, 30, 0.8); /* Slightly lighter background on hover */
}

/* Active state (ready) */
.form-btn.ready {
  border-color: #ffffff;
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.9);
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 1);
  background: rgba(20, 20, 20, 0.9); /* Darker background to make white text pop */
  animation: pulse-bright 1.5s infinite alternate;
}

@keyframes text-flicker {
  0% { opacity: 1; }
  10% { opacity: 0.8; }
  20% { opacity: 1; }
  30% { opacity: 0.8; }
  40% { opacity: 1; }
  100% { opacity: 1; }
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* Brighter pulsing animation for the submit button */
@keyframes pulse-bright {
  0% { 
    opacity: 1;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
  }
  50% { 
    opacity: 0.95;
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.9);
  }
  100% { 
    opacity: 1;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
  }
}

/* Media query adjustments */
@media (max-width: 768px) {
  .cf-turnstile {
    transform: scale(0.9);
    transform-origin: center;
  }
}