:root {
  --record-bg-image: url('./assets/sample2.jpg');
  --record-rotation: 0deg;
  --record-tilt-x: 50deg;
  --record-tilt-y: 0deg;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Space Mono", monospace;
  background: rgb(0, 0, 0);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100svh;
  width: 100vw;
  overflow: hidden;
  overscroll-behavior: none; /* prevents pull-to-refresh / bounce */
  text-transform: uppercase;
}

input {
    font-family: "Space Mono", monospace;
}

button {
    font-family: "Space Mono", monospace;
}

file {
    font-family: "Space Mono", monospace;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin: 0;
}

.song-info {
    position: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    top: 20px;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 1001;
}

.song-title {
    opacity: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 24ch;
}

.song-author {
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 20ch;
}

.container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  perspective: 1000px;
  perspective-origin: center center;
  z-index: 1000;
  height: 100vh;
  width: 90vw;
  overscroll-behavior: none; /* prevents pull-to-refresh / bounce */
}

.record {
    position: relative;
    overflow: hidden;
    border-radius: 100%;
    width: 600px;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #000000;
    box-shadow: 0 0 0 10px rgba(0, 0, 0, 0.945);
    transform: rotateX(var(--record-tilt-x)) rotateY(var(--record-tilt-y));
    transform-style: preserve-3d;
    background:
      /* Grooves 1 */
      repeating-radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.04) 0px,
        rgba(255, 255, 255, 0.02) 1px,
        rgba(0, 0, 0, 0) 60px
      ),
      /* Grooves 2*/
      repeating-radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.03) 0px,
        rgba(255, 255, 255, 0.03) 1px,
        rgba(0, 0, 0, 0) 4px
      ),
      /* Light reflection 1 */
      conic-gradient(
        from 235deg at 50% 50%,
        rgba(130, 130, 130, 0.55) 0deg,
        rgba(20, 20, 20, 0.44) 33.54deg,
        rgba(0, 0, 0, 0.40) 151.56deg,
        rgba(130, 130, 130, 0.55) 180deg,
        rgba(0, 0, 0, 0.40) 202.54deg,
        rgba(0, 0, 0, 0.40) 325.48deg,
        rgba(130, 130, 130, 0.55) 360deg
      ),
      /* Light reflection 2*/
      conic-gradient(
        from 100deg at 50% 50%,
        rgba(105, 105, 105, 0.50) 0deg,
        rgba(1, 1, 1, 0.40) 33.54deg,
        rgba(0, 0, 0, 0.40) 151.56deg,
        rgba(105, 105, 105, 0.50) 180deg,
        rgba(0, 0, 0, 0.40) 202.54deg,
        rgba(0, 0, 0, 0.40) 325.48deg,
        rgba(105, 105, 105, 0.50) 360deg
      ),
      linear-gradient(135deg, #000000 0%, #000000a2 100%),
      #000000;
    transition: scale 0.2s ease;
}

.record:hover {
    cursor: grab;
    scale: 1.05;
}

.record::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(var(--record-rotation));
  aspect-ratio: 1/1;
  width: 600px;
  /* background-image: var(--record-bg-image); */
  background-image: url('./assets/texture.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 100%;
  opacity: 0.05;
  filter: blur(0px);
}

.record-inner {
    width: 200px;
    max-width: 30vw;
    aspect-ratio: 1 / 1;
    position: relative;
    border-radius: 100%;
    overflow: hidden; /* so zoomed bg stays inside circle */
    box-shadow: 0 0 0 20px #00000042;
    animation: unblurRecord 900ms ease forwards;
  }
  
  /* background split out */
  .record-inner::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--record-bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
  
    transform: scale(1.05);       /* zoom in */
    transform-origin: center;
  }
  

.record-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: #000000;
    border-radius: 100%;
}

.drop-zone {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(19, 19, 19, 0.568);
    display: none;
    align-items: center;
    justify-content: center;
    color: rgb(255, 255, 255);
    text-shadow: 0 0 4px rgb(255, 255, 255);
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
    user-select: none;
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(20px);
}

