:root {
  color-scheme: dark;
  --bg: #060712;
  --surface: #11151f;
  --surface-strong: #171d2b;
  --text: #e4e9ff;
  --muted: #94a4c8;
  --accent: #7efff4;
  --accent-2: #ff4dbe;
  --border: rgba(126, 255, 244, 0.18);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, system-ui, sans-serif;
  background: radial-gradient(circle at top, rgba(126,255,244,0.12), transparent 30%),
    linear-gradient(180deg, #05070b 0%, #080a10 100%);
  color: var(--text);
}

body {
  padding: 24px;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(8, 12, 18, 0.88);
  box-shadow: var(--shadow);
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: clamp(2rem, 2.5vw, 2.6rem);
  letter-spacing: 0.05em;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.status {
  align-self: center;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(126, 255, 244, 0.12);
  color: var(--accent);
  font-size: 0.96rem;
}

main {
  display: grid;
  gap: 24px;
  margin-top: 24px;
}

.intro-panel {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 20px;
  align-items: center;
  padding: 30px;
  background: linear-gradient(180deg, rgba(126,255,244,0.08), rgba(255,77,190,0.06));
  border: 1px solid rgba(126,255,244,0.12);
}

.intro-copy h2 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 2.5vw, 2.4rem);
}

.intro-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
  max-width: 720px;
}

.intro-actions {
  display: flex;
  gap: 14px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(10, 14, 24, 0.96);
  box-shadow: var(--shadow);
  padding: 24px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

button {
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  font: inherit;
  cursor: pointer;
  color: var(--text);
  background: linear-gradient(135deg, rgba(126,255,244,0.18), rgba(255,77,190,0.18));
  transition: transform 0.18s ease, background 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, rgba(126,255,244,0.28), rgba(255,77,190,0.28));
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--text);
  background: linear-gradient(135deg, rgba(126,255,244,0.18), rgba(255,77,190,0.18));
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (max-width: 860px) {
  .intro-panel {
    grid-template-columns: 1fr;
  }
}

.primary {
  background: linear-gradient(135deg, #7efff4, #ff4dbe);
  color: #020411;
}

.upload-form {
  display: grid;
  gap: 16px;
}

.upload-form label {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--muted);
}

.upload-form input[type="text"],
.upload-form input[type="date"],
.upload-form input[type="file"],
.upload-form select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(126,255,244,0.15);
  background: rgba(9, 13, 22, 0.96);
  color: var(--text);
}

.upload-form select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgba(126,255,244,0.5)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px;
}

.form-note {
  color: var(--accent);
  font-size: 0.95rem;
  margin: 0 0 -8px;
}

.muted-text {
  color: var(--muted);
}

.song-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

/* Tree List Styles */
.song-tree {
  display: grid;
  gap: 8px;
}

.category-node {
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(12, 17, 28, 0.96);
  border: 1px solid rgba(126,255,244,0.1);
  margin-bottom: 8px;
  cursor: default;
}

.category-node h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  color: var(--accent);
}

.category-node p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.song-tree-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(10, 14, 24, 0.98);
  border: 1px solid rgba(126,255,244,0.08);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  margin-left: 24px;
}

.song-tree-item:hover {
  transform: translateX(2px);
  border-color: rgba(126,255,244,0.28);
  box-shadow: 0 4px 12px rgba(126,255,244,0.08);
}

.song-tree-item.has-new-comments {
  border-left: 4px solid var(--accent);
  background: rgba(14, 20, 32, 0.98);
}

/* Indikator für neue Kommentare in der Songliste */
.new-comment-indicator {
  margin-left: 8px;
  color: var(--accent);
  font-size: 1.1rem;
  animation: pulse 1.6s ease-in-out infinite;
}

.song-tree-item.has-new-comments:hover {
  border-left: 4px solid var(--accent-2);
  box-shadow: 0 4px 12px rgba(255,77,190,0.08);
}

.reply-item.has-new-reply {
  border-left: 3px solid var(--accent);
}

.song-tree-item .new-comment-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 6px var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}

.song-tree-item .song-info {
  flex: 1;
  min-width: 0;
}

.song-tree-item h4 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.song-tree-item .song-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.song-tree-item .song-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.song-tree-item button {
  padding: 8px 12px;
  font-size: 0.85rem;
  min-width: auto;
}

@keyframes pulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

.song-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(12, 17, 28, 0.96);
  border: 1px solid rgba(126,255,244,0.1);
}

