/* ============================================
   CONTROLS
   Speed, EMP, and unified control widgets
   ============================================ */

/* Speed Control Widget */
.speed-control-widget {
  position: absolute;
  opacity: 0.8;
  display: flex;
  flex-direction: row;
  gap: 0;
  background: none;
  border-radius: 8px;
  padding: 4px;
  transition: opacity 0.3s ease, border-color 0.3s ease;
  pointer-events: auto;
}

.speed-control-widget:hover {
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.4);
}

.speed-button {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  color: var(--fg);
  font-weight: bold;
  padding: 0;
  border-radius: 0;
  font-size: 14px;
  cursor: pointer;
  min-width: 36px;
  min-height: 36px;
  transition: transform 0.5s ease, background 0.5s ease, color 0.5s ease, box-shadow 0.5s ease;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  will-change: transform, background;
}

.speed-button:first-child {
  border-radius: 6px 0 0 6px;
}

.speed-button:last-child {
  border-radius: 0 6px 6px 0;
}

.speed-button:hover {
  background: rgba(255, 0, 0, 0.3);
  color: #ffcccc;
  border-color: rgba(255, 0, 0, 0.5);
  transform: translateY(-1px);
}

.speed-button.active {
  background: var(--red-accent);
  color: #ffcccc;
  border-color: rgba(255, 0, 0, 0.8);
  box-shadow: 0 0 8px rgba(255, 0, 0, 0.4);
}

.speed-button.auto.active {
  background: #ffaa00;
  color: #fff;
  border-color: rgba(255, 170, 0, 0.8);
  box-shadow: 0 0 8px rgba(255, 170, 0, 0.4);
}

.speed-button.auto {
  padding: 2px;
  font-size: 8px;
}

.speed-button i {
  font-size: 16px;
}

.speed-button img {
  width: 20px;
  height: 20px;
}

/* Unified Control Widget */
.unified-control-widget {
  position: absolute;
  opacity: 0.8;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: none;
  border-radius: 8px;
  padding: 4px;
  transition: opacity 0.3s ease;
  pointer-events: auto;
}

.unified-control-widget.hidden {
  opacity: 0;
  pointer-events: none;
}

.unified-control-widget:hover {
  opacity: 1;
}

.control-row {
  display: flex;
  gap: 0;
}

.control-row.speed-controls {
  flex-direction: row;
}

.control-row.emp-controls {
  flex-direction: row;
  justify-content: center;
}

/* EMP Widget */
.emp-widget {
  position: absolute;
  opacity: 0.9;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: none;
  padding: 4px;
  transition: opacity 0.3s ease;
  pointer-events: auto;
}

.emp-widget.hidden {
  opacity: 0;
  pointer-events: none;
}

.emp-widget:hover {
  opacity: 1;
}

.emp-button {
  position: relative;
  display: flex;
  flex-grow: 1;
  justify-content: center;
  align-items: center;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.2));
  color: var(--fg);
  font-weight: bold;
  padding: 12px;
  border-radius: 6px 0 6px 0;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  box-shadow: 0 0 8px rgba(120, 200, 255, 0.3);
  will-change: transform, box-shadow;
}

.emp-button span {
  position: relative;
}

.emp-button:hover {
  background: rgba(120, 200, 255, 0.3);
  color: white;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
  border-color: rgba(120, 200, 255, 0.8);
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(120, 200, 255, 0.5);
}

.emp-button.disabled {
  background: linear-gradient(180deg, rgba(60, 60, 60, 0.8), rgba(40, 40, 40, 0.6));
  color: #888;
  border-color: rgba(120, 120, 120, 0.4);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.emp-button:not(.disabled) {
  background: linear-gradient(180deg, var(--red-accent), var(--red-secondary));
}

.emp-button.emp-active.disabled {
  color: white;
}

.emp-button.disabled:hover {
  background: linear-gradient(180deg, rgba(60, 60, 60, 0.8), rgba(40, 40, 40, 0.6));
  color: #888;
  border-color: rgba(120, 120, 120, 0.4);
  transform: none;
  box-shadow: none;
}

/* EMP Progress Bar */
.emp-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%; /* Always full height, use scaleX */
  background: rgba(120, 200, 255, 0.8);
  transform-origin: left center;
  transition: transform 0.1s ease;
  border-radius: 0 0 6px 6px;
  will-change: transform;
}

.emp-button.emp-active .emp-progress-bar {
  background: rgba(120, 200, 255, 1.0);
}

.emp-button.emp-cooldown .emp-progress-bar {
  background: rgba(100, 100, 100, 0.6);
}