.drop-zone.active {
    display: flex;
    opacity: 1;
}

.drop-zone::before {
    content: 'Swap songs';
    padding: 20px 40px;
    border-radius: 8px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes unblurRecord {
    from {
        filter: blur(10px);
        opacity: 0.1;
    }
    to {
        filter: blur(0);
        opacity: 1;
    }
}

.audio-visualizer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: auto;
    z-index: 10;
    pointer-events: none;
}

/* Progress Bar Styles */
.progress-bar-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0;
    pointer-events: none;
}

.progress-bar-container.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

/* Always show on mobile */
@media (max-width: 768px), (hover: none) {
    .progress-bar-container {
        opacity: 1;
        pointer-events: auto;
        transform: translateX(-50%) translateY(0);
    }
}

.progress-time-indicator {
    font-family: "Space Mono", monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    text-transform: uppercase;
    min-width: 32px;
    text-align: center;
}

.progress-bar {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    height: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px 0;
    margin: 0 4px;
}

.progress-bar-track {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: visible;
    transition: height 0.2s ease;
}

.progress-bar:hover .progress-bar-fill {
    background: linear-gradient(90deg, #4ECDC4, #45B7D1);
}

.progress-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.705);
    border-radius: 2px;
    width: 0%;
    /* Remove transition for smooth requestAnimationFrame updates */
}

.progress-bar-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: none;
    cursor: grab;
    z-index: 10;
}

.progress-bar:hover .progress-bar-handle {
    opacity: 1;
}

.progress-bar-handle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.2);
}

.progress-bar-handle.dragging {
    opacity: 1;
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.2);
}

/* Progress Control Buttons */
.progress-control-button {
    background-color: transparent;
    border: none;
    width: 24px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    margin-top: 1px;
}

.progress-control-button:hover {
    color: #ffffff;
    transform: scale(1.05);
}

.progress-control-button:active {
    transform: scale(0.95);
}

.play-pause-button.playing i {
    transform: translateX(-1px); /* Slight adjustment for pause icon centering */
}

/* Songs button (folder icon) */
.songs-button {
    position: fixed;
    bottom: 24px;
    right: 48px;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1100;
    transition: all 0.2s ease;
}

.songs-button::before {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 26px;
    height: 20px;
    background:
      linear-gradient(#eecb6d, #cfb456) padding-box,
      linear-gradient(transparent, transparent) border-box;
    border: 2px solid rgba(0,0,0,0.15);
    border-radius: 4px 4px 6px 6px;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15);
}

.songs-button::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 11px;
    width: 12px;
    height: 6px;
    border-radius: 3px 3px 0 0;
    background: #eecb6d;
    border: 2px solid rgba(0,0,0,0.15);
}

.songs-button:hover {
    scale: 1.2;
    transform-origin: center;
}

/* Songs panel */
.songs-panel {
    position: fixed;
    bottom: 90px;
    right: 24px;
    overflow-x: hidden; /* Prevent horizontal scrollbar during transitions */
    overflow-y: hidden;
    opacity: 0;
    display: none;
    z-index: 1100;
    transform: translateX(100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 100vw; /* Ensure panel doesn't exceed viewport */
}

.songs-panel.open {
    display: flex;
    flex-direction: column;
    margin-right: 2px;
    align-items: end;
    opacity: 1;
    transform: translateX(0);
}

.songs-list {
    display: flex;
    padding: 10px;
    flex-direction: column;
    max-height: calc(100vh - 220px);
    gap: 12px;
    overflow-x: visible;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
    mask-image: linear-gradient(to bottom, transparent 0, rgba(0,0,0,0.6) 12px, #000 32px, #000 calc(100% - 32px), rgba(0,0,0,0.6) calc(100% - 12px), transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, rgba(0,0,0,0.6) 12px, #000 32px, #000 calc(100% - 32px), rgba(0,0,0,0.6) calc(100% - 12px), transparent 100%);
}

.songs-list::-webkit-scrollbar { display: none; }

/* Hide scrollbars for all child elements of songs-panel */
.songs-panel * {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
}

.songs-panel *::-webkit-scrollbar { 
    display: none; 
}

.song-item {
    position: relative;
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 12px;
    user-select: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: transparent;
    opacity: 0;
    transform: translateX(20px);
    overflow: visible;
}

.song-item.animate {
    animation: slideInFade 0.3s ease forwards;
}

.song-item:hover, .song-item:focus {
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.18) 100%);
    outline: none;
    scale: 1.05;
    transform-origin: center right;
}

