:root {
  --ptt-border-radius: 10px;
  --ptt-button-size: 60px;
  --ptt-transition-speed: 0.3s;
  --ptt-primary-color: #6c757d;  /* Gray color for the buttons */
  --ptt-active-color: rgba(76, 175, 80, 0.8); /* Green color when active */
}

/* General Button Styles */
.custom-toggle-button,
.mic-button {
  width: var(--ptt-button-size);
  height: var(--ptt-button-size);
  border-radius: 50%;
  border: none;
  background-color: var(--ptt-primary-color);
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: background-color var(--ptt-transition-speed) ease, box-shadow var(--ptt-transition-speed) ease;
}

.custom-toggle-button.active,
.mic-button.active {
  background-color: var(--ptt-active-color);
  box-shadow: 0px 0px 20px rgba(76, 175, 80, 0.8);
}

/* Mic Button Specific Styles */
#micIcon {
  font-size: 24px;
  color: #fff;
}

.sound-bars {
  display: none;
  width: 100%;
  height: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}


.sound-bars .bar {
  width: 6px;
  background: linear-gradient(135deg, #f2f2f2, #ffffff); /* White gradient */
  border-radius: 10px; /* Rounded edges */
  transition: height 0.15s ease-in-out, background 0.3s ease-in-out; /* Smoother transition */
  box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2); /* Subtle shadow effect */
}


.mic-button.active .sound-bars {
  display: flex;
}

.mic-button.active #micIcon {
  display: none;
}



/* Pulse Circle Animation */
.pulse-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(22, 238, 29, 1);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  animation: pulse 1.5s infinite;
  pointer-events: none;
}

.custom-toggle-button.pulsing .pulse-circle {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
}

/* Push-to-Talk Container */
.push-to-talk-container {
  position: fixed;
  bottom: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  box-sizing: border-box;
  backdrop-filter: blur(10px); /* Add a blur effect to the background */
  background-color: rgba(255, 255, 255, 0.1); /* Slight transparency for a modern look */
}

/* Button Container */
.button-container {
  display: flex;
  gap: 10px; /* Space between buttons */
}

.push-to-talk-button {
  position: relative;
  width: 100%;
  max-width: 600px;
  height: 100px;
  padding: 15px;
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  border: 2px solid transparent;
  border-radius: var(--ptt-border-radius);
  font-size: 18px;
  text-align: center;
  cursor: pointer;
  outline: none;
  transition: background 0.3s, transform 0.1s, box-shadow 0.3s, border-color 0.3s;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.push-to-talk-button:active {
  background: linear-gradient(135deg, #0056b3, #003f7f);
  transform: scale(0.98);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.push-to-talk-button.listening .progress-bar {
  border-color: #28a745; /* Green color to indicate active listening */
  animation: listeningAnimation 1s linear infinite;
}

@keyframes listeningAnimation {
  0% {
    border-width: 4px;
    box-shadow: 0 0 10px #28a745;
  }
  50% {
    border-width: 8px;
    box-shadow: 0 0 20px #28a745;
  }
  100% {
    border-width: 4px;
    box-shadow: 0 0 10px #28a745;
  }
}

.push-to-talk-button .progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 4px solid transparent;
  border-radius: var(--ptt-border-radius);
  box-sizing: border-box;
  transition: border-color 0.3s;
}

.push-to-talk-button .button-label {
  z-index: 1;
  position: relative;
  font-weight: bold;
  font-family: 'Roboto', sans-serif;
}

.push-to-talk-button .button-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  font-size: 24px;
  color: white;
}

/* Mobile fullscreen push-to-talk visibility fixes */
@media (max-width: 768px) {
  /* Show push-to-talk in mobile fullscreen when exam is started */
  body.exam-started .push-to-talk-container:not(.d-none) {
    display: flex !important;
    z-index: 1050; /* Above other elements */
  }
  
  /* Ensure push-to-talk shows above slides in fullscreen */
  body.in-fullscreen .push-to-talk-container:not(.d-none) {
    display: flex !important;
    z-index: 1060; /* Higher than fullscreen elements */
  }
  
  /* Show in both chat and slide views on mobile */
  body.mobile-chat-view.ptt-active .push-to-talk-container:not(.d-none),
  body:not(.mobile-chat-view) .push-to-talk-container:not(.d-none) {
    display: flex !important;
  }
}

/* Active state feedback for push-to-talk button */
.push-to-talk-button:active,
.push-to-talk-button.recording {
  background: linear-gradient(135deg, #28a745, #1e7e34) !important;
  transform: scale(0.98);
  box-shadow: 0 0 20px rgba(40, 167, 69, 0.6);
}

.push-to-talk-button.recording .button-label {
  animation: pulse-text 1s ease-in-out infinite alternate;
}

@keyframes pulse-text {
  from { opacity: 0.8; }
  to { opacity: 1; }
}
