/* ==========================================================================
   MANON – 25 ANS (DIRECTION ARTISTIQUE MÉDIÉVALE ÉPURÉE)
   Structure fluide & moderne enrichie d'une identité médiévale bretonne noble
   ========================================================================== */

:root {
  --bg-color: #EDE6DA;
  --parchment-card: #FFFDF9;
  --parchment-inner: #FAF5EB;
  --parchment-border: #DCD1BF;
  
  --royal-crimson: #781628;
  --royal-crimson-hover: #8F1C32;
  --royal-crimson-light: #F7EBEF;
  
  --royal-gold: #C49A45;
  --royal-gold-light: #FDF4D4;
  --royal-gold-dark: #8C671E;
  
  --royal-ink: #231912;
  --royal-muted: #6B5C4D;
  
  --font-cinzel: 'Cinzel', serif;
  --font-medieval: 'MedievalSharp', cursive;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  background-image: radial-gradient(circle at 50% 0%, #F5EFE6 0%, #EDE6DA 100%);
  color: var(--royal-ink);
  min-height: 100vh;
  padding-bottom: 120px;
}

.main-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 15px;
}

/* ==========================================================================
   CARTE D'EN-TÊTE ROYALE
   ========================================================================== */

.royal-card {
  background: var(--parchment-card);
  border: 2px solid var(--royal-gold);
  box-shadow: 0 4px 20px rgba(70, 45, 20, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 22px;
}

.royal-bar {
  background: linear-gradient(90deg, var(--royal-crimson) 0%, #520D1A 100%);
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid var(--royal-gold);
}

.royal-bar-text {
  color: #FFF2CC;
  font-family: var(--font-cinzel);
  font-size: 0.88rem;
  letter-spacing: 1px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ermine-inline-svg {
  width: 14px;
  height: 16px;
  color: var(--royal-gold);
  flex-shrink: 0;
}

.royal-bar-controls button {
  width: 20px;
  height: 18px;
  background: #E8DECC;
  border: 1px solid var(--royal-gold-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  color: var(--royal-ink);
  border-radius: 2px;
}

.royal-body {
  background: var(--parchment-inner);
  padding: 28px 15px 22px;
  text-align: center;
}

.logo-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.logo-25ans {
  font-family: var(--font-cinzel);
  font-weight: 900;
  font-size: 3.8rem;
  line-height: 0.95;
  margin: 0;
  letter-spacing: 2px;
  color: var(--royal-ink);
  text-shadow: 1px 1px 0 #FFF;
}

.logo-manon-box {
  font-family: var(--font-cinzel);
  font-weight: 900;
  font-size: 2.1rem;
  letter-spacing: 2px;
  background: var(--royal-crimson);
  color: #FFF8EA;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 4px 16px;
  transform: rotate(-2deg);
  margin-bottom: 8px;
  margin-top: -4px;
  border: 1.5px solid var(--royal-gold);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(120, 22, 40, 0.25);
  max-width: 95%;
  flex-wrap: nowrap;
}

.manon-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.manon-name {
  font-family: var(--font-cinzel);
  font-weight: 900;
  letter-spacing: 2px;
}

.manon-icon.castle, .manon-icon.crown {
  font-size: 1.1rem;
}

.manon-icon.fleur {
  font-size: 1.05rem;
}

.royal-date-sub {
  font-family: var(--font-medieval);
  font-size: 0.95rem;
  color: var(--royal-muted);
  margin-bottom: 12px;
}

.royal-stats {
  font-weight: bold;
  font-size: 0.9rem;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.pill {
  background: var(--parchment-card);
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--parchment-border);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--royal-muted);
  box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.pill.active {
  border-color: var(--royal-crimson);
  color: var(--royal-crimson);
  background: #FFFDFB;
  box-shadow: 0 2px 10px rgba(120, 22, 40, 0.12);
}

/* ==========================================================================
   BOUTONS D'ACTION
   ========================================================================== */

.action-container {
  margin-bottom: 25px;
  text-align: center;
}

.action-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-royal-primary {
  flex: 1;
  background: linear-gradient(135deg, var(--royal-crimson) 0%, #5A0E1C 100%);
  color: #FFFDF9;
  border: 1.5px solid var(--royal-gold);
  padding: 15px;
  border-radius: 50px;
  font-family: var(--font-cinzel);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 1px;
  cursor: pointer;
  text-transform: uppercase;
  transition: transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 4px 15px rgba(120, 22, 40, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-royal-primary:hover {
  background: linear-gradient(135deg, var(--royal-crimson-hover) 0%, #6E1223 100%);
  box-shadow: 0 6px 20px rgba(120, 22, 40, 0.4);
}

.btn-royal-primary:active {
  transform: scale(0.97);
}

.plus-icon {
  font-size: 1.2rem;
  color: var(--royal-gold);
}

.btn-royal-lock {
  width: 52px;
  height: 52px;
  background: #E8DECC;
  border: 1.5px solid var(--royal-gold);
  box-shadow: inset -1px -1px #8C7F6C, inset 1px 1px #FFF;
  border-radius: 4px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.btn-royal-lock:hover {
  background: #F2E9DA;
}
.btn-royal-lock:active {
  box-shadow: inset 1px 1px #000;
}

.btn-admin-simu {
  display: none;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: #8F1C32;
  color: #FFF;
  border: 1.5px dashed var(--royal-gold);
  font-family: var(--font-cinzel);
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 6px;
}

body.admin-mode .btn-admin-simu {
  display: block;
}

/* ==========================================================================
   RECHERCHE & FILTRES
   ========================================================================== */

.sticky-controls {
  position: sticky;
  top: 10px;
  z-index: 100;
  margin-bottom: 20px;
}

.royal-search-bar {
  background: var(--parchment-card);
  border-radius: 8px;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
  border: 1.5px solid var(--parchment-border);
  margin-bottom: 10px;
  transition: border-color 0.15s;
}

.royal-search-bar:focus-within {
  border-color: var(--royal-gold);
}

.royal-search-bar .icon {
  font-size: 1rem;
  color: var(--royal-gold-dark);
}

.royal-search-bar input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-body);
  font-size: 0.98rem;
  margin-left: 10px;
  font-weight: 500;
  color: var(--royal-ink);
}

.royal-search-bar input::placeholder {
  color: #9C8F7F;
}

.filters-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: none;
}
.filters-scroll::-webkit-scrollbar { display: none; }

.royal-chip {
  appearance: none;
  background: var(--parchment-card);
  border: 1.5px solid var(--parchment-border);
  padding: 7px 16px;
  border-radius: 50px;
  font-family: var(--font-cinzel);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--royal-ink);
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  outline: none;
  white-space: nowrap;
}

.royal-chip:hover {
  border-color: var(--royal-gold);
}

/* ==========================================================================
   LISTE DES CANTIQUES
   ========================================================================== */

.royal-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.song {
  background: var(--parchment-card);
  border: 1px solid var(--parchment-border);
  border-left: 3.5px solid var(--royal-gold);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}

.song:hover {
  border-color: var(--royal-gold);
}

.song:active {
  transform: scale(0.99);
  background: #FDFBF7;
}

.cover {
  width: 55px;
  height: 55px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  background: #EAE3D6;
  border: 1px solid var(--parchment-border);
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(35, 25, 18, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  color: #FFF2CC;
  font-size: 1.2rem;
  transition: opacity 0.15s;
}

.cover:hover .play-overlay,
.cover.playing .play-overlay {
  opacity: 1;
}

.cover.playing {
  border: 2px solid var(--royal-crimson);
}

.info {
  flex: 1;
  overflow: hidden;
  text-align: left;
}

.info h3 {
  font-family: var(--font-cinzel);
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--royal-ink);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.info p {
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--royal-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.meta-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.tag {
  font-family: var(--font-cinzel);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background: #EFE8DB;
  color: var(--royal-muted);
  text-transform: uppercase;
}

.tag.mood {
  color: var(--royal-crimson);
  background: var(--royal-crimson-light);
  border: 1px solid rgba(120, 22, 40, 0.15);
}

.tag.new {
  background: #1B1510;
  color: #FFF8EA;
  border: 1px solid var(--royal-gold);
  animation: pulse 2s infinite;
}

.tag.hot {
  background: #C2410C;
  color: #FFF;
}

.message-bubble {
  margin-top: 5px;
  font-size: 0.82rem;
  color: var(--royal-ink);
  background: #F4ECE0;
  border-left: 2.5px solid var(--royal-crimson);
  padding: 3px 8px;
  border-radius: 3px;
  display: inline-block;
  font-style: italic;
}

.btn-deezer-link {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--parchment-border);
  background: #FFF;
  padding: 7px;
  transition: transform 0.1s;
}

.btn-deezer-link:hover {
  transform: scale(1.1);
  border-color: var(--royal-crimson);
}
.btn-deezer-link img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Loader */
.loader {
  border: 3px solid #E2D7C5;
  border-top: 3px solid var(--royal-crimson);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

/* ==========================================================================
   MODALES
   ========================================================================== */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(25, 18, 12, 0.7);
  backdrop-filter: blur(2px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 15px;
}

.modal-fix {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-inner {
  padding: 20px;
  overflow-y: auto;
}

.modal-heading {
  font-family: var(--font-cinzel);
  font-weight: 800;
  font-size: 1.3rem;
  margin-bottom: 12px;
  color: var(--royal-crimson);
}

.modal-label {
  display: block;
  font-family: var(--font-cinzel);
  font-weight: 700;
  font-size: 0.85rem;
  margin: 14px 0 5px;
  text-align: left;
  color: var(--royal-muted);
}

.royal-textarea {
  width: 100%;
  min-height: 80px;
  border: 1.5px solid var(--parchment-border);
  background: var(--parchment-card);
  padding: 10px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--royal-ink);
  resize: vertical;
  border-radius: 6px;
  outline: none;
}

.royal-textarea:focus {
  border-color: var(--royal-gold);
}

.btn-royal-secondary {
  background: #E8DECC;
  border: 1.5px solid var(--royal-gold);
  padding: 10px 16px;
  cursor: pointer;
  flex: 1;
  font-family: var(--font-cinzel);
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 4px;
  color: var(--royal-ink);
}

.btn-royal-secondary.small {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
}
.btn-royal-secondary.small.highlight {
  background: var(--royal-crimson);
  color: #FFF;
}

.modal-btns { display: flex; gap: 10px; margin-top: 18px; }
.full { width: 100%; }

.results-container {
  max-height: 250px;
  overflow-y: auto;
  margin-top: 12px;
  border-top: 1px solid var(--parchment-border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  background: var(--parchment-card);
  border: 1px solid var(--parchment-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
}

.result-card:hover {
  border-color: var(--royal-gold);
  background: #FFFDF9;
}

.result-img-wrapper {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
}

.result-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-play {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  color: #FFF;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.8rem;
  opacity: 0;
}

.result-img-wrapper:hover .mini-play { opacity: 1; }

.result-info { flex: 1; text-align: left; }
.result-info h4 { margin: 0; font-family: var(--font-cinzel); font-size: 0.88rem; font-weight: 700; color: var(--royal-ink); line-height: 1.2; }
.result-info p { margin: 2px 0 0; font-size: 0.8rem; color: var(--royal-muted); }

.preview-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  background: var(--royal-crimson-light);
  border: 1.5px solid rgba(120, 22, 40, 0.2);
  border-radius: 6px;
  margin-bottom: 12px;
  text-align: left;
}
.preview-card img { width: 50px; height: 50px; border-radius: 4px; object-fit: cover; }

.code-area { font-family: monospace; font-size: 0.85rem; height: 120px; }
.export-actions { display: flex; gap: 10px; margin-top: 15px; }

.btn-tune-music {
  flex: 1;
  background: linear-gradient(90deg, #6246f3, #9d33d6);
  color: #FFF;
  text-decoration: none;
  padding: 10px;
  border-radius: 4px;
  text-align: center;
  font-weight: bold;
  font-family: var(--font-cinzel);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(98, 70, 243, 0.3);
}

/* Modale Jour J */
.jour-j-body { padding: 30px 20px; text-align: center; }
.jour-j-crown { font-size: 3.2rem; margin-bottom: 8px; }
.jour-j-title { font-family: var(--font-cinzel); font-weight: 900; font-size: 1.6rem; color: var(--royal-crimson); margin-bottom: 10px; }
.jour-j-text { font-size: 0.95rem; color: var(--royal-muted); margin-bottom: 20px; line-height: 1.5; }

/* Admin Dock */
.admin-dock {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--parchment-card);
  padding: 10px 16px;
  border: 1.5px solid var(--royal-gold);
  display: none;
  width: 90%;
  max-width: 320px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  border-radius: 50px;
}

.dock-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-cinzel);
  font-size: 0.85rem;
  font-weight: 700;
}

.checkbox-wrapper { display: none; margin-right: 8px; }
body.admin-mode .admin-dock,
body.admin-mode .checkbox-wrapper { display: flex !important; }

/* Responsive Mobile */
@media (max-width: 480px) {
  .logo-25ans { font-size: 3.2rem; }
  .logo-manon-box { font-size: 1.7rem; padding: 3px 12px; gap: 6px; }
  .manon-icon { font-size: 0.95rem; }
  .btn-royal-primary { font-size: 0.92rem; padding: 13px; }
  .royal-bar-text { font-size: 0.8rem; }
}