
/* ── Arabic font : Al-Harariyy, même rendu sur toutes les plateformes ── */
@font-face {
  font-family: 'Al-Harariyy';
  src: url('../fonts/al-harariyy/Al-Harariyy.woff2') format('woff2'),
       url('../fonts/al-harariyy/Al-Harariyy.woff')  format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: block;
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: 'Al-Harariyy';
  src: url('../fonts/al-harariyy/Al-Harariyy-Bold.woff2') format('woff2'),
       url('../fonts/al-harariyy/Al-Harariyy-Bold.woff')  format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: block;
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; font-size: 16px; }

body {
  height: 100%;
  font-family: -apple-system, SFPro, sans-serif;
  font-size: 1rem;
  color: #0f1a13;
  background: #efefef;
  -webkit-text-size-adjust: 100%;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
}

/* ── Layout ── */
.wrapper {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
}

.app-shell {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  overflow: hidden;
}

/* ── Header ── */
.app-header {
  background: #14532d;
  color: #f0fdf4;
  height: 56px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  z-index: 10;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  width: 100%;
}

.app-header .wrapper {
  max-width: 100%;
  height: 100%;
  position: relative;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  padding: 0 12px;
}

.app-header h1 {
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.app-header .logo-dot { color: #4ade80; }

.logo-link {
  color: inherit;
  text-decoration: none;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
}

.header-title-center {
  position: absolute;
  left: 50%;
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.2px;
  white-space: nowrap;
  pointer-events: none;
}
.header-title-center h1,
.header-title-center a { pointer-events: auto; }

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

.icon-btn {
  background: none;
  border: none;
  color: #bbf7d0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  cursor: pointer;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
  text-decoration: none;
}
.icon-btn:active { background: rgba(255, 255, 255, 0.15); }

/* ── Scroll content ── */
.content {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 0;
}

/* ── Search ── */
.search-wrap {
  padding: 12px 0 8px;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

.search-box {
  width: 100%;
  padding: 0 14px 0 42px;
  border: 1.5px solid #cad8d1;
  border-radius: 12px;
  font-size: 0.9375rem;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a9e92' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 13px center no-repeat;
  outline: none;
  color: #0f1a13;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  height: 46px;
}
.search-box:focus {
  border-color: #15803d;
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.12);
}
.search-box::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ── Search row ── */
.search-row {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  gap: 10px;
}
.search-row form {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  min-width: 0;
}

.song-count {
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #8a9e92;
  white-space: nowrap;
}

/* ── Category filters ── */
.category-filters {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 2px;
  -webkit-overflow-scrolling: touch;
}
.category-filters::-webkit-scrollbar { display: none; }

.chip {
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid #cad8d1;
  background: #fff;
  color: #4b5f54;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip-active {
  background: #15803d;
  border-color: #15803d;
  color: #fff;
}

/* ── Cards ── */
.card-list { list-style: none; }

.song-card {
  background: #fff;
  border-radius: 14px;
  padding: 13px 14px;
  margin-bottom: 8px;
  border: 1px solid #ddeae3;
  cursor: pointer;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  gap: 13px;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow 0.15s, -webkit-transform 0.1s;
  transition: box-shadow 0.15s, transform 0.1s;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
}
.song-card:active {
  -webkit-transform: scale(0.984);
  transform: scale(0.984);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.song-avatar {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  background: #14532d;
  background: -webkit-linear-gradient(135deg, #14532d 0%, #16a34a 100%);
  background: linear-gradient(135deg, #14532d 0%, #16a34a 100%);
  color: #bbf7d0;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  font-size: 1.125rem;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  font-family: -apple-system, SFPro, sans-serif;
  font-weight: 600;
}

.song-info {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  min-width: 0;
}

.song-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0f1a13;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.song-preview {
  font-size: 0.8125rem;
  color: #7a8f82;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
  text-align: right;
  font-family: 'Al-Harariyy', -apple-system, SFPro, sans-serif;
  line-height: 1.4;
}

.card-arrow {
  color: #b8cec2;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: #7a8f82;
}
.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: #e8f5ed;
  color: #15803d;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
}
.empty-state p { line-height: 1.6; font-size: 0.9375rem; }

/* ── Song page title ── */
.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  padding: 4px 12px 0;
  margin: 16px 0;
}

/* ── Lyrics display ── */
.lyrics-block {
  font-size: 1.25rem;
  font-weight: 300;
  font-family: -apple-system, SFPro, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #000000;
  white-space: normal;
  line-height: 1.7;
  word-break: break-word;
  text-align: center;
  padding: 8px 4px 24px;
}
.lyrics-block b,
.lyrics-block strong { font-weight: 600; }

.lyrics-block p {
  margin: 0 0 0.6em;
}
.lyrics-block p:last-child {
  margin-bottom: 0;
}

.lyrics-block.arabic {
  font-size: 2rem;
  line-height: normal;
  font-family: 'Al-Harariyy', -apple-system, SFPro, "Geeza Pro", "Segoe UI", Tahoma, Arial, sans-serif;
  direction: rtl;
}

.lyrics-block.arabic b,
.lyrics-block.arabic strong { font-weight: 700; }

/* ── Lyrics editor ── */
#eLyrics + .tox-tinymce {
  width: 100%;
  border: 1.5px solid #cad8d1 !important;
  border-radius: 10px !important;
  font-family: inherit;
}
#eLyrics + .tox-tinymce:focus-within {
  border-color: #15803d !important;
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.12);
}
#eLyrics + .tox-tinymce .tox-edit-area__iframe {
  min-height: 420px;
}

