:root {
  --bg-main: #1b1b1b;
  --bg-card: #373737;
  --border: #111;
  --text-primary: whitesmoke;
  --text-muted: silver;
  --text-highlight: snow;

  /* color pallet (see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/named-color)
  black
  dimgray
  gray
  darkgray
  lightgray
  silver
  whitesmoke
  gainsboro
  ivory
  snow
  white
  */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #1b1a1a;
  min-height: 100vh;
  color: var(--text-primary);
}

header {
  background: var(--bg-main);
  padding: 1rem 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

header nav {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1.8rem;
  color: var(--text-primary);
  font-weight: 700;
}

header .nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

header a,
header form {
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 500;
  transition: color 0.2s;
}

header a:hover {
  color: var(--text-highlight);
}

header button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 1rem;
  transition: color 0.2s;
}

header button:hover {
  color: var(--text-highlight);
}

.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.page-narrow {
  max-width: 500px;
  margin: 2rem auto;
}

.page-medium {
  max-width: 600px;
  margin: 2rem auto;
}

.page-small {
  max-width: 400px;
  margin: 4rem auto;
}

.page-wide {
  max-width: 1200px;
  margin: 2rem auto;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
}

.align-end {
  justify-content: flex-end;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-input {
  width: auto;
  padding: 0;
  border: none;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-start {
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.gap-sm {
  gap: 0.5rem;
}

.mb-05 {
  margin-bottom: 0.5rem;
}

.mb-075 {
  margin-bottom: 0.75rem;
}

.mb-1 {
  margin-bottom: 1rem;
}

.mb-15 {
  margin-bottom: 1.5rem;
}

.mb-2 {
  margin-bottom: 2rem;
}

.mt-1 {
  margin-top: 1rem;
}

.text-muted {
  color: var(--text-muted);
}

.text-small {
  font-size: 0.9rem;
}

.text-xsmall {
  font-size: 0.85rem;
}

.text-center {
  text-align: center;
}

.is-hidden {
  display: none !important;
}

.form-inline-reset {
  margin: 0;
}

.btn.secondary,
button.secondary {
  background: #f0f0f0;
  color: #666;
  box-shadow: none;
}

.btn.secondary:hover,
button.secondary:hover {
  background: #e0e0e0;
}

.btn.danger,
button.danger {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn-muted {
  background: #f0f0f0;
  color: #666;
}

.btn-muted:hover {
  background: #e0e0e0;
}

.btn-sm {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
}

.content {
  max-width: 500px;
  margin: 4rem auto;
}

.card {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  margin-bottom: 2rem;
}

h2 {
  color: #eee;
  margin-bottom: 1.5rem;
  font-size: 1.6rem;
}

h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.button-group {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

button,
.btn,
input[type="submit"],
input[type="button"] {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--text-primary);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  display: inline-block;
}

button:hover,
.btn:hover,
input[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--border);
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
textarea,
select {
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="file"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #667eea;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.member-list {
  list-style: none;
}

.member-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #eee;
}

.member-item:last-child {
  border-bottom: none;
}

.member-info {
  flex: 1;
}

.member-username {
  font-weight: 600;
  color: #333;
}

.member-role {
  font-size: 0.9rem;
  color: #999;
  margin-top: 0.25rem;
}

.member-actions {
  display: flex;
  gap: 0.5rem;
}

.collaboration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.collaboration-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
}

.collaboration-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.collaboration-card h3 {
  margin-bottom: 0.5rem;
}

.collaboration-card p {
  color: var(--text-primary);
  font-size: 0.9rem;
}

.recordings-list {
  list-style: none;
}

.recording-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #eee;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s;
}

.recording-item:hover {
  background: #f9f9f9;
}

.recording-item:last-child {
  border-bottom: none;
}

.recording-info {
  flex: 1;
}

.recording-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.recording-meta {
  font-size: 0.9rem;
  color: #999;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tags.is-hidden {
  display: none;
}

.tag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.tag-card-link {
  text-decoration: none;
  color: inherit;
}

.tag-card {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 1.5rem;
  cursor: pointer;
  transition: background 0.2s;
}

.tag-card:hover {
  background: #f0f0f0;
}

.tag-card-title {
  color: #667eea;
}

.tag-card-meta {
  color: #999;
  font-size: 0.9rem;
}

.tag-card-submeta {
  color: #ccc;
  font-size: 0.85rem;
}

.tag-empty,
.recording-empty,
.comments-empty {
  text-align: center;
  color: #999;
}

.tag {
  background: #f0f0f0;
  color: #666;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  text-decoration: none;
}

.tag:hover {
  background: #e0e0e0;
}

.invite-section {
  background: var(--bg-card);
  border: 2px solid #667eea;
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.invite-section h3 {
  /* color: #667eea; */
}

.upload-note,
.upload-helper {
  color: #666;
}

.upload-helper {
  margin-bottom: 1rem;
}

.upload-alert {
  margin-bottom: 1rem;
}

.upload-list {
  margin-left: 1.25rem;
}

.file-input-hidden {
  display: none;
}

.upload-dropzone {
  border: 2px dashed #667eea;
  margin-bottom: 1rem;
}

.upload-dropzone.is-drag-active {
  border-color: #764ba2;
  background: #f6f3ff;
}

.upload-dropzone-text {
  margin-bottom: 0.75rem;
}

.upload-dropzone-actions {
  margin-bottom: 0.5rem;
}

.selected-files {
  margin-bottom: 1rem;
  color: #666;
}

.invite-link {
  background: whitesmoke;
  /* border: 1px solid #e0e0e0; */
  padding: 1rem;
  border-radius: 6px;
  word-break: break-all;
  /* font-family: 'Courier New', monospace; */
  font-size: 0.9rem;
  margin: 1rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: dimgray;
}

.invite-link code {
  flex: 1;
}

.copy-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-left: 1rem;
}

.copy-btn:hover {
  background: #764ba2;
}

#waveform {
  height: 120px;
}

