/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Hide default cast-media-player chrome — we provide our own overlay */
cast-media-player {
  --playback-logo-image: none;
  --theme-hue: 157;
  --progress-color: #1DC9A4;
  --splash-color: #0D0D0D;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Hide the built-in CAF UI controls since we have a custom overlay */
cast-media-player::part(background),
cast-media-player::part(controls) {
  display: none;
}

/* ===== Overlay Container ===== */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.overlay--hidden {
  opacity: 0;
}

.overlay--visible {
  opacity: 1;
}

/* Allow clicks on visible overlay children */
.overlay--visible .overlay__top,
.overlay--visible .overlay__center,
.overlay--visible .overlay__bottom {
  pointer-events: auto;
}

/* ===== Gradient Background ===== */
.overlay__gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(13, 13, 13, 0.55) 0%,
    rgba(13, 13, 13, 0.15) 30%,
    rgba(13, 13, 13, 0.15) 50%,
    rgba(13, 13, 13, 0.75) 75%,
    rgba(13, 13, 13, 0.95) 100%
  );
  pointer-events: none;
}

/* ===== Top Bar ===== */
.overlay__top {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 16px 24px;
  position: relative;
  z-index: 1;
}

.overlay__top-icons {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ===== Icon / Control Buttons ===== */
.icon-btn,
.control-btn {
  appearance: none;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.icon-btn {
  width: 40px;
  height: 40px;
}

.icon-btn:hover,
.control-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.icon-btn:active,
.control-btn:active {
  background: rgba(255, 255, 255, 0.2);
}

.icon-btn:focus-visible,
.control-btn:focus-visible {
  outline: 2px solid #1DC9A4;
  outline-offset: 2px;
}

/* ===== Center Controls ===== */
.overlay__center {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 48px;
  position: relative;
  z-index: 1;
}

.control-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
}

.control-btn--play {
  width: 72px;
  height: 72px;
}

.control-btn--play svg {
  width: 48px;
  height: 48px;
}

/* ===== Bottom Bar ===== */
.overlay__bottom {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 64px 20px;
  position: relative;
  z-index: 1;
}

/* Time Labels */
.time {
  font-size: 14px;
  font-weight: 500;
  color: #F2F2F2;
  min-width: 48px;
  white-space: nowrap;
  user-select: none;
}

.time--current {
  text-align: left;
}

.time--duration {
  text-align: right;
}

/* ===== Progress Bar ===== */
.progress {
  flex: 1;
  position: relative;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.progress__track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #333333;
  overflow: hidden;
}

.progress__buffered {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: #595959;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.progress__played {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: #1DC9A4;
  border-radius: 2px;
}

/* Scrubber dot */
.progress__scrubber {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1DC9A4;
  transform: translate(-50%, -50%);
  box-shadow:
    0 1px 4px rgba(0, 0, 0, 0.3),
    0 1px 3px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  transition: left 0.05s linear;
}

/* CC active state */
.icon-btn--active svg text,
.icon-btn--active svg rect,
.icon-btn--active svg path {
  fill: #1DC9A4;
}

.icon-btn--active svg rect[stroke],
.icon-btn--active svg path[stroke] {
  stroke: #1DC9A4;
}
