/* Majera Custom Audio Player
   - LTR sandbox
   - System UI fonts
   - Minimalist layout
*/

#majera-audio-dock.majera-audio-sandbox {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif;
  background-color: #f5f5f6;
  border-radius: 24px;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
}

/* Hide native audio UI */
#majera-audio-element {
  display: none;
}

/* Layout container */
.majera-player-ui {
  display: flex;
  flex-direction: column;
  gap: 12px;              /* Vertical space between seekbar and controls */
  width: 100%;
}

/* --- Row 1: Play & Seekbar --- */
.mp-row-top {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

/* Ensure seekbar fills the remaining width next to the play button */
.mp-seekbar {
  flex: 1;
  min-width: 0;           /* CSS Flexbox best practice for nested flex items */
}

/* --- Row 2: Times & Center Controls --- */
.mp-row-bottom {
  display: grid;
  /* 1fr auto 1fr creates three columns:
     1. Left space (takes available share)
     2. Content width (fitted to buttons)
     3. Right space (takes available share)
  */
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
}

/* Align Current Time to the start (Left) */
.mp-time-current {
  justify-self: start;
}

/* Align Total Time to the end (Right) */
.mp-time-total {
  justify-self: end;
  text-align: right;
}

/* Center the button group */
.mp-controls-center {
  display: flex;
  align-items: center;
  gap: 16px;              /* Spacing between Skip/Speed buttons */
  justify-self: center;
}

/* Buttons: play, skip, speed */
.mp-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Round play/pause button */
.mp-play-toggle {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background-color: #000;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.2s ease,
    background-color 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Play icon (triangle) by default */
.mp-play-toggle::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 8px;
  border-style: solid;
  border-width: 8px 0 8px 12px;
  border-color: transparent transparent transparent #fff;
}

/* Pause icon (two bars) when playing */
.mp-play-toggle.is-playing::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 8px;
  width: 4px;
  height: 16px;
  background: #fff;
  box-shadow: 8px 0 0 #fff;
  border: none;
}

/* Hover feedback */
.mp-play-toggle:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

/* Time labels */
.mp-time {
  font-size: 12px;
  color: #555;
  white-space: nowrap;
}

/* Seekbar container: grow to fill space */
.mp-seekbar {
  flex: 1 1 auto;
  min-width: 80px;
}

/* Track + buffer + progress + handle */
.mp-seekbar-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background-color: #ddd;
  overflow: hidden;
  cursor: pointer;
}

/* While dragging, show horizontal resize */
.majera-audio-sandbox.is-seeking .mp-seekbar-track {
  cursor: ew-resize;
}

.mp-seekbar-buffer {
  position: absolute;
  inset: 0;
  background-color: #c4c4c7;
  transform-origin: left center;
  transform: scaleX(0);
}

.mp-seekbar-progress {
  position: absolute;
  inset: 0;
  background-color: #222;
  transform-origin: left center;
  transform: scaleX(0);
}

.mp-seekbar-handle {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background-color: #000;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

/* Skip buttons: use icon-like text by default; we will improve to SVG later */
.mp-skip-back,
.mp-skip-forward {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* SVG icons inside skip buttons */
.mp-icon {
  display: block;
  width: 28px;     /* tweak as needed */
  height: 28px;
}


/* Hover feedback for skip & speed */
.mp-skip-back:hover,
.mp-skip-forward:hover,
.mp-speed:hover {
  opacity: 0.75;
}

/* Speed button */
.mp-speed {
  font-family: inherit;            /* Force same font as timers */
  font-size: 12px;                 /* Same size as .mp-time */
  font-weight: 500;                /* Slight emphasis but not bold */
  padding: 4px 10px;
  border-radius: 6px;              /* Bevelled rectangle */
  border: 1px solid rgba(0, 0, 0, 0.15);
  background-color: rgba(0, 0, 0, 0.02);
  color: #000;
  line-height: 1;
}


/* subtle press state */
.mp-speed:active {
  background-color: rgba(0, 0, 0, 0.06);
}


.mp-speed:active {
  background-color: rgba(0, 0, 0, 0.12);
}

/* Responsive tweaks */
@media (max-width: 640px) {
  .majera-player-ui {
    gap: 6px;
  }

  .mp-time {
    font-size: 11px;
  }

  .mp-speed {
    padding: 3px 6px;
  }

  .mp-seekbar {
    min-width: 50px;
  }
}

/* Chapter Markers on Seek Bar */
.mp-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: #fff; 
  z-index: 10;
  pointer-events: none;
  /* Add a stronger shadow so it pops against the grey/white background */
  box-shadow: 1px 0 2px rgba(0,0,0,0.3); 
}