/* Local files mode (4th mode, next to the Nostr button) */
.local-mode-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.local-mode-button img {
  width: 20px;
  height: 20px;
}

.top-bar-actions .local-mode-button {
  width: 22px;
  height: 22px;
}

/* In Local mode the folder icon turns into a "back to radio" icon. */
.local-mode-button.active img {
  content: url('/img/radio_dark.svg');
  width: 25px;
  height: 25px;
  margin: -2px;
}

body.dark .local-mode-button.active img {
  content: url('/img/radio.svg');
}

@media (max-width: 768px) {
  .local-mode-button {
    display: none !important;
  }
}

/* Mode title: reads as a heading with the icon, not as a label of the search box */
#localModeLabel {
  white-space: nowrap;
  font-weight: 600;
  font-size: 1.1rem;
  margin-left: -0.4rem;
  margin-right: auto;
}

#localAddFolderBtn {
  background: none;
  border: none;
  color: #fff;
  width: 1.8rem;
  height: 1.8rem;
  margin-right: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#localAddFolderBtn:hover {
  animation: favIconPop 0.35s ease-out;
}

#localAddFolderBtn:active {
  transform: scale(0.88);
  animation: none;
}

#localAddFolderBtn img {
  width: 1.8rem;
  height: 1.8rem;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

/* Explorer rows live inside #playlist */
#playlist li.local-row .progress {
  background-color: #171c2b8b;
}

#playlist li.local-row .local-ico,
#playlist li.local-row .local-act {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

#playlist li.local-row .title-ellipsis {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#playlist li.local-row.active .title-ellipsis {
  max-width: none;
}

#playlist li .local-sub {
  font-size: 0.8rem;
  opacity: 0.65;
  white-space: nowrap;
}

#playlist li .local-acts {
  display: inline-flex;
  gap: 2px;
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.15s;
}

#playlist li:hover .local-acts,
#playlist li.active .local-acts,
#playlist li .local-acts.always {
  opacity: 1;
}

.local-act {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  line-height: 0;
  position: relative;
  z-index: 2;
}

.local-act:hover {
  background: rgba(23, 28, 43, 0.25);
}

#playlist li.active .local-act:hover {
  background: rgba(0, 242, 184, 0.25);
}

#playlist li.local-new {
  opacity: 0.8;
  border: 1px dashed rgba(255, 255, 255, 0.28);
  color: #fff;
  background: transparent;
  box-shadow: none;
}

#playlist li.local-section,
#playlist li.local-notice,
#playlist li.local-crumbs,
#playlist li.local-drop {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  background: transparent;
  box-shadow: none;
  scale: 1;
  cursor: default;
}

#playlist li.local-section:hover,
#playlist li.local-notice:hover,
#playlist li.local-crumbs:hover {
  background: transparent;
  color: #fff;
  scale: 1;
}

#playlist li.local-section {
  padding: 12px 4px 2px;
  font-size: 0.8rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.7;
}

#playlist li.local-notice {
  opacity: 0.75;
  font-size: 0.95rem;
}

#playlist li.local-notice.clickable {
  cursor: pointer;
  text-decoration: underline;
}

#playlist li.local-crumbs {
  padding: 6px 4px;
  justify-content: space-between;
}

.local-trail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.local-crumb {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  text-decoration: underline;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.local-crumb.current {
  cursor: default;
  text-decoration: none;
  font-weight: 700;
}

.local-sep {
  opacity: 0.5;
}

/* Popover + toast (appended to body) */
.local-pop {
  position: fixed;
  z-index: 33000;
  min-width: 220px;
  max-width: 300px;
  max-height: 60vh;
  overflow-y: auto;
  background: #171C2B;
  border: 1px solid #00F2B8;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #fff;
  font-family: 'Ruda', sans-serif;
  box-shadow: rgba(0, 0, 0, 0.4) 0 8px 24px;
}

.local-pop-title {
  font-size: 0.85rem;
  opacity: 0.7;
}

.local-pop-sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
  margin: 2px 0;
}

.local-pop-item,
.local-pop-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  color: #fff;
  font: inherit;
  padding: 6px 10px;
  text-align: left;
  cursor: pointer;
}

.local-pop-btn {
  background: #00F2B8;
  border-color: #00F2B8;
  color: #171C2B;
  text-align: center;
  font-weight: 700;
}

.local-pop-item:hover {
  background: rgba(0, 242, 184, 0.18);
  border-color: #00F2B8;
}

.local-pop-input {
  box-sizing: border-box;
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  color: #fff;
  font: inherit;
  padding: 6px 10px;
  outline: none;
}

.local-pop-input:focus {
  border-color: #00F2B8;
}