.drop-target {
    outline: 1px dashed rgba(255,255,255,0.35);
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.22) 100%) !important;
}

.drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 200000;
    background: rgba(30,30,30,0.9);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    color: #fff;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}

/* Add new keyframes for song item animation */
@keyframes slideInFade {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.song-cover {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #000000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.8);
    background:
      /* Grooves 1 */
      repeating-radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.04) 0px,
        rgba(255, 255, 255, 0.02) 1px,
        rgba(0, 0, 0, 0) 60px
      ),
      /* Grooves 2*/
      repeating-radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.03) 0px,
        rgba(255, 255, 255, 0.03) 1px,
        rgba(0, 0, 0, 0) 4px
      ),
      /* Light reflection 1 */
      conic-gradient(
        from 235deg at 50% 50%,
        rgba(130, 130, 130, 0.55) 0deg,
        rgba(20, 20, 20, 0.44) 33.54deg,
        rgba(0, 0, 0, 0.40) 151.56deg,
        rgba(130, 130, 130, 0.55) 180deg,
        rgba(0, 0, 0, 0.40) 202.54deg,
        rgba(0, 0, 0, 0.40) 325.48deg,
        rgba(130, 130, 130, 0.55) 360deg
      ),
      /* Light reflection 2*/
      conic-gradient(
        from 100deg at 50% 50%,
        rgba(105, 105, 105, 0.50) 0deg,
        rgba(1, 1, 1, 0.40) 33.54deg,
        rgba(0, 0, 0, 0.40) 151.56deg,
        rgba(105, 105, 105, 0.50) 180deg,
        rgba(0, 0, 0, 0.40) 202.54deg,
        rgba(0, 0, 0, 0.40) 325.48deg,
        rgba(105, 105, 105, 0.50) 360deg
      ),
      linear-gradient(135deg, #000000 0%, #000000a2 100%),
      #000000;
    transition: scale 0.2s ease;
}

.song-cover-inner {
    width: 20px;
    height: 20px;
    position: relative;
    border-radius: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 0 0 2px #00000042;
}

.song-cover-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 2px;
    background: #000000;
    border-radius: 100%;
}

/* Playlist visuals */
.playlist-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-radius: 8px;
    background: transparent;
    transform: translateX(20px);
    opacity: 0;
    overflow: visible;
}

.playlist-item.animate { animation: slideInFade 0.3s ease forwards; }

.playlist-header {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: end;
    gap: 12px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: transparent;
    padding: 8px;
    padding-right: 10px;
    overflow: visible;
}

.playlist-header:hover, .playlist-item:focus-within .playlist-header {
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.18) 100%);
    scale: 1.02;
}

.playlist-cover {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 4px;
    overflow: visible;
    background: var(--playlist-cover-image, linear-gradient(135deg, #222, #111));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid rgb(43, 43, 43);
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

/* Peeking record aesthetic */
.playlist-cover::before {
    content: '';
    position: absolute;
    right: -18px;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background:
      /* Grooves 1 */
      repeating-radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.04) 0px,
        rgba(255, 255, 255, 0.02) 1px,
        rgba(0, 0, 0, 0) 60px
      ),
      /* Grooves 2*/
      repeating-radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.03) 0px,
        rgba(255, 255, 255, 0.03) 1px,
        rgba(0, 0, 0, 0) 4px
      ),
      /* Light reflection 1 */
      conic-gradient(
        from 235deg at 50% 50%,
        rgba(130, 130, 130, 0.55) 0deg,
        rgba(20, 20, 20, 0.44) 33.54deg,
        rgba(0, 0, 0, 0.40) 151.56deg,
        rgba(130, 130, 130, 0.55) 180deg,
        rgba(0, 0, 0, 0.40) 202.54deg,
        rgba(0, 0, 0, 0.40) 325.48deg,
        rgba(130, 130, 130, 0.55) 360deg
      ),
      /* Light reflection 2*/
      conic-gradient(
        from 100deg at 50% 50%,
        rgba(105, 105, 105, 0.50) 0deg,
        rgba(1, 1, 1, 0.40) 33.54deg,
        rgba(0, 0, 0, 0.40) 151.56deg,
        rgba(105, 105, 105, 0.50) 180deg,
        rgba(0, 0, 0, 0.40) 202.54deg,
        rgba(0, 0, 0, 0.40) 325.48deg,
        rgba(105, 105, 105, 0.50) 360deg
      ),
      linear-gradient(135deg, #222 0%, #222a 100%),
      #222;
    z-index: -1;
}

