/* Material Design Ripple Effect */
.ripple {
  position: relative;
  overflow: hidden;
  transform: translate3d(0, 0, 0);
}

.ripple:after {
  content: "";
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, #000 10%, transparent 10.01%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10, 10);
  opacity: 0;
  transition: transform .5s, opacity 1s;
}

.ripple:active:after {
  transform: scale(0, 0);
  opacity: .2;
  transition: 0s;
}

/* Ripple effect for different button types */
button.ripple,
.btn.ripple,
.button.ripple,
input[type="button"].ripple,
input[type="submit"].ripple,
a.btn.ripple {
  position: relative;
  overflow: hidden;
  transform: translate3d(0, 0, 0);
}

/* Dynamic ripple effect container */
.ripple-container {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.ripple-effect {
  position: absolute;
  border-radius: 50%;
  width: 0;
  height: 0;
  opacity: 1;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: ripple-animation 0.6s ease-out;
}

/* Dark theme ripple */
.ripple-dark .ripple-effect {
  background: rgba(0, 0, 0, 0.3);
}

/* Light theme ripple */
.ripple-light .ripple-effect {
  background: rgba(255, 255, 255, 0.5);
}

/* Custom color ripples */
.ripple-primary .ripple-effect {
  background: rgba(74, 55, 73, 0.3);
}

.ripple-success .ripple-effect {
  background: rgba(55, 183, 175, 0.3);
}

.ripple-info .ripple-effect {
  background: rgba(103, 152, 255, 0.3);
}

.ripple-warning .ripple-effect {
  background: rgba(255, 152, 56, 0.3);
}

.ripple-danger .ripple-effect {
  background: rgba(255, 67, 54, 0.3);
}

/* Ripple animation */
@keyframes ripple-animation {
  from {
    width: 0;
    height: 0;
    opacity: 0.5;
  }
  to {
    width: 500px;
    height: 500px;
    opacity: 0;
  }
}

/* Ensure buttons maintain their original styles */
.ripple:focus {
  outline: none;
}

/* Prevent text selection during ripple */
.ripple {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Specific button adjustments */
.btn.ripple,
.button.ripple {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

/* Fix for buttons with icons */
.ripple > * {
  position: relative;
  z-index: 2;
}

/* Support for disabled buttons */
.ripple:disabled,
.ripple.disabled {
  cursor: not-allowed;
}

.ripple:disabled .ripple-effect,
.ripple.disabled .ripple-effect {
  display: none;
}