.local-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 34000;
  background: #171C2B;
  color: #00F2B8;
  border: 1px solid #00F2B8;
  border-radius: 20px;
  padding: 8px 18px;
  font-family: 'Ruda', sans-serif;
  box-shadow: rgba(0, 0, 0, 0.4) 0 8px 24px;
}

/* Unsupported-browser help dialog */
.local-help {
  position: fixed;
  inset: 0;
  z-index: 35000;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
}

.local-help-box {
  box-sizing: border-box;
  width: 440px;
  max-width: 90vw;
  background: #171C2B;
  border: 1px solid #00F2B8;
  border-radius: 22px;
  padding: 24px;
  color: #fff;
  font-family: 'Ruda', sans-serif;
  box-shadow: rgba(0, 0, 0, 0.5) 0 12px 32px;
}

.local-help-title {
  margin: 0 0 10px;
  font-size: 1.2rem;
  color: #00F2B8;
}

.local-help-text,
.local-help-note {
  margin: 0 0 12px;
  line-height: 1.45;
}

.local-help-note {
  font-size: 0.8rem;
  opacity: 0.6;
}

.local-help-steps {
  margin: 0 0 14px;
  padding-left: 20px;
  line-height: 1.6;
}

.local-help-flag {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.local-help-flag code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  user-select: all;
}

.local-help-close {
  width: 100%;
  margin-top: 4px;
}

/* Drop zone */
#playlist li.local-drop {
  justify-content: center;
  gap: 12px;
  padding: 14px;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  background: transparent;
  box-shadow: none;
}

#playlist li.local-drop:not(.big) {
  justify-content: flex-start;
  gap: 8px;
  padding: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.28);
  opacity: 0.8;
}

#playlist li.local-drop:not(.big) .local-drop-plus {
  width: 22px;
  height: 26px;
  border: 0;
  border-radius: 0;
  font-size: 1.2rem;
}

#playlist li.local-drop.big {
  flex-direction: column;
  padding: 36px 14px;
  gap: 6px;
  text-align: center;
}

#playlist li.local-drop:hover {
  border-color: #00F2B8;
  background: rgba(0, 242, 184, 0.12);
  color: #fff;
  scale: 1;
}

.local-drop-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid currentColor;
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.local-drop.big .local-drop-plus {
  width: 52px;
  height: 52px;
  font-size: 2.2rem;
}

.playlist-area.drag-over {
  outline: 3px dashed #00F2B8;
  outline-offset: -6px;
  background: rgba(0, 242, 184, 0.12);
}

#playlist li.local-drop,
#playlist li.local-drop * {
  cursor: pointer;
}

/* The active row is dark, so the default dark progress fill was only visible on hover. */
#playlist li.local-row.active .progress {
  background-color: rgba(0, 242, 184, 0.34);
}

#playlist li.local-row.active:hover .progress {
  background-color: rgba(0, 242, 184, 0.42);
}

/* Confirm dialog */
.local-confirm-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.local-confirm-row .local-pop-item,
.local-confirm-row .local-pop-btn {
  min-width: 90px;
  text-align: center;
}

.local-pop-btn.danger {
  background: #ff5470;
  border-color: #ff5470;
  color: #fff;
}

/* favorite hearts */
#playlist li .local-act.fav-on {
  color: #ff5c8a;
}

#playlist li.local-fav-row .local-ico {
  color: #ff5c8a;
}

/* Breadcrumb / action bar stays pinned while the list scrolls under it */
#playlist li.local-crumbs,
#playlist li.local-crumbs:hover {
  position: sticky;
  top: 6px;
  z-index: 10;
  margin-bottom: 6px;
  padding: 8px 12px;
  background: rgba(18, 22, 36, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* track length, right-aligned after the hover actions */
#playlist li .local-dur {
  flex: 0 0 auto;
  min-width: 44px;
  margin-left: 6px;
  text-align: right;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

/* Library home: folders and playlists are the main items, so they are larger */
#playlist li.local-row.local-big {
  font-size: 1.2rem;
  padding-top: 13px;
  padding-bottom: 13px;
  gap: 12px;
}

#playlist li.local-row.local-big .local-ico svg {
  width: 22px;
  height: 22px;
}

#playlist li.local-row.local-big .local-sub {
  font-size: 0.85rem;
}

/* The playing local track shows a play icon instead of the note (and drops the accent dot) */
#playlist li.local-track.active::before {
  display: none;
}

#playlist li.local-track.active .local-ico svg {
  display: none;
}

#playlist li.local-track.active .local-ico::before {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4l13 8-13 8z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4l13 8-13 8z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
