* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f1f1;
  font-family: Arial, Helvetica, sans-serif;
  padding: 20px;
}

.container {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  padding: 25px;
  border: 3px dashed transparent;
}

.container.drag-over {
  border-color: purple;
  background: #f7f0fa;
}

#music-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  border: 3px dashed transparent;
}

#music-image.drag-over {
  border-color: purple;
  opacity: 0.7;
}

#music-details {
  text-align: center;
  margin-top: 15px;
}

.title {
  font-size: 20px;
  font-weight: bold;
  margin: 0;
}

.singer {
  font-size: 14px;
  color: #6c757d;
  margin: 4px 0 0;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3ecf7;
  border-radius: 999px;
  padding: 4px;
  margin-top: 15px;
}

#toggle-file-controls {
  display: block;
  width: 28px;
  height: 20px;
  line-height: 20px;
  margin: 6px auto 0;
  text-align: center;
  font-size: 12px;
  color: #adb5bd;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.15s ease;
}

#toggle-file-controls:hover {
  color: purple;
}

#file-controls-wrapper {
  overflow: hidden;
  max-height: 120px;
  opacity: 1;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

#file-controls-wrapper.collapsed {
  max-height: 0;
  opacity: 0;
}

#file-controls {
  margin-top: 6px;
  background: none;
  padding: 0;
  gap: 2px;
}

#file-controls > i,
#file-controls > a {
  width: 30px;
  height: 30px;
}

#file-controls i {
  font-size: 13px;
}

#file-controls #help-btn {
  font-size: 15px;
}

.control-row > i,
.control-row > a {
  position: relative;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.control-row > i:not(:last-child)::after,
.control-row > a:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 55%;
  background: rgba(128, 0, 128, 0.15);
}

.control-row > i:hover,
.control-row > a:hover {
  background: rgba(128, 0, 128, 0.12);
}

.control-row > i:hover::after,
.control-row > a:hover::after {
  display: none;
}

.control-row > i:active,
.control-row > a:active {
  transform: scale(0.92);
}

#help-btn {
  color: #6c757d;
  font-size: 18px;
}

#folder-status {
  margin-top: 10px;
  font-size: 12px;
  color: #6c757d;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-status-icon {
  color: purple;
  margin-right: 4px;
}

@media (max-width: 420px) {
  .container {
    padding: 18px;
    border-radius: 12px;
  }

  .control-row > i,
  .control-row > a {
    width: 34px;
    height: 34px;
  }

  .control-row i {
    font-size: 15px;
  }
}

.control-row i {
  font-size: 17px;
  color: purple;
}

#autoplay-toggle {
  color: #6c757d;
  cursor: pointer;
}

#autoplay-toggle.active {
  color: purple;
}

#shuffle-toggle {
  color: #6c757d;
  cursor: pointer;
}

#shuffle-toggle.active {
  color: purple;
}

#connect-folder-btn {
  color: #6c757d;
  cursor: pointer;
}

#connect-folder-btn.connected {
  color: purple;
}

.title,
.singer {
  outline: none;
  border-radius: 4px;
  padding: 2px 4px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.title:focus,
.singer:focus {
  background: #f1f1f1;
  /* While editing, let long text scroll instead of being clipped. */
  overflow-x: auto;
  text-overflow: clip;
}

#time-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #6c757d;
}

#progress-container {
  width: 100%;
  height: 6px;
  background: #ddd;
  border-radius: 3px;
  cursor: pointer;
  margin: 15px 0;
}

#progress-bar {
  width: 0%;
  height: 100%;
  background: purple;
  border-radius: 3px;
}

#volume-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
}

#volume-icon {
  font-size: 18px;
  color: purple;
  width: 20px;
  cursor: pointer;
}

#volume-slider {
  flex: 1;
  accent-color: purple;
  cursor: pointer;
}

#playlist-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}

#search-input {
  flex: 1;
  min-width: 0;
  padding: 7px 12px;
  font-size: 13px;
  border: 1px solid #ddd;
  border-radius: 999px;
  outline: none;
  transition: border-color 0.15s ease;
}

#search-input:focus {
  border-color: purple;
}

#sort-btn {
  font-size: 15px;
  color: #6c757d;
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

#sort-btn:hover {
  color: purple;
  background: rgba(128, 0, 128, 0.1);
}

#sort-btn.active {
  color: purple;
}

#playlist {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
  border-radius: 6px;
}

#playlist li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
}

#playlist li:hover {
  background: #f1f1f1;
}

#playlist li.playing {
  background: purple;
  color: white;
}

.playlist-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-item-duration {
  flex-shrink: 0;
  font-size: 12px;
  color: #6c757d;
}

#playlist li.playing .playlist-item-duration {
  color: #e6d6f0;
}

.playlist-item-delete {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  color: #adb5bd;
  cursor: pointer;
}

.playlist-item-delete:hover {
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
}

#playlist li.playing .playlist-item-delete {
  color: #e6d6f0;
}

#playlist li.playing .playlist-item-delete:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}