.playlist-meta { text-align: right; font-size: 12px; line-height: 1.2; }
.playlist-name { 
    opacity: 0.95; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 24ch;
}
.playlist-description { 
    opacity: 0.6; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 20ch;
    font-size: 11px;
    margin-top: 2px;
}

.playlist-content {
    display: none;
    padding-left: calc(8px + (var(--nest-depth, 0) * 8px));
    border-left: 1px dashed rgba(255,255,255,0.1);
    margin-left: 8px;
    margin-right: 12px;
}

.playlist-item.expanded > .playlist-content { display: flex; flex-direction: column; gap: 8px; }

.song-item.in-playlist { padding-right: 10px; }

.song-meta {
    font-size: 12px;
    text-align: right;
    line-height: 1.2;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: end;
}

.song-title {
    opacity: 0.95;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 24ch;
}

.song-artist {
    opacity: 0.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 20ch;
}

/* Add song button and input */
.add-song-input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 12px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.add-song-input::placeholder {
    color: rgba(255,255,255,0.4);
}

.add-song-input:focus {
    outline: none;
    background: rgba(255,255,255,0.15);
}

/* Context Menu Styles */
.context-menu {
    position: fixed;
    background: #1b1b1b1c;
    backdrop-filter: blur(20px);
    border: 1px solid #ffffff1c;
    border-radius: 10px;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: none;
    font-size: 12px;
}

.context-menu-item {
    padding: 8px;
    margin: 2px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    transition: background-color 0.2s;
    text-transform: uppercase;
}

.context-menu-item:hover {
    background: linear-gradient(-90deg, #ffffff15 0%, #ffffff25 100%);
}

.context-menu-item.delete {
    color: #ff4444;
}

.context-menu-item i {
    font-size: 10px;
    width: 16px;
    text-align: center;
}

.context-menu-separator {
    height: 1px;
    background-color: #ffffff1c;
    margin: 1px 0;
}

/* Edit Dialog Styles */
.edit-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100001;
}

/* Edit Dialog Layout */
.edit-layout {
    display: flex;
    gap: 24px;
}

.edit-cover-section {
    flex: 0 0 auto;
}

.edit-fields-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 16px;
}

.edit-cover-section .custom-file-upload {
    margin-top: 8px;
}

.edit-cover-section .cover-preview {
    width: 180px;
    height: 180px;
}

