@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,700&family=Space+Grotesk:wght@400;500;600&display=swap");

:root {
  color-scheme: light;
  --bg: #f4efe8;
  --bg-2: #f8f5f0;
  --ink: #1f1d1a;
  --muted: #5d5a55;
  --accent: #d97706;
  --accent-soft: #fcd34d;
  --surface: #ffffff;
  --surface-2: #fcfbf8;
  --border: #e1d7c7;
  --shadow: 0 18px 40px rgba(31, 29, 26, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: "Space Grotesk", "Avenir Next", "Helvetica Neue", sans-serif;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff7e6 0%, transparent 55%),
    radial-gradient(circle at 20% 40%, #fef3c7 0%, transparent 60%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(244, 239, 232, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand {
  font-family: "Fraunces", "Times New Roman", serif;
  text-decoration: none;
  font-size: 1.35rem;
  font-weight: 700;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.topbar-user {
  color: var(--muted);
  font-size: 0.92rem;
}

h1,
h2,
h3 {
  font-family: "Fraunces", "Times New Roman", serif;
  letter-spacing: -0.02em;
}

a {
  color: inherit;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.page-hero,
.song-hero {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--shadow);
}

.page-hero h1,
.song-hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2.3rem, 4vw, 3.4rem);
}

.eyebrow {
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.lede {
  margin: 0;
  color: var(--muted);
  max-width: 34rem;
  line-height: 1.6;
}

.hero-actions,
.song-hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-panel {
  margin: 2rem 0 1.5rem;
}

.search-form {
  display: flex;
  width: 100%;
}

.search-input-wrap {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 1rem 1.25rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1rem;
  box-shadow: 0 12px 24px rgba(31, 29, 26, 0.08);
}

.search-input:focus {
  outline: 2px solid rgba(217, 119, 6, 0.35);
  border-color: var(--accent);
}

.search-meta {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.85rem;
}

.songs-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.song-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 12px 24px rgba(31, 29, 26, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.song-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(31, 29, 26, 0.14);
}

.song-card-link:focus-visible {
  outline: 2px solid rgba(217, 119, 6, 0.5);
  outline-offset: 2px;
}

.song-title {
  margin: 0;
  font-size: 1.2rem;
}

.song-meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}

.song-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.badge {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: #fff7ed;
  color: #92400e;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-soft {
  background: #fef9c3;
  color: #854d0e;
}

.badge-accent {
  background: #ecfccb;
  color: #3f6212;
}

.song-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 12px 28px rgba(31, 29, 26, 0.1);
}

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

.panel-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.panel-count {
  color: var(--muted);
  font-size: 0.9rem;
}

.form-hero {
  align-items: center;
}

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

.chip {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.9rem;
  font-weight: 600;
}

.chip-muted {
  background: #e2e8f0;
  color: #334155;
}

.hint {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.chords-block,
.chords-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}

.chords-block {
  white-space: pre-wrap;
  background: #f8fafc;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.chords-input {
  width: 100%;
  min-height: 240px;
}

.chord-image img {
  max-height: 80vh;
  width: auto;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.attachment-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.attachment-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.attachment-card.is-removed {
  opacity: 0.55;
  transform: scale(0.98);
  box-shadow: none;
}

.attachment-card__thumb img {
  width: 86px;
  height: 86px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}

.attachment-card__icon {
  width: 86px;
  height: 86px;
  border-radius: 12px;
  background: #111827;
  color: #f8fafc;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.attachment-card__meta {
  min-width: 0;
}

.attachment-card__name {
  margin: 0;
  font-weight: 600;
  word-break: break-word;
}

.attachment-card__sub {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.attachment-card__remove {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: #1f2937;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.attachment-card__remove:hover {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}

.attachment-remove-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.videos-section {
  margin-top: 2rem;
}

.video-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.video-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem;
}

.video-player {
  width: 100%;
  max-height: 320px;
  border-radius: 10px;
  background: #111827;
}

.video-meta {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  word-break: break-word;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.text-input,
.text-area {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  box-shadow: 0 8px 16px rgba(31, 29, 26, 0.05);
}

.text-input:focus,
.text-area:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2);
}

.text-area {
  min-height: 220px;
  resize: vertical;
}

.form-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1.75rem;
  margin-top: 2rem;
  align-items: start;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--shadow);
  animation: lift-in 0.35s ease;
}

