/* === GLOBAL LAYOUT === */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  max-width: 900px;
  font-family: 'Inter', 'Helvetica Neue', sans-serif;
  color: #111;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
}

/* === HEADER === */
h1 {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  font-size: 1.8rem;
  margin: 1rem;
  margin-top: 0px;
  margin-bottom: 15px;
  text-align: center;
  font-weight: lighter;
  letter-spacing: -1px;
}

#statusBackground {
 background-color: rgba(255, 255, 255, 0.7); 
  background-position: center;
 text-align: center;
 position: relative;
  height: min-content;
}

/* === STATUS TEXT === */
#status {
    opacity: 1;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  text-align: center;
  font-size: 1rem;
  color: #ff0000;
  margin-bottom: 1rem;
  text-shadow: 4px 4px 8px #ffb0b0;
}

/* === CONTROL AREA === */
#controls1 {
  display: flex;
  align-items: center;
  gap: 1rem;
}
#controls2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* === BUTTONS === */
button {
  z-index: 3;
  font-size: 1rem;
  border: none;
  background: #222;
  color: white;
  padding: 0.8rem 1.5rem;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
}
button:hover { background: #555; }
button:disabled, .pseudoDisabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === ICON BUTTONS === */
.icon-btn {
  -webkit-appearance: none !important;
  appearance: none !important;
  background-clip: padding-box !important;
  -webkit-tap-highlight-color: transparent;
  color: #000;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 1px solid #111;
  transition: all 0.25s ease;
}
.icon-btn:hover {
  background: #111;
  color: white;
}

/* === PER-BUTTON ACTIVE COLORS === */
.icon-btn[data-role="mic"].active {
  background-color: #ff3b30 !important; /* red */
  color: white !important;
  border-color: #ff3b30 !important;
}
.icon-btn[data-role="record"].active {
  background-color: #ff9500 !important; /* orange */
  color: white !important;
  border-color: #ff9500 !important;
}
.icon-btn[data-role="sync"].active {
  background-color: #000 !important; /* black */
  color: white !important;
  border-color: #000 !important;
}

.icon-btn[data-role="sync"]:not(.active) {
  background: white !important;
  color: black !important;
  border-color: #111 !important;
}

.icon-btn[data-role="mix"].active,
#mixBtn.mixing {
  background-color: #00b4ff !important; /* blue */
  color: white !important;
  border-color: #00b4ff !important;
  box-shadow: 0 0 20px rgba(0,180,255,0.5);
}
.icon-btn[data-role="upload"].active {
  background-color: #34c759 !important; /* green */
  color: white !important;
  border-color: #34c759 !important;
}

/* inactive fallback */
.icon-btn:not(.active) {
  background: white !important;
  color: black !important;
  border-color: #111 !important;
}

/* pressed feedback */
.icon-btn:active {
  transform: scale(0.97);
  opacity: 0.9;
}

/* === AUDIO PLAYER === */
audio {
  width: 100%;
  max-width: 600px;
  margin: 1rem auto;
  display: block;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #111;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.15));
  overflow: hidden;
}

/* Safari & iOS */
audio::-webkit-media-controls-panel {
  background-color: #ffffff !important;
  border-radius: 14px !important;
  border: none !important;
}
audio::-webkit-media-controls-play-button {
  background-color: #ffffff !important;
  border-radius: 50%;
}
audio::-webkit-media-controls-timeline {
  background-color: #e6e6e6 !important;
  border-radius: 5px !important;
  height: 4px !important;
  margin: 0 8px !important;
}
audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display {
  color: #000 !important;
  font-size: 0.9rem !important;
  font-family: 'Inter', sans-serif !important;
}
audio::-webkit-media-controls-enclosure {
  border-radius: 14px !important;
  background: #fff !important;
  box-shadow: none !important;
}

/* === INPUT FIELDS === */
input[type="text"] {
  padding: 0.6rem 1rem;
  border-radius: 14px;
  border: 1px solid #000;
  font-size: 1rem;
  text-align: center;
}
input[type="range"] { width: 700px; }