.edit-dialog-content {
    background: #bdbdbd1c;
    border: 1px solid #ffffff1c;
    font-family: "Space Mono", monospace;
    backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    box-sizing: border-box;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    animation: editDialogIntro 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Edit dialog intro animation */
@keyframes editDialogIntro {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Update existing form styles */
.edit-form {
    width: 100%;
}

.edit-form .form-group {
    width: 100%;
    box-sizing: border-box;
}

.edit-fields-section .form-group {
    margin-bottom: 0;
}

.edit-form label {
    display: block;
    margin-bottom: 8px;
    color: #fff;
    font-size: 12px;
    opacity: 0.7;
}

.edit-form input[type="text"] {
    font-family: "Space Mono", monospace;
    outline: none;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    background: #58585862;
    color: #fff;
    font-size: 14px;
    box-sizing: border-box;
    height: 36px;
    transition: all 0.2s ease;
}

.edit-form input[type="text"]:focus {
    outline: none;
    background: #1616161c;
    border-color: #ffffff3d;
}

.edit-form input[type="file"] {
    width: 100%;
    padding: 8px 0;
    color: #fff;
    box-sizing: border-box;
}

/* Style the file input button */
.edit-form input[type="file"]::-webkit-file-upload-button {
    background: #3a3a3a;
    border: none;
    border-radius: 4px;
    color: #fff;
    padding: 6px 12px;
    margin-right: 12px;
    cursor: pointer;
}

.edit-form input[type="file"]::-webkit-file-upload-button:hover {
    background: #4a4a4a;
}

/* Update dialog buttons styles */
.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: auto;
    padding-top: 8px;
}

.dialog-buttons button {
    padding: 8px 24px;
    border-radius: 6px;
    border: none;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.dialog-buttons .cancel-btn {
    background: #3a3a3a;
    color: #fff;
}

.dialog-buttons .cancel-btn:hover {
    background: #4a4a4a;
}

.dialog-buttons .save-btn {
    background: #4CAF50;
    color: #fff;
}

.dialog-buttons .save-btn:hover {
    background: #43A047;
}

/* Custom File Upload Styles */
.custom-file-upload {
    position: relative;
    width: 100%;
    margin-top: 8px;
    transition: all 0.2s ease;
}

.custom-file-upload:hover {
    scale: 1.02;
}

.cover-preview {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    background-color: #58585862;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    opacity: 1;
    transition: transform 0.2s ease;
}

.cover-preview:hover {
    transform: scale(1.02);
}

.cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.cover-overlay i {
    font-size: 24px;
    margin-bottom: 8px;
}

.cover-overlay span {
    font-size: 12px;
}

.cover-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Hide the default file input button */
.cover-input::-webkit-file-upload-button {
    display: none;
}

/* Combined Add Music Panel Styles */
.add-music-panel {
    width: 30px;
    height: 30px;
    margin: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 100;
    transform-origin: center right;
    overflow: hidden;
}

.add-music-panel.expanded {
    width: min(320px, calc(100vw - 48px)); /* Responsive width with viewport constraint */
    height: auto;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    flex-direction: column;
    align-items: stretch;
    z-index: 1200; /* Higher than parent songs-panel (1100) */
    transform: scale(1); /* Ensure no scaling artifacts */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); /* Add depth */
}

.add-music-panel:hover:not(.expanded) {
    background: rgba(255,255,255,0.18);
    transform: scale(1.05);
}

.add-music-panel.expanded:hover {
    transform: scale(1);
    background: rgba(30, 30, 30, 0.95);
}

.add-music-button {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    opacity: 0.6;
    transition: all 0.2s ease;
    transform: rotate(0deg);
}

.add-music-panel:hover:not(.expanded) .add-music-button {
    opacity: 1;
    transform: scale(1.1) rotate(90deg); /* Subtle rotation on hover */
}

.add-music-content {
    display: none;
    width: 100%;
    flex-direction: column;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease 0.1s, transform 0.2s ease 0.1s; /* Delayed fade-in */
}

.add-music-panel.expanded .add-music-button {
    opacity: 0;
    transform: scale(0.8) rotate(45deg);
    pointer-events: none;
    transition: all 0.15s ease;
}

.add-music-panel.expanded .add-music-content {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* Smooth transition class for preventing layout jumps */
.add-music-panel.transitioning {
    will-change: width, height, transform;
}

/* Ensure content doesn't overflow during transition */
.add-music-panel.transitioning .add-music-content {
    overflow: hidden;
}

/* Media queries for smaller screens */
@media (max-width: 400px) {
    .add-music-panel.expanded {
        width: calc(100vw - 36px); /* Even more conservative on very small screens */
        margin: 18px 18px 18px 0; /* Adjust margins to prevent overflow */
    }
    
    .songs-panel {
        right: 18px; /* Reduce right margin on small screens */
    }
}

.add-music-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 12px;
}

.tab-button {
    flex: 1;
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.6);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.tab-button.active {
    color: #ffffff;
    border-bottom-color: rgba(139, 69, 19, 1);
}

.tab-button:hover {
    color: rgba(255,255,255,0.8);
}

.tab-content {
    display: none;
    flex-direction: column;
    cursor: default;
    gap: 12px;
}

.tab-content.active {
    display: flex;
}

.ai-generation-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
}