.form-aside {
  position: sticky;
  top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.aside-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: 0 12px 24px rgba(31, 29, 26, 0.08);
}

.aside-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.aside-text {
  margin: 0 0 0.75rem 0;
  color: var(--muted);
  line-height: 1.5;
}

.aside-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  line-height: 1.6;
}

.form-section {
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px dashed var(--border);
}

.form-section:last-of-type {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2 {
  margin: 0 0 0.35rem 0;
  font-size: 1.5rem;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}

.form-actions {
  margin-top: 2rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.dropzone {
  position: relative;
  padding: 1.25rem;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: linear-gradient(135deg, #fffaf0, #fff6e6);
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}

.dropzone:focus-visible {
  outline: 3px solid rgba(217, 119, 6, 0.3);
  outline-offset: 2px;
}

.dropzone.is-dragover {
  border-color: var(--accent);
  background: #fff1cc;
}

.dropzone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-prompt {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dropzone-title {
  font-weight: 600;
}

.dropzone-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
}

.dropzone-filename {
  color: var(--ink);
  font-size: 0.9rem;
}

.attachment-preview {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 12px;
  background: #f7f4ef;
  border: 1px solid var(--border);
}

.attachment-preview img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

.attachment-title {
  margin: 0 0 0.5rem 0;
  font-weight: 600;
}

.attachment-list {
  margin: 0;
  padding-left: 1.1rem;
}

.actions {
  margin-top: 1rem;
}

@keyframes lift-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toolbar {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.button {
  text-decoration: none;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: #1f2933;
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button-primary {
  background: var(--accent);
}

.button-secondary {
  background: #475569;
}

.button-danger {
  background: #b91c1c;
}

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

.flash {
  padding: 0.6rem 0.8rem;
  margin: 1.5rem auto 0;
  border-radius: 12px;
  background: #ecfdf3;
  color: #065f46;
  max-width: 1100px;
  border: 1px solid #bbf7d0;
}

.flash.alert {
  background: #fff1f2;
  color: #9f1239;
  border-color: #fecdd3;
}

.error-summary {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  padding: 0.75rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}

.empty-panel {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 18px;
  padding: 2rem;
  text-align: center;
}

.empty-panel h2 {
  margin-top: 0;
}

.empty-state {
  color: var(--muted);
}

.visually-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

.auth-shell {
  grid-template-columns: minmax(0, 560px);
  justify-content: center;
}

.auth-card {
  width: 100%;
}

.auth-form {
  max-width: 460px;
}

.admin-section {
  margin-top: 1.5rem;
}

.users-table-wrap {
  overflow-x: auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table th,
.users-table td {
  border-top: 1px solid var(--border);
  padding: 0.8rem 0.4rem;
  text-align: left;
}

.users-table th:last-child,
.users-table td:last-child {
  text-align: right;
}

.bulk-panel {
  margin-top: 1.75rem;
}

.bulk-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.bulk-field-form {
  margin-top: 0.35rem;
}

.bulk-select {
  min-width: 240px;
}

.field-label {
  display: block;
  font-weight: 600;
}

.bulk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.bulk-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 12px 24px rgba(31, 29, 26, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.bulk-card-header {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.bulk-title {
  margin: 0;
  font-size: 1.15rem;
}

.bulk-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.bulk-textarea {
  min-height: 180px;
}

.bulk-attachments {
  display: grid;
  gap: 0.65rem;
}

.bulk-attachment-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.bulk-dropzone {
  padding: 1rem;
}

.bulk-dropzone .dropzone-title {
  font-size: 0.95rem;
}

.error-summary ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.admin-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .page-hero,
  .song-hero {
    flex-direction: column;
  }

  .search-meta {
    position: static;
    transform: none;
    display: block;
    margin-top: 0.5rem;
  }

  .form-shell {
    grid-template-columns: 1fr;
  }

  .form-aside {
    position: static;
  }

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

  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