/* === WAVEFORM === */
#waveform {
  width: 100%;
  z-index: 1;
  height: 100%;
  display: block;
  background: #e9e9e9;
  position: fixed;
  top: 0;
  left: 0;
}

/* === PAGE CONTAINER === */
#app {
    margin-top: -30px;
  z-index: 2;
  background-image: url("dubby_arrow.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 350px 750px;
  padding-top: 15px;
  text-align: center;
  position: relative;
  width: 100%;
  height: 720px;
  max-width: 1000px;
}

#recordBtn { padding-bottom: 1rem; }

/* === MIX & UPLOAD BUTTONS === */
#mixBtn {
  background: #ffffff;
  color: #000;
  border-radius: 50px;
  padding: 1rem 2rem;
  font-size: 1.5rem;
  font-weight: 600;
  transition: all 0.3s ease;
}
#mixBtn:hover { background: #000; color: #fff; }
#mixBtn.mixing {
  background: #00b4ff;
  box-shadow: 0 0 20px rgba(0,180,255,0.5);
}

#uploadBtn {
  background: #ffffff;
  color: #000;
  border-radius: 20% 20% 50% 50%;
  width: 80px;
  height: 80px;
  font-size: 2.3rem;
  margin-top: -35px;
  margin-left: 65%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#uploadBtn:hover {
  background: #000;
  color: #fff;
}

/* === SYNC BUTTON === */
#syncToggleBtn {
  z-index: 2;
  width: 75px;
  height: 40px;
  margin-left: -40px;
  background: #000000;
  color: rgb(255, 255, 255);
  border-radius: 50px;
  padding: 0.2rem 1rem;
  padding-right: 0.1rem;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s ease;
}
#syncToggleBtn:hover {
  color: #fff;
  background: #000;
  box-shadow: 0 0 20px rgba(0,180,255,0.5);
}

/* === RESPONSIVE === */
@media (max-width: 600px) {
  h1 { font-size: 1.8rem; }
  audio { width: 90%; }
}

/* === ARROW === */
#flowArrow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
#flowArrow path {
  stroke: #007aff;
  stroke-width: 3;
  fill: none;
  opacity: 0.4;
}

/* Ensure main app above waveform */
#app { position: relative; z-index: 1; }
#waveform { z-index: -1; }

/* === MIC SLIDER === */
.controlBackground {
  width: 15px;
  height: 120px;
  background-color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 14px;
  border: 1px solid #000;
  align-items: center;
  text-align: center;
}
#volumeSlider {
  writing-mode: bt-lr;
  -webkit-appearance: slider-vertical;
  width: 15px;
  height: 100px;
  display: block;
  margin: 0px;
  margin-top: 10px;
}

/* Disable hover on touch */
@media (hover: none) and (pointer: coarse) {
  button:hover {
    background: inherit !important;
    transform: none !important;
  }
}

/* === POPUP === */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}
.popup-box {
  font-weight: normal;
  font-size: 1rem;
  background: #fff;
  color: #070707;
  margin-left: 10px;
    margin-right: 10px;
  padding: 2rem;
  border-radius: 15px;
  text-align: center;
  max-width: 300px;
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  display: block;
  background: white;
  border: 1px solid #111;
}
.popup-box button {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  background: white;
  border: 1px solid #111;
  color: #000000;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
  
}
.popup-box button:hover {
  background: #000000;
    color: #ffffff;
}

/* === FLASH ANIMATION === */
@keyframes flashPulse {
  0%, 100% { box-shadow: 0 0 0px rgba(255,0,0,0); }
  50% { box-shadow: 0 0 15px 5px rgba(59, 59, 59, 0.6); }
}
.flash {
  animation: flashPulse 1s infinite;
}

audio.no-mix {
  background: #ccc !important;
  border-color: #aaa !important;
  filter: grayscale(100%) brightness(0.9);
}