/* Custom fullscreen toggle (the bundled tinymce.min.js has no separate
   fullscreen plugin file) — .tox-tinymce is already flex/column with
   flex:1 children, so pinning it to the viewport is enough. */
.tox-tinymce.lyrics-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100% !important;
  z-index: 1000;
  border-radius: 0 !important;
  border: none !important;
}
body.lyrics-fullscreen-lock {
  overflow: hidden;
}

/* ── Song detail page ── */
.song-detail-header {
  background: #14532d;
  color: #f0fdf4;
  padding: 20px 16px 24px;
  border-bottom: 1px solid #166534;
}

.song-detail-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.4px;
}

/* ── Forms / Buttons ── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #3d5c47;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 0 13px;
  border: 1.5px solid #cad8d1;
  border-radius: 10px;
  font-size: 1rem;
  color: #0f1a13;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  font-family: inherit;
  height: 46px;
}
.form-input:focus {
  border-color: #15803d;
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.12);
}

.form-error {
  font-size: 0.8125rem;
  color: #fca5a5;
  margin-top: 6px;
  line-height: 1.4;
}

#editForm {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  overflow: hidden;
}

#editForm .content {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.form-actions {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  gap: 10px;
  padding: 12px 0 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

.btn {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, -webkit-transform 0.1s;
  transition: opacity 0.15s, transform 0.1s;
  height: 48px;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  text-decoration: none;
}
.btn:active { opacity: 0.78; -webkit-transform: scale(0.98); transform: scale(0.98); }
.btn-primary { background: #15803d; color: #fff; }
.btn-secondary { background: #f2f7f4; color: #1a3325; border: 1.5px solid #cad8d1; }
.btn-logout { background: #fff; color: #dc2626; border: 1.5px solid #fecaca; }
.btn-logout:active { background: #fff1f1; }

/* ── Auth info / account ── */
.auth-info {
  font-size: 0.9375rem;
  color: #4a6054;
  margin-bottom: 20px;
  line-height: 1.65;
}

.user-email {
  font-size: 1rem;
  font-weight: 600;
  color: #15803d;
  word-break: break-all;
  background: #f0f9f4;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid #bbf7d0;
  margin-bottom: 20px;
}

/* ── Toast notification ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  -webkit-transform: translateX(-50%) translateY(16px);
  transform: translateX(-50%) translateY(16px);
  background: #0d2618;
  color: #f0fdf4;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s, -webkit-transform 0.2s;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  max-width: calc(100vw - 48px);
  text-align: center;
  white-space: normal;
}
.toast.show {
  opacity: 1;
  -webkit-transform: translateX(-50%) translateY(0);
  transform: translateX(-50%) translateY(0);
}

/* ── Auth splash (login / register) ── */
.auth-splash {
  position: fixed;
  inset: 0;
  background: #0d2618;
  z-index: 400;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  padding: 32px 24px;
  min-height: 100%;
}