.song-card h3 {
  margin: 0 0 10px;
}

.song-card p {
  margin: 4px 0;
  color: var(--muted);
}

.song-card button {
  width: auto;
}

.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.danger {
  background: rgba(255, 69, 126, 0.14);
  color: #ff7aa7;
}

.hidden {
  display: none;
}

/* New comment indicator animation */
@keyframes pulse-new {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

.player-card {
  display: grid;
  gap: 18px;
}

.player-controls {
  display: grid;
  gap: 12px;
  width: 100%;
}

.player-button-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
  gap: 12px;
  align-items: center;
}

.player-controls button {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1.2rem;
  background: rgba(255,255,255,0.03);
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
  color: var(--text);
}

.player-progress-row {
  display: grid;
  gap: 10px;
}

/* playing state */
.icon-button.playing {
  background: linear-gradient(135deg, rgba(126,255,244,0.95), rgba(255,77,190,0.95));
  color: #020411;
  box-shadow: 0 6px 24px rgba(126,255,244,0.12), 0 0 36px rgba(255,77,190,0.08) inset;
  transform: scale(1.04);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 6px 12px rgba(126,255,244,0.08); }
  50% { box-shadow: 0 8px 28px rgba(126,255,244,0.16); }
  100% { box-shadow: 0 6px 12px rgba(126,255,244,0.08); }
}

/* brief pressed animation */
.icon-button.pressed {
  transform: scale(0.94);
}

/* different accent for skip buttons on hover */
#back10Button:hover, #fwd10Button:hover {
  background: linear-gradient(135deg, rgba(255,77,190,0.12), rgba(126,255,244,0.08));
}
#back1Button:hover, #fwd1Button:hover {
  background: linear-gradient(135deg, rgba(126,255,244,0.12), rgba(255,77,190,0.06));
}


.progress-wrapper {
  position: relative;
  height: 12px;
  width: 100%;
  border-radius: 999px;
  background: rgba(126,255,244,0.1);
  cursor: pointer;
  overflow: hidden;
}

/* Compact track selector row above player controls */
.track-selector-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.track-toggle {
  padding: 6px 10px;
  font-size: 0.85rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border: 1px solid rgba(126,255,244,0.08);
  min-width: 64px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.track-toggle.active {
  background: linear-gradient(135deg, rgba(126,255,244,0.95), rgba(255,77,190,0.95));
  color: #020411;
  border-color: rgba(126,255,244,0.28);
  box-shadow: 0 6px 18px rgba(126,255,244,0.06);
}

.track-toggle svg {
  width: 14px;
  height: 14px;
}

.progress-wrapper .comment-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.comment-marker {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 999px;
  opacity: 0.35;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
  background: rgba(255,255,255,0.08);
  font-size: 0.95rem;
  cursor: pointer;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.75);
}

.profile-card {
  width: min(520px, calc(100% - 40px));
  padding: 28px;
  border-radius: 24px;
  background: rgba(12, 17, 28, 0.98);
  border: 1px solid rgba(126,255,244,0.14);
  box-shadow: var(--shadow);
}

.profile-card h2 {
  margin-top: 0;
}

.profile-buttons {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.profile-buttons button {
  width: 100%;
  justify-content: flex-start;
}

.comment-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(14, 20, 32, 0.98);
  border: 1px solid rgba(126,255,244,0.12);
}

/* Make comment form responsive */
.comment-form {
  display: grid;
  gap: 12px;
}

@media (max-width: 640px) {
  .player-button-row {
    grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
  }

  .comment-actions-row {
    grid-template-columns: 1fr;
  }

  .comment-action-group {
    grid-template-columns: 1fr;
  }

  .comment-action-group label {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .comment-action-group button {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.9rem;
  }
}

.comment-panel.collapsed .comment-body {
  display: none;
}

.comments-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.comment-toggle {
  border: 1px solid rgba(126,255,244,0.15);
  background: rgba(126,255,244,0.08);
  color: var(--text);
  border-radius: 14px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  font-size: 1.15rem;
}

.comment-panel.collapsed .comment-toggle {
  opacity: 0.9;
}

.comment-form {
  display: grid;
  gap: 12px;
}

.comment-form textarea {
  width: 100%;
  min-height: 96px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(126,255,244,0.15);
  background: rgba(9, 13, 22, 0.96);
  color: var(--text);
  resize: vertical;
}

.comment-actions-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.comment-action-group {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.comment-action-group label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

.comment-action-group input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(126,255,244,0.15);
  background: rgba(9, 13, 22, 0.96);
  color: var(--text);
}

.comment-time-inputs {
  display: none;
}

.comment-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.comment-item {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(10, 14, 24, 0.98);
  border: 1px solid rgba(126,255,244,0.08);
}

.comment-item.active {
  box-shadow: 0 0 0 2px rgba(126,255,244,0.18);
  border-color: rgba(126,255,244,0.28);
}

.comment-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.comment-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  color: #020411;
  font-weight: 700;
}

