:root {
  --deep-green: var(--p-forest-700);
  --teal: var(--accent-teal);
  --cream: var(--bg-page-alt);
  --orange: #ff7043;
  --yellow: #ffc107;
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --border: var(--border-soft);
  --surface: var(--bg-elevated);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--text);
  font-family: "Open Sans", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

.hymns-page {
  width: 100%;
  max-width: 720px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 100px;
}

/* HEADER */

.hymns-header {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.header-info {
  min-width: 0;
}

.header-info h1 {
  margin: 0;
  color: var(--text-primary);
  font-family: "Montserrat", sans-serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
}

.header-info p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.icon-button {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--text-primary);
}

.icon-button:hover {
  background: var(--hover-teal);
}

.icon-button svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

/* SEARCH */

.search-panel {
  margin-bottom: 14px;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.search-input-wrapper > svg {
  width: 19px;
  color: var(--teal);
  flex: 0 0 auto;
}

.search-input-wrapper input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.clear-button {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.clear-button svg {
  width: 17px;
}

/* LIST */

.hymns-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hymn-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hymn-row:active {
  transform: scale(0.99);
}

.hymn-row:not([hidden]) {
  cursor: pointer;
}

.hymn-number {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--hover-teal);
  color: var(--teal);
  font-family: "Montserrat", sans-serif;
  font-size: 11px;
  font-weight: 700;
}

.hymn-content {
  min-width: 0;
}

.hymn-content h2 {
  margin: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-family: "Montserrat", sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hymn-content p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.hymn-title-line {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.hymn-title-line h2 {
  flex: 0 1 auto;
}

.favorite-button,
.versions-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 10px;
}

.favorite-button {
  width: 38px;
  height: 38px;
  color: var(--text-tertiary);
}

.favorite-button:hover {
  color: var(--yellow);
}

.favorite-button svg {
  width: 19px;
  height: 19px;
}

.versions-button {
  width: 27px;
  height: 27px;
  color: var(--teal);
}

.versions-button svg {
  width: 16px;
  height: 16px;
}

/* EMPTY */

.empty-state {
  padding: 64px 24px;
  text-align: center;
}

.empty-state > svg {
  width: 34px;
  height: 34px;
  color: var(--teal);
}

.empty-state h2 {
  margin: 14px 0 6px;
  color: var(--text-primary);
  font-family: "Montserrat", sans-serif;
  font-size: 16px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* SORT SHEET */

.sort-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 26, 23, 0.42);
  backdrop-filter: blur(2px);
}

.sort-sheet {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 21;
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 16px 24px;
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  box-shadow: 0 -8px 32px var(--shadow-medium);
  transform: translateY(100%);
  transition: transform 0.22s ease;
}

.sort-sheet.open {
  transform: translateY(0);
}

.sort-handle {
  width: 38px;
  height: 4px;
  margin: 2px auto 12px;
  border-radius: 99px;
  background: #d9dfdd;
}

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

.sort-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-family: "Montserrat", sans-serif;
  font-size: 17px;
}

.sort-options {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
}

.sort-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 14px 4px;
  text-align: left;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.sort-option:last-child {
  border-bottom: 0;
}

.sort-option span {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sort-option strong {
  font-family: "Montserrat", sans-serif;
  font-size: 13px;
}

.sort-option small {
  color: var(--muted);
  font-size: 11px;
}

.sort-option > svg {
  width: 18px;
  color: var(--teal);
  opacity: 0;
}

.sort-option.active > svg {
  opacity: 1;
}

@media (min-width: 700px) {
  .hymns-page {
    padding-top: 28px;
  }
}

/* ============================================================
   ÉTAT FAVORI (ajouté v3)
   ============================================================ */
.hymn-row.is-favorite .favorite-button {
  color: var(--yellow, #f5b800);
}

.hymn-row.is-favorite .favorite-button svg {
  fill: currentColor;
  stroke: currentColor;
}

.favorite-button svg {
  transition: fill 150ms ease, color 150ms ease;
}

/* ============================================================
   BADGE "N LANGUES" (cantiques multi-versions)
   ============================================================ */
.version-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  background: rgba(201, 164, 74, 0.14);
  color: #9c7b2e;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  width: fit-content;
  max-width: 100%;
  align-self: flex-start;
}

.version-badge svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.5;
  flex: 0 0 auto;
}

.version-badge span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
