/* #region misc */

:root {
  --bytm-font-monospace: "Cousine", "Consolas", monospace;
  --bytm-font-size-monospace: 1.4rem;
}

html:not([dark]) {
  --bytm-themed-icon-col: #000;
}

html[dark] {
  --bytm-themed-icon-col: #fff;
}

.bytm-disable-scroll {
  overflow: hidden !important;
}

.bytm-ellipsis {
  text-overflow: ellipsis;
  text-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
}

.bytm-ellipsis-wrap {
  text-overflow: ellipsis;
  overflow: hidden;
  text-wrap: auto;
  white-space: normal;
}

/* #region generic (circular) button */
.bytm-generic-btn {
  --bytm-generic-btn-width: 36px;
  --bytm-generic-btn-height: 36px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  vertical-align: middle;
  cursor: pointer;
  margin-left: 8px;
  white-space: nowrap;
  text-overflow: ellipsis;
  user-select: none;

  min-width: var(--bytm-generic-btn-width);
  max-width: var(--bytm-generic-btn-width);
  min-height: var(--bytm-generic-btn-height);
  max-height: var(--bytm-generic-btn-height);

  border: 1px solid transparent;
  border-radius: calc(var(--bytm-generic-btn-height, 36px) / 2);
  background-color: transparent;

  transition: background-color 0.2s ease;
}

.bytm-generic-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.bytm-generic-btn:active {
  animation: bytm-flash-border 0.4s ease 1;
}

@keyframes bytm-flash-border {
  0% {
    border: 1px solid initial;
  }
  25% {
    border: 1px solid rgba(255, 255, 255, 0.4);
  }
  100% {
    border: 1px solid initial;
  }
}

.bytm-generic-btn:not(.bytm-toggle):active {
  background-color: rgba(255, 255, 255, 0.3);
}

.bytm-generic-btn.long {
  --bytm-generic-btn-width: calc(min(136px, fit-content));
  padding: 0px 14px;
  line-height: 36px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  vertical-align: middle;
  cursor: pointer;
  margin-left: 0px;

  border: 1px solid #999;
}

.bytm-generic-btn.long:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.bytm-generic-btn.long .bytm-generic-btn-img.left {
  margin-right: 8px;
}

.bytm-generic-btn.long .bytm-generic-btn-img.right {
  margin-left: 8px;
}

.bytm-generic-long-btn-txt {
  font-size: 14px;
}

.bytm-ftitem-help-btn.bytm-generic-btn {
  --bytm-generic-btn-width: 24px;
  --bytm-generic-btn-height: 24px;
}

.bytm-generic-btn-img {
  display: inline-block;
  z-index: 1;
  width: 24px;
  height: 24px;
}