.recording-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 1.5rem;
}

.recording-description {
  color: #666;
  margin-bottom: 1rem;
}

.recording-meta {
  font-size: 0.9rem;
  color: #999;
}

.recording-tags-section {
  margin-bottom: 1rem;
}

.recording-tags-list {
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

.recording-add-tags-form {
  gap: 0.5rem;
}

.recording-tag-label {
  font-size: 0.95rem;
}

.recording-tag-textarea {
  min-height: 80px;
}

.recording-tags-empty {
  margin: 0.5rem 0 0.75rem;
}

.recording-arrow {
  font-size: 1.5rem;
}

.recording-tags-spaced {
  margin-top: 0.5rem;
}

.comment-delete-form {
  margin: 0;
}

.comment-delete-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.reply-form-offset {
  margin-top: 1rem;
}

.comment-no-state {
  text-align: center;
  color: #999;
}

/* Waveform and audio player styles */
.player-section {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}

#waveform {
  margin-bottom: 1rem;
}

.player-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.player-controls button {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.time-display {
  color: #666;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
}

/* Comments section */
.comments-section {
  margin-top: 2rem;
}

.comments-list {
  list-style: none;
}

.comment {
  background: #f9f9f9;
  border-left: 4px solid #667eea;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 4px;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.comment-author {
  font-weight: 600;
  color: #333;
}

.comment-time {
  font-size: 0.85rem;
  color: #999;
}

.comment-timestamp {
  display: inline-block;
  background: #e8f0ff;
  color: #667eea;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-left: 0.5rem;
  cursor: pointer;
  font-family: 'Courier New', monospace;
}

.comment-timestamp:hover {
  background: #d0e0ff;
}

.comment-text {
  color: #555;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.comment-actions {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
}

.comment-actions button {
  background: none;
  border: none;
  color: #667eea;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.comment-actions button:hover {
  color: #764ba2;
}

.comment-replies {
  list-style: none;
  margin-top: 1rem;
  padding-left: 1.5rem;
  border-left: 2px solid #eee;
}

.comment-reply {
  background: white;
  border-left: none;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.reply-form {
  background: white;
  border-left: none;
  padding: 1rem;
  border-radius: 4px;
}

.reply-form input,
.reply-form textarea {
  width: 100%;
  margin-bottom: 0.5rem;
}

.reply-form-actions {
  display: flex;
  gap: 0.5rem;
}

.reply-form-actions button {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.alert {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.alert-danger {
  background: #ffe8e8;
  border: 1px solid #f5a5a5;
  color: #c91818;
}

.alert-warning {
  background: #fff4e8;
  border: 1px solid #ffc899;
  color: #a65c00;
}

.alert-success {
  background: #e8ffe8;
  border: 1px solid #a5f5a5;
  color: #186c18;
}

.error {
  color: #f5576c;
  font-size: 0.9rem;
}

footer {
  text-align: center;
  padding: 2rem;
  color: white;
  margin-top: 4rem;
}

@media (max-width: 768px) {
  header nav {
    flex-direction: column;
    gap: 1rem;
  }

  header h1 {
    font-size: 1.4rem;
  }

  header .nav-links {
    flex-direction: column;
    gap: 1rem;
    width: 100%;
  }

  .collaboration-grid {
    grid-template-columns: 1fr;
  }

  .button-group {
    flex-direction: column;
  }

  button,
  .btn,
  input[type="submit"] {
    width: 100%;
  }
}