/* YWAM Sheep River Base Songs & Login */
main {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-direction: column;
  padding: 24px 16px 48px;
  box-sizing: border-box;
}

.tv-wrapper {
  width: 100%;
  max-width: 1080px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tv-wrapper.narrow {
  max-width: 780px;
}

/* Header */
.tv-header {
  background-color: #fff;
  border-radius: 18px;
  padding: 22px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: 0 6px 24px rgba(13, 35, 44, 0.08);
  border-left: 6px solid #a9d8b6;
}

.tv-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tv-brand img {
  border-radius: 10px;
  flex-shrink: 0;
}

.tv-brand h1 {
  font-size: 1.55rem;
  color: #0d232c;
  margin-bottom: 3px;
}

.tv-brand p {
  font-size: 0.92rem;
  color: #4a5d66;
}

.tv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Buttons */
.tv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  height: auto;
  min-width: auto;
  border-radius: 999px;
  border: none;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.tv-btn:hover {
  transform: translateY(-1px);
}

.tv-btn.sm {
  padding: 7px 13px;
  font-size: 0.82rem;
}

.tv-btn.full {
  width: 100%;
  padding: 12px 20px;
  font-size: 0.96rem;
}

.tv-btn.primary {
  background-color: #0d232c;
  color: #fff;
}

.tv-btn.primary:hover {
  background-color: #a9d8b6;
  color: #0d232c;
}

.tv-btn.accent {
  background-color: #a9d8b6;
  color: #0d232c;
}

.tv-btn.accent:hover {
  background-color: #0d232c;
  color: #fff;
}

.tv-btn.ghost {
  background-color: #f0f4f5;
  color: #0d232c;
}

.tv-btn.ghost:hover {
  background-color: #dfe9ec;
  color: #0d232c;
}

.tv-btn.del {
  background-color: #fdecea;
  color: #b42318;
}

.tv-btn.del:hover {
  background-color: #d92d20;
  color: #fff;
}

/* Login Card */
#login {
  width: 100%;
  min-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background-color: #fff;
  border-radius: 20px;
  padding: 30px 28px;
  box-shadow: 0 10px 30px rgba(13, 35, 44, 0.12);
  border-top: 5px solid #a9d8b6;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.login-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-header img {
  border-radius: 10px;
}

.login-header h1 {
  font-size: 1.35rem;
  color: #0d232c;
  margin-bottom: 2px;
}

.login-header p {
  font-size: 0.9rem;
  color: #546973;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid #edf2f4;
  font-size: 0.86rem;
}

.login-footer a {
  color: #4a5d66;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.login-footer a:hover {
  color: #0d232c;
}

/* Toolbar & Filter */
.tv-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.tv-search {
  flex: 1;
  min-width: 240px;
  background-color: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(13, 35, 44, 0.06);
  border: 2px solid transparent;
  transition: border-color 0.15s ease;
}

.tv-search:focus-within {
  border-color: #a9d8b6;
}

.tv-search i {
  color: #6c808a;
}

.tv-search input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  color: #0d232c;
}

.tv-count {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0d232c;
  background-color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(13, 35, 44, 0.06);
}

/* Song Cards Grid */
.song-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.song-card {
  background-color: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 6px 20px rgba(13, 35, 44, 0.07);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.song-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(13, 35, 44, 0.11);
}

.song-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
}

.song-id {
  font-weight: 800;
  color: #0d232c;
  background-color: #eef6f0;
  padding: 3px 9px;
  border-radius: 999px;
}

.song-creator {
  color: #546973;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-title {
  font-size: 1.12rem;
  color: #0d232c;
  line-height: 1.3;
  margin-top: 2px;
}

.song-author {
  font-size: 0.88rem;
  color: #4a5d66;
  display: flex;
  align-items: center;
  gap: 6px;
}

.song-author i {
  color: #6ca883;
  font-size: 0.8rem;
}

.song-preview {
  font-size: 0.86rem;
  color: #637780;
  line-height: 1.45;
  margin: 4px 0 8px;
  flex: 1;
}