.bytm-dom-yt .bytm-generic-btn-img path {
  /* YT has both dark and light theme, YTM only dark */
  fill: var(--bytm-themed-icon-col, #fff);
}

.bytm-spinner {
  animation: rotate 1.2s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.bytm-anchor {
  all: unset;
  cursor: pointer;
}

/* ytmusic-logo a[bytm-animated="true"] .bytm-mod-logo-ellipse {
  transform-origin: 12px 12px;
  animation: rotate 1s ease-in-out infinite;
} */

ytmusic-logo a.bytm-logo-exchanged .bytm-mod-logo-path {
  transform-origin: 12px 12px;
  animation: rotate 1s ease-in-out;
}

ytmusic-logo a.bytm-logo-exchanged .bytm-mod-logo-img {
  width: 24px;
  height: 24px;
  z-index: 1000;
  position: absolute;
  animation: rotate-fade-in 1s ease-in-out;
}

@keyframes rotate-fade-in {
  0% {
    opacity: 0;
    transform: rotate(0deg);
  }
  30% {
    opacity: 0;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: rotate(360deg);
  }
}

.bytm-no-select {
  user-select: none;
  -ms-user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
}

/* YTM does some weird styling that breaks everything, so this reverts all of BYTM's buttons to the browser default style */
button.bytm-btn {
  padding: revert;
  border: revert;
  outline: revert;
  font: revert;
  text-transform: revert;
  color: revert;
  background: revert;
  cursor: pointer;
  line-height: 1.4em;
}

.bytm-link,
.bytm-markdown-container a {
  color: #369bff !important;
  text-decoration: none !important;
  cursor: pointer;
}

.bytm-link:hover,
.bytm-markdown-container a:hover {
  color: #369bff !important;
  text-decoration: underline !important;
}

button[disabled] {
  cursor: not-allowed;
}

button[disabled].bytm-busy {
  cursor: progress;
}

/* #region menu */

.bytm-cfg-menu-option {
  display: block;
  padding: 8px 0;
}

.bytm-cfg-menu-option-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 24px;
  padding: var(--yt-compact-link-paper-item-padding, 0px 36px 0 16px);
  min-height: var(--paper-item-min-height, 40px);
  white-space: nowrap;
  cursor: pointer;
}

.bytm-cfg-menu-option-item:hover {
  background-color: var(--yt-spec-badge-chip-background, #3e3e3e);
}

.bytm-cfg-menu-option-icon {
  width: 24px;
  height: 24px;
  margin-right: 16px;
  display: flex;
  align-items: center;
  flex-direction: row;
  flex: none;
}

.bytm-cfg-menu-option-text {
  font-size: 1.4rem;
  line-height: 2rem;
}

yt-multi-page-menu-section-renderer.ytd-multi-page-menu-renderer {
  border-bottom: 1px solid var(--yt-spec-10-percent-layer, #3e3e3e);
}

.bytm-yt-cfg-menu-option {
  position: relative;
  width: calc(100% - 12px);
}

.bytm-yt-cfg-menu-option-inner {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  min-height: var(--paper-item-min-height, 48px);
  max-width: calc(100% - 12px);
  padding: 0px 12px;
  border-radius: var(--paper-item-focused-before-border-radius, 10px);
  cursor: pointer;
  background-color: transparent;
  transition: background-color 0.2s ease;
}

.bytm-yt-cfg-menu-option-inner:hover {
  background-color: var(
    --yt-spec-badge-chip-background,
    rgba(255, 255, 255, 0.1)
  );
}

.bytm-yt-cfg-menu-option-icon {
  display: flex;
  align-items: center;
  flex-direction: row;
  width: 24px;
  height: 24px;
  margin-right: 24px;
}

.bytm-yt-cfg-menu-option-item {
  width: 100%;
  color: #fff;
  font-size: 14px;
}

.bytm-yt-cfg-menu-option-item:hover {
  /* Support for "Enhancer for YouTube" extension's custom themes */
  color: var(--main-color, #fff) !important;
}

/* #region watermark */

#bytm-watermark {
  font-size: 10px;
  display: inline-block;
  position: absolute;
  left: 97px;
  top: 45px;
  z-index: 10;
  color: #f1f1f1;
  text-decoration: none;
  cursor: pointer;
}

#bytm-watermark:hover {
  text-decoration: underline;
}

/* #region above queue btns */

#bytm-above-queue-btn-cont {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  height: 100%;
}

#bytm-above-queue-btn-wrapper {
  white-space: nowrap;
}

.bytm-above-queue-btn {
  width: 32px;
  height: 32px;
  margin-left: 0;
  margin-right: 8px;
}

/* #region scroll to active */

#bytm-scroll-to-active-btn-cont {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
}

#bytm-scroll-to-active-btn-cont.hidden {
  display: none;
}

#bytm-scroll-to-active-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
}

#bytm-scroll-to-active-btn {
  width: revert;
  height: revert;
}

#bytm-scroll-to-active-btn .bytm-generic-btn-img {
  padding: 4px;
}

/* #region thumbnail */

#bytm-thumbnail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  background-color: #030303;
  z-index: 0;
  border-radius: var(--ts-songimg-border-radius, initial);
}

#bytm-thumbnail-overlay-img {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  box-shadow: var(--ts-songimg-box-shadow, initial);
}

#bytm-thumbnail-overlay-indicator {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: calc(min(56px, 100% - 16px));
  height: calc(min(56px, 100% - 16px));
  z-index: 1;
  cursor: help;
  filter: drop-shadow(0 0 3px #000);
}

ytmusic-player#player #bezel {
  z-index: 1;
}

/* #region auto-like */

.bytm-vote-label {
  cursor: pointer;
  font-size: 1.25rem;
  padding: 6px;
  padding-left: 3px;
}

ytmusic-app-layout[player-ui-state="FULLSCREEN"] .bytm-vote-label {
  color: white;
}

.bytm-vote-label:last-child {
  padding-right: 0px;
}

/* #region fullscreen player bar */

/* Increase specificity to override YTM's default styles without having to use !important */
:root
  body.bytm-dom-ytm
  ytmusic-app-layout[player-ui-state="FULLSCREEN"]
  ytmusic-player-bar[slot="player-bar"] {
  width: 100%;
  /* ...except in this case because of the ThemeSong extension: */
  background: rgba(0, 0, 0, 0.35) !important;
  backdrop-filter: blur(10px) brightness(90%);
}

:root
  body.bytm-dom-ytm
  ytmusic-app-layout[player-ui-state="FULLSCREEN"]
  ytmusic-player-bar[slot="player-bar"]
  .ytmusic-menu-renderer
  svg
  path,
:root
  body.bytm-dom-ytm
  ytmusic-app-layout[player-ui-state="FULLSCREEN"]
  ytmusic-player-bar[slot="player-bar"]
  tp-yt-paper-icon-button
  svg
  path {
  fill: #fff;
}

:root
  body.bytm-dom-ytm
  ytmusic-app-layout[player-ui-state="FULLSCREEN"]
  ytmusic-player-bar[slot="player-bar"]
  .time-info {
  color: #fff;
}
