/* Enhanced Glass Button Effects - Non-uniform Highlight Border */

button#contact, 
button {
  /* Base glassmorphism with enhanced rim light */
  position: relative !important;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif !important;
  margin: 32px auto 0 !important;
  padding: 18px 45px !important; /* Горизонтальные поля в 2.5 раза больше вертикальных */
  border-radius: 999px !important;
  border: none !important; /* Removed solid border */
  background: rgba(255, 255, 255, 0.08) !important;
  color: white !important;
  cursor: pointer !important;
  font-size: 1rem !important;
  font-weight: 400 !important;
  letter-spacing: 0.02em !important;
  pointer-events: auto !important;
  display: block !important;
  width: 300px !important; /* Примерно равна длине подтекста "Снова отложите на год?" */
  height: 54px !important; /* В 3.4 раза больше высоты шрифта (16px * 3.4) */
  
  /* Base glassmorphism */
  backdrop-filter: blur(25px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(25px) saturate(200%) !important;
  box-shadow: 
    0 12px 40px rgba(31, 38, 135, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(255, 255, 255, 0.2) !important;
  
  /* Enhanced rim light with non-uniform gradient */
  box-shadow: 
    0 12px 40px rgba(31, 38, 135, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6),
    inset 2px 2px 8px rgba(255, 255, 255, 0.3),
    inset -2px -2px 8px rgba(255, 255, 255, 0.15) !important;
  
  /* Soft inner glow */
  background-image: 
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.1) 0%, transparent 60%) !important;
  
  /* Smooth transitions */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Enhanced non-uniform border effect with gradient highlight */
button#contact::before,
button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(to bottom, 
    rgba(255, 255, 255, 0.95) 0%,    /* Very bright at top */
    rgba(255, 255, 255, 0.7) 10%,    /* Bright */
    rgba(255, 255, 255, 0.4) 20%,    /* Medium bright */
    rgba(255, 255, 255, 0.2) 30%,    /* Light */
    rgba(255, 255, 255, 0.05) 40%,   /* Very light */
    rgba(255, 255, 255, 0.02) 50%,   /* Minimal */
    rgba(255, 255, 255, 0) 60%,      /* Transparent */
    rgba(255, 255, 255, 0.05) 75%,   /* Slight return */
    rgba(255, 255, 255, 0.2) 85%,    /* Light return */
    rgba(255, 255, 255, 0.6) 95%,    /* Bright return */
    rgba(255, 255, 255, 0.9) 100%    /* Very bright at bottom */
  );
  -webkit-mask: 
    linear-gradient(#fff 0 0) content-box, 
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: rimShimmer 3s ease-in-out infinite;
  pointer-events: none;
}

/* Inner glow effect for more depth */
button#contact::after,
button::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(to bottom,
    rgba(255, 255, 255, 0.3) 0%,     /* Top inner glow */
    rgba(255, 255, 255, 0.1) 20%,    /* Light inner glow */
    rgba(255, 255, 255, 0.05) 40%,   /* Minimal inner glow */
    rgba(255, 255, 255, 0) 60%,      /* Transparent middle */
    rgba(255, 255, 255, 0.1) 80%,    /* Light return */
    rgba(255, 255, 255, 0.4) 100%    /* Bottom inner glow */
  );
  -webkit-mask: 
    linear-gradient(#fff 0 0) content-box, 
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: -1;
}

/* Rim light shimmer animation */
@keyframes rimShimmer {
  0%, 100% {
    opacity: 0.8;
    background-position: 0% 0%;
  }
  50% {
    opacity: 1;
    background-position: 100% 100%;
  }
}

/* Hover state - enhanced glow */
button#contact:hover,
button:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.7) !important;
  
  /* Enhanced rim light */
  box-shadow: 
    0 15px 50px rgba(31, 38, 135, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.8),
    inset 3px 3px 12px rgba(255, 255, 255, 0.4),
    inset -3px -3px 12px rgba(255, 255, 255, 0.2) !important;
  
  /* Subtle lift */
  transform: translateY(-1px) !important;
}

/* Active state - Flash + Jelly Effect */
button#contact:active,
button:active {
  /* Flash/brightness surge */
  background: rgba(255, 255, 255, 0.2) !important;
  border-color: rgba(255, 255, 255, 0.9) !important;
  
  /* Intense rim light flash */
  box-shadow: 
    0 8px 30px rgba(31, 38, 135, 0.5),
    inset 0 0 0 2px rgba(255, 255, 255, 1),
    inset 4px 4px 15px rgba(255, 255, 255, 0.6),
    inset -4px -4px 15px rgba(255, 255, 255, 0.3) !important;
  
  /* Jelly squash and stretch effect */
  transform: scaleX(1.05) scaleY(0.95) translateY(1px) !important;
  
  /* Motion blur for jelly effect */
  filter: blur(0.5px);
  
  /* Trigger jelly animation */
  animation: jellyWobble 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Jelly wobble animation - overshoot and bounce */
@keyframes jellyWobble {
  0% {
    transform: scaleX(1.05) scaleY(0.95) translateY(1px);
    filter: blur(0.5px);
  }
  15% {
    transform: scaleX(0.92) scaleY(1.08) translateY(-2px);
    filter: blur(1px);
  }
  30% {
    transform: scaleX(1.08) scaleY(0.92) translateY(1px);
    filter: blur(0.3px);
  }
  50% {
    transform: scaleX(0.96) scaleY(1.04) translateY(-1px);
    filter: blur(0.8px);
  }
  70% {
    transform: scaleX(1.02) scaleY(0.98) translateY(0px);
    filter: blur(0.2px);
  }
  100% {
    transform: scaleX(1) scaleY(1) translateY(0px);
    filter: blur(0px);
  }
}

/* Press down effect - deeper compression */
button#contact:active::after,
button:active::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0.8);
  animation: flashPulse 0.3s ease-out;
  pointer-events: none;
  border-radius: inherit;
}

/* Flash pulse animation */
@keyframes flashPulse {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.5);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
  }
}

/* Continuous subtle breathing effect */
button#contact,
button {
  animation: breathing 4s ease-in-out infinite;
}

@keyframes breathing {
  0%, 100% {
    box-shadow: 
      0 12px 40px rgba(31, 38, 135, 0.3),
      inset 0 0 0 1px rgba(255, 255, 255, 0.6),
      inset 2px 2px 8px rgba(255, 255, 255, 0.3),
      inset -2px -2px 8px rgba(255, 255, 255, 0.15);
  }
  50% {
    box-shadow: 
      0 15px 45px rgba(31, 38, 135, 0.35),
      inset 0 0 0 1px rgba(255, 255, 255, 0.7),
      inset 2px 2px 10px rgba(255, 255, 255, 0.35),
      inset -2px -2px 10px rgba(255, 255, 255, 0.2);
  }
}

/* Text styling for better readability */
button#contact span,
button span {
  position: relative;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  font-weight: 500;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  button#contact,
  button {
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  }
  
  button#contact:active,
  button:active {
    animation-duration: 0.4s; /* Faster on mobile */
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  button#contact,
  button {
    border-color: rgba(255, 255, 255, 0.8) !important;
    box-shadow: 
      0 12px 40px rgba(31, 38, 135, 0.5),
      inset 0 0 0 2px rgba(255, 255, 255, 0.9) !important;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  button#contact,
  button {
    animation: none !important;
  }
  
  button#contact:active,
  button:active {
    animation: none !important;
    transform: scale(0.95) !important;
  }
}