.song-cmd {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid #edf2f4;
}

.song-cmd .tv-btn {
  flex: 1;
}

/* View Toggle Switch */
.view-toggle {
  display: inline-flex;
  background-color: #eef3f5;
  padding: 4px;
  border-radius: 999px;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(13, 35, 44, 0.05);
}

.view-toggle .toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  height: auto;
  min-width: auto;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #4a5d66;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.view-toggle .toggle-btn:hover {
  color: #0d232c;
  background-color: rgba(169, 216, 182, 0.35);
}

.view-toggle .toggle-btn.active {
  background-color: #0d232c;
  color: #fff;
}

/* Full Lyrics List View Mode */
.song-full-lyrics {
  display: none;
}

.song-grid.is-preview {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.song-grid.is-preview .song-preview {
  display: none;
}

.song-grid.is-preview .song-full-lyrics {
  display: block;
  white-space: pre-wrap;
  font-size: 0.92rem;
  line-height: 1.6;
  color: #1f333c;
  background-color: #f7faf8;
  border: 1px solid #e3eee7;
  border-radius: 12px;
  padding: 14px 16px;
  max-height: 360px;
  overflow-y: auto;
  margin: 6px 0 8px;
  flex: 1;
}

/* Editor Split Layout & Live Preview */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

.editor-layout.show-preview {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}

.live-preview-card {
  display: none;
  background-color: #fff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 6px 24px rgba(13, 35, 44, 0.08);
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 20px;
}

.editor-layout.show-preview .live-preview-card {
  display: flex;
}

.live-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #0d232c;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f4;
}

.live-preview-head i {
  color: #4f9468;
  margin-right: 4px;
}

.live-preview-stage {
  background-color: #f8fbf9;
  color: #0d232c;
  border-radius: 14px;
  padding: 22px 20px;
  max-height: 68vh;
  overflow-y: auto;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.live-preview-stage.is-dark {
  background-color: #0d232c;
  color: #f2f7f5;
}

.preview-title {
  font-size: 1.45rem;
  margin-bottom: 4px;
  line-height: 1.25;
}

.preview-meta {
  font-size: 0.86rem;
  color: #546973;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid #a9d8b6;
}

.live-preview-stage.is-dark .preview-meta {
  color: #a9d8b6;
}

.preview-lyrics {
  white-space: pre-wrap;
  font-size: 1rem;
  line-height: 1.7;
}

/* Create / Edit / Delete Form */
.form-card {
  background-color: #fff;
  border-radius: 18px;
  padding: 26px 28px;
  box-shadow: 0 6px 24px rgba(13, 35, 44, 0.08);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-card.is-delete {
  border-top: 4px solid #d92d20;
}

.delete-banner {
  background-color: #fdecea;
  color: #b42318;
  padding: 12px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  font-weight: 700;
}

.form-card form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.86rem;
  font-weight: 700;
  color: #0d232c;
  display: flex;
  align-items: center;
  gap: 6px;
}

.field input,
.field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  border: 2px solid #dfe7ea;
  border-radius: 12px;
  font-size: 0.95rem;
  color: #0d232c;
  background-color: #fafcfc;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.field textarea {
  resize: vertical;
  line-height: 1.55;
  min-height: 240px;
}

.field input:focus,
.field textarea:focus {
  border-color: #a9d8b6;
  background-color: #fff;
}

.field input:disabled,
.field textarea:disabled {
  background-color: #f3f6f7;
  color: #546973;
  cursor: not-allowed;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid #edf2f4;
}

@media (max-width: 960px) {
  .song-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .song-grid.is-preview,
  .editor-layout.show-preview {
    grid-template-columns: 1fr;
  }

  .live-preview-card {
    position: static;
  }
}

@media (max-width: 640px) {
  .song-grid,
  .form-row-grid {
    grid-template-columns: 1fr;
  }

  .tv-header,
  .form-card {
    padding: 18px;
  }
}