.add-song-submit-button {
    padding: 8px 16px;
    border-radius: 6px;
    background: rgba(139, 69, 19, 0.8);
    border: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.add-song-submit-button:hover {
    background: rgba(139, 69, 19, 1);
    transform: scale(1.05);
}

.add-song-submit-button:active {
    transform: scale(0.98);
}

.add-song-submit-button:disabled {
    background: rgba(255,255,255,0.1);
    cursor: not-allowed;
    transform: none;
}

.api-key-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.api-key-input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 12px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.api-key-input::placeholder {
    color: rgba(255,255,255,0.4);
}

.api-key-input:focus {
    outline: none;
    background: rgba(255,255,255,0.15);
}

.api-key-info {
    text-align: center;
}

.api-key-info small {
    color: rgba(255,255,255,0.6);
    font-size: 10px;
}

.api-key-info a {
    color: rgba(139, 69, 19, 1);
    text-decoration: none;
}

.api-key-info a:hover {
    text-decoration: underline;
}

.generate-music.form-mode .generate-music-button {
    display: none;
}

.generate-music.form-mode .generate-music-form {
    display: flex;
}

.music-prompt-input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 12px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    resize: vertical;
    min-height: 60px;
}

.music-prompt-input::placeholder {
    color: rgba(255,255,255,0.4);
}

.music-prompt-input:focus {
    outline: none;
    background: rgba(255,255,255,0.15);
}