.auth-splash-inner {
  width: 100%;
  max-width: 420px;
}

.auth-splash-inner.loading { text-align: center; }

.auth-splash-logo {
  font-size: 2.25rem;
  font-weight: 800;
  color: #f0fdf4;
  letter-spacing: -1px;
  margin-bottom: 6px;
  text-align: center;
}

.auth-splash-logo .logo-dot { color: #4ade80; }

.auth-splash-tagline {
  font-size: 0.9375rem;
  color: #86efac;
  margin-bottom: 36px;
  line-height: 1.5;
  text-align: center;
}

.auth-splash .form-label { color: #86efac; }

.auth-splash .form-input {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #f0fdf4;
}
.auth-splash .form-input:focus {
  border-color: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18);
}
.auth-splash .form-input::-webkit-input-placeholder { color: rgba(240,253,244,0.35); }
.auth-splash .form-input::-moz-placeholder { color: rgba(240,253,244,0.35); }
.auth-splash .form-input:-ms-input-placeholder { color: rgba(240,253,244,0.35); }

.auth-splash .btn-primary {
  background: #16a34a;
  margin-top: 8px;
  width: 100%;
}
.auth-splash .btn-primary:disabled {
  opacity: 0.55;
  cursor: default;
}

.auth-splash-hint {
  font-size: 0.8125rem;
  color: rgba(134,239,172,0.6);
  margin-top: 20px;
  text-align: center;
  line-height: 1.5;
}
.auth-splash-hint a { color: #4ade80; font-weight: 600; text-decoration: none; }

.auth-splash .form-checkbox {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: #bbf7d0;
  margin-bottom: 16px;
}

/* ══════════════════════════════════════════
   ESPACE CONNECTÉ  —  Groupes & Playlists
══════════════════════════════════════════ */

/* ── Page content scroll ── */
.page-content {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 0 40px;
}

/* ── Flash messages ── */
.flash {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: flex-start;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.45;
  margin-bottom: 16px;
  -webkit-animation: flashSlideIn 0.22s ease;
  animation: flashSlideIn 0.22s ease;
}
@-webkit-keyframes flashSlideIn {
  from { opacity: 0; -webkit-transform: translateY(-8px); transform: translateY(-8px); }
  to   { opacity: 1; -webkit-transform: translateY(0);    transform: translateY(0); }
}
@keyframes flashSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.flash-success { background: #f0fdf4; color: #166534; border: 1.5px solid #bbf7d0; }
.flash-error   { background: #fef2f2; color: #991b1b; border: 1.5px solid #fecaca; }

/* ── Section labels ── */
.section-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #5a7a66;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  padding: 0 2px;
}

/* ── Page title row ── */
.page-title-row {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  margin-bottom: 16px;
}
.page-title-row h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f1a13;
  letter-spacing: -0.3px;
}

/* Title truly centered: an invisible spacer mirrors the actions so the
   title's available space is symmetric, regardless of action width. */
.page-title-row__spacer {
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  visibility: hidden;
}
.page-title-row .page-title {
  -webkit-flex: 1;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  margin: 0;
  padding: 0 8px;
}

@media (max-width: 480px) {
  .page-title-row {
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-align-items: stretch;
    align-items: stretch;
    gap: 10px;
  }
  .page-title-row .page-title {
    text-align: center;
    white-space: normal;
    padding: 0;
  }
  .page-title-row__spacer {
    display: none;
  }
  .page-title-row__actions {
    -webkit-justify-content: center;
    justify-content: center;
  }
}

/* ── Group & Playlist cards (mirrors song-card exactly) ── */
.group-card,
.playlist-card {
  background: #fff;
  border-radius: 14px;
  padding: 13px 14px;
  margin-bottom: 8px;
  border: 1px solid #ddeae3;
  cursor: pointer;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  gap: 13px;
  -webkit-tap-highlight-color: transparent;
  -webkit-transition: box-shadow 0.15s, -webkit-transform 0.1s;
  transition: box-shadow 0.15s, transform 0.1s;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
}
.group-card:active,
.playlist-card:active {
  -webkit-transform: scale(0.984);
  transform: scale(0.984);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* Avatars (same dimensions as song-avatar) */
.group-avatar {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  background: #14532d;
  background: -webkit-linear-gradient(135deg, #14532d 0%, #166534 100%);
  background: linear-gradient(135deg, #14532d 0%, #166534 100%);
  color: #bbf7d0;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 700;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

.playlist-avatar {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  background: #15803d;
  background: -webkit-linear-gradient(135deg, #14532d 0%, #16a34a 100%);
  background: linear-gradient(135deg, #14532d 0%, #16a34a 100%);
  color: #bbf7d0;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

.group-info,
.playlist-info {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  min-width: 0;
}
.group-name,
.playlist-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0f1a13;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.group-meta,
.playlist-meta {
  font-size: 0.8125rem;
  color: #7a8f82;
  margin-top: 3px;
}

/* ── Role badge ── */
.role-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.4;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}
.role-admin  { background: #dcfce7; color: #166534; }
.role-editor { background: #dbeafe; color: #1e40af; }
.role-reader { background: #f3f4f6; color: #4b5563; }

/* ── Member cards ── */
.members-list { list-style: none; }

.member-card {
  background: #fff;
  border: 1px solid #e8f0eb;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 12px;
}

.member-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #e8f5ed;
  color: #15803d;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  font-size: 0.9375rem;
  font-weight: 700;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

.member-info {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  min-width: 0;
}
.member-name  { font-weight: 600; font-size: 0.9rem; color: #0f1a13; }
.member-email {
  font-size: 0.8125rem;
  color: #7a8f82;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-actions {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 6px;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

/* ── Form card (wraps form sections on detail pages) ── */
.form-card {
  background: #fff;
  border: 1px solid #ddeae3;
  border-radius: 14px;
  padding: 18px 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.form-card .form-group:last-child { margin-bottom: 0; }
.form-card-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #3d5c47;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}

/* ── Select input ── */
.form-select {
  width: 100%;
  padding: 0 14px;
  height: 46px;
  border: 1.5px solid #cad8d1;
  border-radius: 10px;
  font-size: 0.9375rem;
  background: #fff;
  color: #0f1a13;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  outline: none;
}
.form-select:focus {
  border-color: #15803d;
  -webkit-box-shadow: 0 0 0 3px rgba(21,128,61,0.12);
  box-shadow: 0 0 0 3px rgba(21,128,61,0.12);
}

/* ── Buttons ── */
.btn-danger { background: #fef2f2; color: #991b1b; border: 1.5px solid #fecaca; }
.btn-danger:active { background: #fee2e2; }

.btn-sm {
  -webkit-flex: none;
  flex: none;
  height: 34px;
  padding: 0 13px;
  font-size: 0.8125rem;
  border-radius: 8px;
  min-width: auto;
}

/* ── Inline role select (compact) ── */
.role-select {
  height: 34px;
  padding: 0 10px;
  border: 1.5px solid #cad8d1;
  border-radius: 8px;
  font-size: 0.8125rem;
  background: #fff;
  color: #0f1a13;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}
.role-select:focus {
  border-color: #15803d;
}

/* ── Settings section header ── */
.settings-section-header {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* ── Invite form toggle ── */
.invite-form-wrap {
  max-height: 0;
  overflow: hidden;
  -webkit-transition: max-height 0.28s ease;
  transition: max-height 0.28s ease;
  margin-bottom: 0;
}
.invite-form-wrap.invite-open {
  max-height: 440px;
  margin-bottom: 16px;
}
.invite-card {
  border-color: #a7f3d0;
  background: #f0fdf4;
}
.invite-card .form-input,
.invite-card .form-select {
  background: #fff;
}

/* ── Playlist title inline edit ── */
.playlist-title-edit {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 2px solid #e8f0eb;
  -webkit-transition: border-color 0.15s;
  transition: border-color 0.15s;
}
.playlist-title-edit:focus-within {
  border-bottom-color: #15803d;
}
.playlist-title-input {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f1a13;
  border: none;
  padding: 6px 0;
  background: transparent;
  outline: none;
  letter-spacing: -0.3px;
  min-width: 0;
  font-family: inherit;
}
.btn-title-save {
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  -webkit-transition: opacity 0.15s;
  transition: opacity 0.15s;
  margin-left: 10px;
}
.btn-title-save.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Drag handle ── */
.drag-handle {
  color: #c4d4cb;
  cursor: -webkit-grab;
  cursor: grab;
  padding: 4px 6px 4px 0;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.drag-handle:active { cursor: -webkit-grabbing; cursor: grabbing; }

li.pl-dragging > .song-card {
  opacity: 0.4;
}
li.pl-drag-over > .song-card {
  background: #f0fdf4;
  border-radius: 8px;
}

/* ── Save status (ordre) ── */
.save-status {
  font-size: 0.8125rem;
  color: #15803d;
  text-align: right;
  padding: 4px 2px;
  height: 22px;
  opacity: 0;
  -webkit-transition: opacity 0.25s;
  transition: opacity 0.25s;
}
.save-status.visible { opacity: 1; }

/* ── Song remove (×) button ── */
.btn-remove-song {
  background: none;
  border: none;
  cursor: pointer;
  color: #c4d4cb;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-transition: background 0.12s, color 0.12s;
  transition: background 0.12s, color 0.12s;
}
.btn-remove-song:active { background: #fee2e2; color: #ef4444; }

/* ── Song search autocomplete ── */
.song-search-wrap { position: relative; }

.song-search-field { position: relative; }

.song-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  -webkit-transform: translateY(-50%);
  transform: translateY(-50%);
  color: #8a9e92;
  pointer-events: none;
  display: -webkit-flex;
  display: flex;
}

.song-search-input {
  width: 100%;
  padding: 0 14px 0 42px;
  height: 46px;
  border: 1.5px solid #cad8d1;
  border-radius: 12px;
  font-size: 0.9375rem;
  color: #0f1a13;
  background: #fff;
  outline: none;
  -webkit-transition: border-color 0.15s, box-shadow 0.15s;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  font-family: inherit;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
.song-search-input:focus {
  border-color: #15803d;
  -webkit-box-shadow: 0 0 0 3px rgba(21,128,61,0.12);
  box-shadow: 0 0 0 3px rgba(21,128,61,0.12);
}

.song-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1.5px solid #ddeae3;
  border-radius: 12px;
  -webkit-box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  list-style: none;
  z-index: 100;
  overflow: hidden;
  max-height: 260px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.song-dropdown.open { display: block; }

.song-dropdown-item {
  padding: 12px 16px;
  font-size: 0.9375rem;
  cursor: pointer;
  color: #0f1a13;
  border-bottom: 1px solid #f0f4f1;
}
.song-dropdown-item:last-child { border-bottom: none; }
.song-dropdown-item.active { background: #f0fdf4; }

.song-dropdown-empty {
  padding: 14px 16px;
  font-size: 0.875rem;
  color: #7a8f82;
}

.playlist-empty-hint {
  font-size: 0.875rem;
  color: #7a8f82;
  padding: 4px 2px 16px;
}

/* ── Sync indicator ── */
.sync-indicator {
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #bbf7d0;
  opacity: 0;
  -webkit-transition: opacity 0.3s;
  transition: opacity 0.3s;
  pointer-events: none;
}
.sync-indicator svg { display: block; }

.sync-syncing { opacity: 1; -webkit-animation: spin 1s linear infinite; animation: spin 1s linear infinite; }
.sync-synced  { opacity: 0; }
.sync-offline { opacity: 1; color: #fbbf24; }

/* Masque les actions d'écriture (créer/modifier/supprimer) qui nécessitent une
   vraie connexion réseau : la classe is-offline est posée sur <html> par sync.js
   selon l'état réel détecté (pas seulement navigator.onLine). */
html.is-offline .requires-online { display: none !important; }

@-webkit-keyframes spin { to { -webkit-transform: rotate(360deg); transform: rotate(360deg); } }
@keyframes spin         { to { -webkit-transform: rotate(360deg); transform: rotate(360deg); } }