.comment-description {
  color: var(--muted);
  font-size: 0.92rem;
}

.comment-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.comment-actions button {
  padding: 10px 14px;
}

.comment-actions button.danger {
  background: rgba(255, 69, 126, 0.14);
  color: #ff7aa7;
}

/* Sub-Kommentare Styles */
.comment-reply-form {
  display: grid;
  gap: 10px;
  margin-top: 8px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(8, 12, 18, 0.96);
  border: 1px solid rgba(126,255,244,0.08);
}

.comment-reply-form textarea {
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(126,255,244,0.15);
  background: rgba(9, 13, 22, 0.96);
  color: var(--text);
  resize: vertical;
  font-size: 0.9rem;
}

.comment-reply-form .reply-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.comment-reply-form button {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.comment-replies {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px solid rgba(126,255,244,0.12);
}

.reply-item {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(10, 14, 24, 0.98);
  border: 1px solid rgba(126,255,244,0.06);
  margin-left: 8px;
}

.reply-item:hover {
  border-color: rgba(126,255,244,0.18);
}

.reply-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.reply-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #020411;
  font-weight: 700;
  font-size: 0.85rem;
}

.reply-description {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0;
}

.reply-time {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
  text-align: right;
}

.reply-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.reply-actions button {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.reply-form-container {
  margin-top: 6px;
}

.reply-form-container .reply-button {
  padding: 6px 10px;
  font-size: 0.8rem;
  background: rgba(126,255,244,0.08);
  border: 1px solid rgba(126,255,244,0.12);
  color: var(--muted);
}

.reply-form-container .reply-button:hover {
  background: rgba(126,255,244,0.14);
  color: var(--text);
}

.new-reply-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-right: 4px;
}

.comment-time {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.92rem;
}

.comment-item:hover {
  transform: translateY(-1px);
}

.hidden {
  display: none;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7efff4, #ff4dbe);
}

.time-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.93rem;
}

@media (max-width: 860px) {
  .topbar, .panel {
    padding: 18px;
  }

  body {
    padding: 16px;
  }
}

@media (max-width: 640px) {
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .song-grid {
    grid-template-columns: 1fr;
  }

  .song-tree-item {
    flex-direction: column;
    align-items: stretch;
    margin-left: 16px;
  }

  .song-tree-item .song-actions {
    justify-content: flex-end;
  }

  .comment-actions-row {
    grid-template-columns: 1fr;
  }

  .comment-action-group {
    grid-template-columns: 1fr;
  }

  .comment-action-group label {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .comment-action-group button {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .song-tree-item .song-meta {
    flex-direction: column;
    gap: 4px;
  }
}

/* Download Overlay Styles */
.download-card {
  width: min(480px, calc(100% - 40px));
  padding: 28px;
  border-radius: 24px;
  background: rgba(12, 17, 28, 0.98);
  border: 1px solid rgba(126, 255, 244, 0.14);
  box-shadow: var(--shadow);
  text-align: center;
}

.download-card h2 {
  margin: 0 0 12px;
  font-size: 1.6rem;
  color: var(--accent);
}

.download-card p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 1rem;
}

.download-progress-container {
  position: relative;
  height: 16px;
  width: 100%;
  border-radius: 999px;
  background: rgba(126, 255, 244, 0.1);
  margin: 20px 0;
  overflow: hidden;
}

.download-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7efff4, #ff4dbe);
  transition: width 0.3s ease;
}

#downloadProgressPercent {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.download-details {
  display: grid;
  gap: 8px;
  text-align: left;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(126, 255, 244, 0.08);
}

.download-file-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.download-file-item .filename {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-file-item.completed {
  color: #7efff4;
}

.download-file-item.error {
  color: #ff7aa7;
}

/* Disable play button when not ready */
#playPauseButton:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* Loading state for play button */
#playPauseButton.loading {
  pointer-events: none;
}

#playPauseButton.loading svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