.generate-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.music-length-select {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.music-length-select:focus {
    outline: none;
    background: rgba(255,255,255,0.15);
}

.music-length-select option {
    background: #1b1b1b;
    color: #ffffff;
}

.generate-button {
    padding: 8px 16px;
    border-radius: 6px;
    background: rgba(139, 69, 19, 0.8);
    border: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.generate-button:hover {
    background: rgba(139, 69, 19, 1);
    transform: scale(1.05);
}

.generate-button:active {
    transform: scale(0.98);
}

.generate-button:disabled {
    background: rgba(255,255,255,0.1);
    cursor: not-allowed;
    transform: none;
}

.generate-button:disabled:hover {
    background: rgba(255,255,255,0.1);
    transform: none;
}

/* Error Toast Styles */
.error-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.error-toast {
    background: rgba(220, 38, 38, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 16px 20px;
    color: #ffffff;
    font-family: "Space Mono", monospace;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    max-width: 400px;
    min-width: 300px;
    box-shadow: 0 8px 32px rgba(220, 38, 38, 0.3);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(100%) scale(0.9);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.error-toast.show {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.error-toast.hide {
    opacity: 0;
    transform: translateX(100%) scale(0.9);
    transition: all 0.3s ease-in;
}

.error-toast-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.error-toast-icon {
    font-size: 14px;
    color: #fecaca;
}

.error-toast-title {
    font-weight: 600;
    color: #fecaca;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.error-toast-message {
    line-height: 1.4;
    color: #ffffff;
    font-size: 12px;
    margin-bottom: 12px;
}

.error-toast-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

.error-toast-button {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}

.error-toast-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.error-toast-button.primary {
    background: rgba(255, 255, 255, 0.2);
}

.error-toast-button.primary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.error-toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
}

.error-toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* Success Toast Styles */
.success-toast {
    background: rgba(34, 197, 94, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(34, 197, 94, 0.3);
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.3);
}

.success-toast::before {
    background: linear-gradient(90deg, #22c55e, #16a34a, #15803d);
}

.success-toast .error-toast-icon {
    color: #bbf7d0;
}

.success-toast .error-toast-title {
    color: #bbf7d0;
}

/* Warning Toast Styles */
.warning-toast {
    background: rgba(245, 158, 11, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(245, 158, 11, 0.3);
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.3);
}

.warning-toast::before {
    background: linear-gradient(90deg, #f59e0b, #d97706, #b45309);
}

.warning-toast .error-toast-icon {
    color: #fef3c7;
}

.warning-toast .error-toast-title {
    color: #fef3c7;
}

/* AI Generation Overlay */
.ai-generation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(15px) saturate(1.2);
    -webkit-backdrop-filter: blur(15px) saturate(1.2);
    user-select: none;
}

.ai-generation-overlay.active {
    display: flex;
    opacity: 1;
}

.ai-generation-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 400px;
    padding: 40px;
}

.ai-generation-text {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.ai-generation-subtext {
    font-size: 14px;
    opacity: 0.7;
    margin-bottom: 30px;
    text-transform: none;
    letter-spacing: 1px;
}

.ai-progress-container {
    width: 300px;
    margin-bottom: 30px;
}

.ai-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 10px;
}

.ai-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ECDC4, #45B7D1);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.ai-progress-text {
    font-size: 12px;
    opacity: 0.6;
    text-align: center;
}

.ai-cancel-button {
    background: rgba(220, 38, 38, 0.2);
    border: 1px solid rgba(220, 38, 38, 0.4);
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: "Space Mono", monospace;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: none;
}

.ai-cancel-button:hover {
    background: rgba(220, 38, 38, 0.3);
    border-color: rgba(220, 38, 38, 0.6);
    transform: translateY(-1px);
}

.ai-cancel-button.visible {
    display: block;
}

/* Delete Confirmation Dialog Styles */
.delete-confirmation-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100002;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(10px);
}

.delete-confirmation-dialog.active {
    display: flex;
    opacity: 1;
}

.delete-dialog-content {
    background: #1b1b1b;
    border: 1px solid #ffffff1c;
    font-family: "Space Mono", monospace;
    backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    box-sizing: border-box;
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    animation: deleteDialogIntro 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

@keyframes deleteDialogIntro {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.delete-dialog-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.delete-dialog-header i {
    color: #ff4444;
    font-size: 20px;
}

.delete-dialog-header h3 {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.delete-dialog-message {
    color: #ffffff;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.delete-dialog-message span {
    color: #ff4444;
    font-weight: 600;
}

.delete-dialog-warning {
    color: #ff4444;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 24px;
    opacity: 0.8;
}

.delete-dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.delete-dialog-buttons button {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: "Space Mono", monospace;
}

.delete-cancel-btn {
    background: #3a3a3a;
    color: #ffffff;
}

.delete-cancel-btn:hover {
    background: #4a4a4a;
    transform: scale(1.05);
}

.delete-confirm-btn {
    background: #ff4444;
    color: #ffffff;
}

.delete-confirm-btn:hover {
    background: #ff3333;
    transform: scale(1.05);
}

.delete-confirm-btn:active {
    transform: scale(0.98);
}

.song-item.loading {
    opacity: 0.7;
    pointer-events: none;
}
.song-item.loading .song-cover-inner {
    animation: pulse 1.5s ease-in-out infinite;
}
.song-item.loading .song-title,
.song-item.loading .song-artist {
    color: #666;
}
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Progressive generation styles */
.song-item.generating .song-cover-dot {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { 
        opacity: 0.4;
    }
    50% { 
        opacity: 1;
    }
}


.song-artist.generating-status {
    font-style: italic;
    animation: text-fade 3s ease-in-out infinite;
}

@keyframes text-fade {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.generation-time-indicator {
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
    font-family: 'Space Mono', monospace;
}

/* Fade out animation for removing items */
.song-item.fade-out {
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    opacity: 0;
    transform: translateX(-20px);
}

/* Mobile positioning for songs button and panel */
@media (max-width: 768px) {
    .songs-button {
        top: 24px;
        right: 24px;
        bottom: auto;
    }
    
    .songs-panel {
        top: 90px;
        right: 12px;
        bottom: auto;
        flex-direction: column-reverse!important;
    }
}