/*google fonts */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap");

/*  base css */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", sans-serif;
  height: 100vh;
  background-color: #222;
  display: grid;
  place-items: center;
  color: #eee;
}

a {
  text-decoration: none;
}

li {
  list-style-type: none;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

h1 {
  font-size: 2.5rem;
  font-weight: 500;
  margin-top: -2rem;
}

/* player */
.player {
  position: relative;
  max-width: 60vw;
  min-width: 500px;
  display: grid;
  place-items: center;
}

.video {
  width: 100%;
  height: auto;
  box-shadow: 0px 0px 40px rgba(0, 0, 0, 0.75);
}

.controls__entry__div {
  position: absolute;
  bottom: 0;
  width: 100%;
  min-height: 100px;
  z-index: 1;
}

/* controlbar */
.controlbar__container {
  opacity: 0;
  pointer-events: none;
  width: 100%;
  min-height: 60px;
  padding: 0.75rem 1rem;
  position: absolute;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  transition: opacity 0.4s ease-out;
  z-index: 2;
}

.video__dragbar__container {
  width: 100%;
  height: 0.35rem;
  background-color: rgba(0, 0, 0, 0.6);
  border-radius: 5px;
  margin-bottom: 0.5rem;
  z-index: 3;
}

.video__dragbar {
  position: relative;
  width: 20%;
  height: 0.35rem;
  background-color: #d8df78;
  border: none;
  border-radius: 5px;
  z-index: 4;
}

.other__controls__container {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

i {
  font-size: 1.25rem;
}

.left__controls,
.right__controls {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  /* background-color: red; */
}

/* left controls */

.left__controls {
  gap: 0.5rem;
}

.play__pause__icon {
  font-size: 1.5rem;
}

.volume__bar__container {
  width: 5rem;
  height: 0.35rem;
  background-color: rgba(0, 0, 0, 0.6);
  border-radius: 5px;
  z-index: 3;
}

.volume__bar {
  width: 100%;
  height: 0.35rem;
  background-color: #ddd;
  border: none;
  border-radius: 5px;
  z-index: 4;
}

.play__pause__icon,
.volume__bar,
.volume__icon,
.video__dragbar__container,
.video__dragbar,
.volume__bar__container,
.volume__bar {
  cursor: pointer;
}

/* right controls */

.right__controls {
  gap: 0.75rem;
}

.current__speed,
.progress__time {
  font-size: 0.8rem;
}

.current__speed {
  font-weight: bold;
}

.speed__container {
  position: absolute;
  display: flex;
  align-items: center;
  right: 9rem;
  bottom: -0.2rem;
}

.video__speed {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.3s ease-in-out;
  background-color: transparent;
  padding: 0.15rem 0.5rem 0.15rem 1rem;
}

.speed__options {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.75);
  width: 120px;
  position: absolute;
  bottom: 3.3rem;
  right: 0rem;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease-out;
}

.speed__option {
  width: 100%;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  cursor: pointer;
  background-color: transparent;
  transition: all 0.3s;
}

.speed__option:hover {
  background-color: rgba(0, 0, 0, 0.9);
}

.progress__time {
  position: relative;
  padding-inline: 0.5rem;
}

.progress__time span {
  position: relative;
  padding: 0.15rem 0.25rem;
}

.video__speed,
.fullscreen__icon {
  cursor: pointer;
}

/* attribution */

.attribution {
  position: absolute;
  bottom: 1rem;
  text-align: center;
}

.attribution a {
  font-weight: 600;
  color: #eee;
}

/* ................................................ */

/* responsivess for smaller screen devices */

@media screen and (max-width: 575px) {
  .player {
    max-width: 95vw;
    min-width: 0;
  }

  .controls__entry__div {
    min-height: 70px;
  }

  .controlbar__container {
    min-height: 40px;
  }

  .video__dragbar__container {
    height: 0.15rem;
  }

  .video__dragbar {
    height: 0.15rem;
  }

  i {
    font-size: 1rem;
  }

  .play__pause__icon {
    font-size: 1.15rem;
  }

  .volume__bar__container {
    width: 3rem;
    height: 0.15rem;
  }

  .volume__bar {
    width: 100%;
    height: 0.15rem;
  }

  .speed__container {
    bottom: 0.075rem;
  }

  .speed__options {
    width: 100px;
    bottom: 2.575rem;
  }

  .speed__option {
    padding: 0.35rem 1rem;
    font-size: 0.65rem;
  }
}

/* ............................................ */

/* functionality related styling */

/*  show-hide controlbar depending upon hover to entry div */
.controls__entry__div:hover .controlbar__container {
  opacity: 1;
  pointer-events: initial;
  transition: all 0.4s ease-in;
}

/* add background to video speed div only when it is clicked and is active*/
.video__speed__active {
  background-color: rgba(0, 0, 0, 0.9);
}

.toggle__speed__options {
  opacity: 1;
  pointer-events: initial;
  transition: all 0.3s ease-in;
}
