/* --------- Base --------- */
/* Normalisation cross-browser */
html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: 16px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

.ba-card{background:#fff;padding:20px;border-radius:12px;box-shadow:0 4px 15px rgba(0,0,0,0.05);box-sizing:border-box;}
.ba-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:15px;margin-bottom:15px;}
.ba-label{font-size:12px;font-weight:bold;text-transform:uppercase;color:#888;}
.input{width:100%;padding:12px;border:1px solid #ddd;border-radius:6px;font-size:15px;background:#fff;box-sizing:border-box;}
select.input{width:100%;}
.btn{width:100%;background:#2a0d47;color:#fff;padding:12px;border:none;border-radius:6px;font-size:16px;font-weight:bold;cursor:pointer;transition:0.2s;margin-top:8px;}
.btn:hover{background:#451a75;}
.btn-nav{background:#111;color:#fff;border:none;padding:10px 26px;border-radius:6px;cursor:pointer;font-weight:600;font-size:16px;}
.btn-nav:disabled{opacity:.5;cursor:not-allowed;}
.content-box{background:#fff;padding:30px;border-radius:8px;margin-top:20px;font-size:20px;line-height:1.7;color:#222;min-height:150px;box-shadow:0 2px 10px rgba(0,0,0,0.03);text-align:justify;}
.content-box h3{font-size:19px;margin:25px 0 10px;color:#000;border-bottom:2px solid #eee;padding-bottom:10px;}
.content-box p{margin-bottom:10px;}
.content-box b{color:#000;font-size:.9em;margin-right:10px;vertical-align:top;}
.loader{position:fixed;inset:0;background:rgba(255,255,255,0.9);z-index:120;display:none;align-items:center;justify-content:center;flex-direction:column;}
.loader.show{display:flex;}
.spinner{width:40px;height:40px;border:4px solid #eee;border-top-color:#2a0d47;border-radius:50%;animation:spin 1s linear infinite;margin-bottom:10px;}
@keyframes spin{100%{transform:rotate(360deg);}}

/* NAVIGATION CHAPITRES : centrée */
.ba-nav{
  display:flex;
  justify-content:center;
  gap:20px;
  margin-top:20px;
}

/* --------- Outils taille/police --------- */
#bible-app .ba-tool{
  background:#f7f7f8!important;
  border:1px solid #e5e7eb!important;
  color:#111!important;
  padding:6px 10px!important;
  border-radius:2px!important;
  font-size:14px!important;
  line-height:1!important;
  font-weight:400!important;
  cursor:pointer!important;
  box-shadow:none!important;
}
#bible-app .ba-tools{display:flex;gap:8px;align-items:center;margin-top:10px;flex-wrap:wrap}
#bible-app #font-toggle.active{background:#efeaf8!important;border-color:#c8b4ea!important;color:#2a0d47!important;font-weight:500!important}

/* --------- Boutons Favoris / Recherche --------- */
#bible-app .ba-fav-btn,
#bible-app .ba-search-btn{
  display:inline-flex!important;
  align-items:center!important;
  gap:6px!important;
}
#bible-app .ba-fav-btn{margin-left:auto;}
#bible-app .ba-search-btn{margin-left:0;}
#bible-app .ba-search-btn .icon{font-size:15px;line-height:1;}

/* Responsive : Favoris + Recherche sur mobile */
@media (max-width:640px){
  #bible-app .ba-tools{
    justify-content:space-between;
  }
  #bible-app .ba-fav-btn,
  #bible-app .ba-search-btn{
    flex:1 1 auto;
    justify-content:center;
  }
}

/* --------- Barre de recherche & rangée Thèmes --------- */
.ba-search-row{margin-top:10px;}
.ba-search-row[hidden]{display:none !important; margin:0 !important; padding:0 !important;}

/* ============================================
   BARRE DE RECHERCHE AMÉLIORÉE - UX PREMIUM
   ============================================ */
.ba-search-enhanced {
  margin-top: 16px;
  animation: searchSlideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes searchSlideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ba-search-container {
  position: relative;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 4px 8px 4px 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.ba-search-container:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.08);
}

.ba-search-container:focus-within {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15), 0 8px 40px rgba(99, 102, 241, 0.12);
  background: linear-gradient(135deg, #ffffff 0%, #f0f4ff 100%);
}

.ba-search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: #94a3b8;
  font-size: 18px;
  transition: all 0.3s ease;
}

.ba-search-container:focus-within .ba-search-icon {
  color: #6366f1;
  transform: scale(1.1);
}

.ba-search-enhanced .ba-search-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  padding: 14px 12px !important;
  font-size: 16px !important;
  font-weight: 500;
  color: #1e293b;
  box-shadow: none !important;
}

.ba-search-enhanced .ba-search-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.ba-search-enhanced .ba-search-input:focus {
  outline: none !important;
}

.ba-search-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ba-search-clear,
.ba-search-voice {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 12px;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0;
  transform: scale(0.8);
}

.ba-search-container:focus-within .ba-search-clear,
.ba-search-container:focus-within .ba-search-voice {
  opacity: 1;
  transform: scale(1);
}

.ba-search-clear:hover {
  background: #fee2e2;
  color: #ef4444;
}

.ba-search-voice:hover {
  background: #dbeafe;
  color: #3b82f6;
}

.ba-search-voice.listening {
  background: #ef4444 !important;
  color: white !important;
  animation: voicePulse 1s infinite;
}

@keyframes voicePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Loader de recherche */
.ba-search-loader {
  position: absolute;
  right: 60px;
  display: none;
}

.ba-search-loader.active {
  display: flex;
}

.ba-search-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: searchSpin 0.8s linear infinite;
}

@keyframes searchSpin {
  to { transform: rotate(360deg); }
}

/* Tags de suggestions */
.ba-search-hints {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
  animation: hintsAppear 0.5s ease 0.2s both;
}

@keyframes hintsAppear {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ba-search-hint {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.ba-hint-tag {
  padding: 6px 14px;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
}

.ba-hint-tag:hover {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: #6366f1;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ============================================
   RÉSULTATS DE RECHERCHE - STYLE AMÉLIORÉ
   ============================================ */
.search-results-header {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 20px;
  border: 1px solid #e2e8f0;
}

.search-results-title {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 8px 0;
}

.search-results-count {
  font-size: 14px;
  color: #64748b;
}

.search-results-count strong {
  color: #6366f1;
  font-weight: 700;
}

.search-hit {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(146, 64, 14, 0.2);
}

/* Pagination améliorée */
.search-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 16px 0 24px 0;
  padding: 16px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 16px;
  border: 1px solid #e2e8f0;
}

.search-pager-bottom {
  margin-top: 32px;
}

.search-pager-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  background: white;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-pager-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.search-pager-btn:hover:not(:disabled) {
  background: #6366f1;
  border-color: #6366f1;
  color: white;
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.search-pager-info {
  font-size: 14px;
  color: #475569;
  font-weight: 600;
  padding: 8px 20px;
  background: white;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

/* Responsive */
@media (max-width: 640px) {
  .ba-search-container {
    padding: 4px 6px 4px 12px;
  }
  
  .ba-search-enhanced .ba-search-input {
    font-size: 15px !important;
    padding: 12px 8px !important;
  }
  
  .ba-search-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  
  .ba-search-clear,
  .ba-search-voice {
    width: 36px;
    height: 36px;
  }
  
  .ba-search-hints {
    gap: 6px;
  }
  
  .ba-hint-tag {
    padding: 5px 10px;
    font-size: 12px;
  }
  
  .search-pager {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px;
  }
  
  .search-pager-btn {
    width: 40px;
    height: 40px;
  }
}

.ba-search-input{
  font-size:14px;
  border-radius:12px;
  border:1px solid #d4d4d4;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.ba-search-input::placeholder{color:#9ca3af;}
.ba-search-input:hover{border-color:#b0b0b0;}
.ba-search-input:focus{
  outline:none;
  border-color:#2a0d47;
  box-shadow:0 0 0 1px rgba(42,13,71,0.15);
}

/* Intro thèmes */
.ba-theme-intro{
  font-size:14px;
  color:#555;
  margin-bottom:12px;
}

/* ---- Thèmes : sous-titre par verset (sans changer l’UX) ---- */
.ba-theme-subtag{
  display:inline-block;
  margin: 0 10px 0 0;
  font-size:12px;
  font-weight:600;
  color:#6b7280;
  text-transform:uppercase;
  letter-spacing:.02em;
}

/* Thèmes : toolbar propre (filtre + select) */
.ba-theme-toolbar{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.ba-theme-toolbar .ba-theme-filter,
.ba-theme-toolbar .ba-theme-select{
  width:auto;
}
.ba-theme-filter{flex:1 1 260px;}
.ba-theme-select{flex:2 1 420px;}
.ba-theme-meta{
  font-size:12px;
  color:#6b7280;
  margin-top:6px;
}
@media (max-width:640px){
  .ba-theme-toolbar{
    flex-direction:column;
    align-items:stretch;
    gap:8px;
  }
  .ba-theme-filter,
  .ba-theme-select{flex:1 1 auto;}
}

/* ============================================
   STYLES GLOBAUX BOUTON MICRO VOCAL
   ============================================ */
.voice-mic-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.voice-mic-btn:hover {
  background: #dbeafe;
  color: #3b82f6;
}

.voice-mic-btn.voice-listening,
.voice-listening {
  background: #ef4444 !important;
  color: white !important;
  animation: voiceMicPulse 1s ease-in-out infinite;
}

@keyframes voiceMicPulse {
  0%, 100% { 
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% { 
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

/* Style pour les inputs avec micro intégré */
.voice-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-search-wrapper input {
  flex: 1;
  padding-right: 44px;
}

.voice-search-wrapper .voice-mic-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}

/* --------- Favoris --------- */
.ba-fav-box{background:#fff;padding:18px;border-radius:10px;margin:16px 0;box-shadow:0 2px 10px rgba(0,0,0,.03);}
.ba-fav-title{font-size:20px!important;line-height:1.25;margin:0 0 8px 0;color:#1b1131;font-weight:600;}
.ba-fav-item{padding:10px 0;border-bottom:1px solid #eee;}
.ba-fav-item:last-child{border-bottom:0;}
.ba-fav-item a[data-goto]{font-weight:700;text-decoration:none;color:#2a0d47;margin-right:8px}
.ba-fav-item-actions{display:inline-flex;gap:10px;margin-left:8px;}
#bible-app .fav-del-btn{background:transparent;border:0;color:#b91c1c;font-size:13px;cursor:pointer;padding:0;}
#bible-app .fav-del-btn:hover{text-decoration:underline;}

/* --------- Étoiles --------- */
#bible-app .vstar{padding:3px 7px 3px 7px!important;border-radius:2px!important;background:#2f2f2f!important;color:#fff!important;border:0!important;margin-right:10px!important;cursor:pointer!important;box-shadow:none!important;}
#bible-app .vstar.active{background:#2a0d47!important}

/* --------- Surlignage --------- */
.vtext.mark{background:#fff2b3}
.search-hit{color:#c21b1b;font-weight:600;}
.note-link{color:#5a3bd1;font-weight:600;text-decoration:none;margin-left:10px}
.note-link:hover{text-decoration:underline}

/* Boutons copier / partager */
#bible-app .ba-verse-action-link,
#bible-app .fav-copy-btn,
#bible-app .fav-share-btn{
  background:transparent;
  border:0;
  padding:0;
  margin-left:10px;
  font-size:13px;
  cursor:pointer;
  color:#6b4bb3;
  font-weight:500;
}
#bible-app .ba-verse-action-link:hover,
#bible-app .fav-copy-btn:hover,
#bible-app .fav-share-btn:hover{
  text-decoration:underline;
  color:#2a0d47;
}

/* --------- Pagination recherche --------- */
.search-pager{display:flex;align-items:center;justify-content:center;gap:16px;margin:8px 0 18px 0;}
.search-pager-bottom{margin-top:24px;}
.search-pager-btn{width:36px;height:36px;border-radius:50%;border:none;background:#f2f2f2;color:#111;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:16px;}
.search-pager-btn:disabled{opacity:.35;cursor:not-allowed;}
.search-pager-btn:hover:not(:disabled){background:#e2e2e2;}
.search-pager-info{font-size:13px;color:#666;}

/* --------- Modal Notes --------- */
.note-backdrop[hidden], .note-modal[hidden]{display:none!important;}
.note-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.35);z-index:130;}
.note-modal{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:min(680px,92vw);background:#fff;border-radius:12px;box-shadow:0 20px 60px rgba(0,0,0,.2);z-index:131;display:flex;flex-direction:column;}
.note-head{display:flex;justify-content:space-between;align-items:center;padding:14px 16px;border-bottom:1px solid #eee;background:#AC8900}
.note-title{font-weight:500;color:#ffff}
#bible-app .ba-close-x{width:28px;border-radius:6px!important;background:#2a0d47!important;color:#fff!important;border:0!important;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
.note-body{padding:14px 16px}
.note-textarea{width:100%;min-height:180px;border:1px solid #e7e7e7;border-radius:8px;padding:10px 12px;font-size:16px}

/* Boutons du modal note */
.ba-actions{display:flex;align-items:center;gap:8px;padding:10px 16px;border-top:1px solid #eee;background:#fff;}
#note-modal .ba-actions .ba-btn{
  font-size:14px!important;
  padding:4px 16px!important;
  border-radius:4px!important;
  font-weight:500!important;
  box-shadow:none!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  cursor:pointer!important;
  border:1px solid #111!important;
  background:#111!important;
  color:#fff!important;
}
#note-modal #note-del.ba-btn{background:#b91c1c!important;border-color:#991b1b!important;color:#fff!important;}
#note-modal #note-cancel.ba-btn{background:#f7f7f8!important;border-color:#e5e7eb!important;color:#111!important;}
#note-modal #note-save.ba-btn{background:#111!important;border-color:#111!important;color:#fff!important;}

/* --------- Bandeau "Je continue ma lecture" --------- */
.ba-last-row{display:flex;justify-content:flex-end;margin-bottom:8px;}
.ba-last-wrap{display:flex;align-items:center;gap:6px;font-size:13px;color:#444;}
.ba-last-icon{color:#b89400;font-size:14px;}
.ba-last-label{font-weight:500;}
.ba-last-link{
  background:transparent!important;
  border:none!important;
  box-shadow:none!important;
  padding:0!important;
  margin:0!important;
  color:#b60303!important;
  font-weight:500!important;
  font-size:14px!important;
  text-decoration:underline;
  cursor:pointer;
}
.ba-last-link:hover{color:#2a0d47;}
.ba-last-clear{
  width:24px;
  height:24px;
  border-radius:50%;
  border:none;
  background:#f2f2f2;
  color:#111;
  font-size:14px;
  line-height:1;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.ba-last-clear:hover{background:#e0e0e0;}
@media (max-width:640px){
  .ba-last-row{justify-content:flex-start;}
}

/* --------- Historique Panel Popup --------- */
.ba-history-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #475569 0%, #334155 100%);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ba-history-nav-btn:hover {
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
  transform: translateY(-1px);
}

.ba-history-nav-btn i {
  font-size: 14px;
}

/* History Panel Overlay */
.history-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.history-panel-overlay[hidden] {
  display: none;
}

/* History Panel - Container */
.history-panel {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

/* Header */
.history-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
  flex-shrink: 0;
}

.history-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.history-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.history-header-info {
  display: flex;
  flex-direction: column;
}

.history-header-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.history-header-subtitle {
  margin: 2px 0 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.history-close-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.history-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Content */
.history-panel-content {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Continue Section */
.history-continue-section {
  padding: 16px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}

.history-continue-section[style*="display: none"],
.history-continue-section:empty {
  display: none !important;
}

.history-continue-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.history-continue-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.history-continue-ref {
  font-size: 12px;
  color: #64748b;
  margin-top: 8px;
  text-align: center;
}

/* Stats */
.history-stats {
  display: flex;
  padding: 16px 24px;
  background: white;
  border-bottom: 1px solid #f1f5f9;
  gap: 12px;
}

.history-stat {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  background: #f8fafc;
  border-radius: 4px;
}

.history-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1;
}

.history-stat-label {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* History List */
.history-list {
  display: flex;
  flex-direction: column;
}

.history-group {
  border-bottom: 1px solid #f1f5f9;
}

.history-group:last-child {
  border-bottom: none;
}

.history-group-title {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 24px 8px;
  background: white;
  position: sticky;
  top: 0;
  z-index: 1;
}

.history-item {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  background: white;
  transition: background 0.15s ease;
  gap: 14px;
  cursor: pointer;
}

.history-item:hover {
  background: #f8fafc;
}

.history-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4f46e5;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

.history-item-content {
  flex: 1;
  min-width: 0;
}

.history-ref {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.history-ref button {
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
  width: 100%;
}

.history-ref button:hover {
  color: #3b82f6;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.history-version {
  font-size: 12px;
  color: #64748b;
}

.history-date {
  font-size: 12px;
  color: #94a3b8;
}

.history-date::before {
  content: "•";
  margin-right: 8px;
}

.history-item-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.history-item:hover .history-item-actions {
  opacity: 1;
}

.history-delete {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #94a3b8;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.history-delete:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Footer */
.history-panel-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

/* Popup de confirmation intégré à l'historique */
.history-confirm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: 16px;
  animation: fadeIn 0.2s ease;
}

.history-confirm-overlay[hidden] {
  display: none;
}

.history-confirm-box {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 340px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.history-confirm-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.history-confirm-icon i {
  font-size: 24px;
  color: #d97706;
}

.history-confirm-title {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 8px;
}

.history-confirm-text {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 8px;
  line-height: 1.5;
}

.history-confirm-count {
  font-size: 13px;
  color: #ef4444;
  font-weight: 600;
  margin: 0 0 24px;
}

.history-confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.history-confirm-btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.history-confirm-cancel {
  background: #f3f4f6;
  color: #374151;
}

.history-confirm-cancel:hover {
  background: #e5e7eb;
}

.history-confirm-ok {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.history-confirm-ok:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-1px);
}

/* Streak Indicator */
.history-streak {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-bottom: 1px solid #fcd34d;
}

.history-streak[hidden] {
  display: none;
}

.streak-icon {
  font-size: 28px;
  line-height: 1;
  animation: flame 1s ease-in-out infinite;
}

@keyframes flame {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.streak-info {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.streak-count {
  font-size: 24px;
  font-weight: 800;
  color: #92400e;
}

.streak-label {
  font-size: 13px;
  color: #a16207;
  font-weight: 500;
}

/* Search Bar */
.history-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}

.history-search i {
  color: #94a3b8;
  font-size: 14px;
}

.history-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #1e293b;
  outline: none;
}

.history-search input::placeholder {
  color: #94a3b8;
}

/* Footer */
.history-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 4px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #e5e7eb;
  background: white;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.history-toggle-btn:hover {
  background: white;
  border-color: #cbd5e1;
}

.history-toggle-btn i {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.history-export-btn {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
  background: white;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.history-export-btn:hover {
  background: #f1f5f9;
  color: #3b82f6;
  border-color: #3b82f6;
}

.history-clear-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 4px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: #ef4444;
  cursor: pointer;
  transition: all 0.15s ease;
}

.history-clear-btn:hover {
  background: #fef2f2;
}

.history-clear-btn:disabled {
  color: #d1d5db;
  cursor: not-allowed;
}

.history-clear-btn:disabled:hover {
  background: transparent;
}

/* Export Format Popup */
.export-format-panel {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.export-format-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
}

.export-format-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: white;
}

.export-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.export-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.export-format-content {
  padding: 20px 24px 24px;
}

.export-format-desc {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: #64748b;
}

.export-format-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.export-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.export-option:hover {
  background: #f1f5f9;
  border-color: #3b82f6;
}

.export-option-icon {
  font-size: 24px;
  line-height: 1;
}

.export-option-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.export-option-name {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
}

.export-option-desc {
  font-size: 12px;
  color: #64748b;
}

/* Empty State */
.history-empty {
  padding: 60px 24px;
  text-align: center;
}

.history-empty svg {
  width: 64px;
  height: 64px;
  color: #cbd5e1;
  margin-bottom: 16px;
}

.history-empty p {
  margin: 0;
  font-size: 15px;
  color: #64748b;
  line-height: 1.5;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .history-panel-overlay {
    padding: 0;
    align-items: flex-end;
  }
  
  .history-panel {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
  }
  
  .history-panel-header {
    padding: 16px 20px;
  }
  
  .history-header-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  
  .history-header-title {
    font-size: 17px;
  }
  
  .history-continue-section,
  .history-stats {
    padding: 14px 20px;
  }
  
  .history-stat {
    padding: 10px 6px;
  }
  
  .history-stat-value {
    font-size: 20px;
  }
  
  .history-group-title,
  .history-item {
    padding-left: 20px;
    padding-right: 20px;
  }
  
  .history-item-icon {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }
  
  .history-item-actions {
    opacity: 1;
  }
  
  .history-panel-footer {
    padding: 14px 20px;
    flex-direction: column;
    gap: 10px;
  }
  
  .history-toggle-btn,
  .history-clear-btn {
    width: 100%;
    justify-content: center;
  }
}

/* =============================================
   PANEL NOTE - POPUP MODERNE
   ============================================= */
.note-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.note-panel-overlay[hidden] {
  display: none !important;
}

.note-panel {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: slideUp 0.25s ease;
}

.note-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 50%, #6d28d9 100%);
  border-radius: 16px 16px 0 0;
}

.note-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.note-header-icon {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.note-header-title {
  font-size: 18px;
  font-weight: 700;
  color: white;
  margin: 0;
}

.note-header-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  margin: 2px 0 0 0;
  font-weight: 500;
}

.note-close-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.note-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.note-panel-content {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

.note-textarea-wrapper {
  position: relative;
}

.note-textarea {
  width: 100%;
  min-height: 180px;
  padding: 14px 50px 14px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.2s ease;
  background: #f9fafb;
  box-sizing: border-box;
}

.note-textarea:focus {
  outline: none;
  border-color: #8b5cf6;
  background: white;
}

.note-voice-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 36px;
  height: 36px;
  border: 1px solid #e5e7eb;
  background: white;
  border-radius: 8px;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.note-voice-btn:hover {
  background: #8b5cf6;
  border-color: #8b5cf6;
  color: white;
}

.note-voice-btn.listening {
  background: #ef4444;
  border-color: #ef4444;
  color: white;
  animation: pulse 1s infinite;
}

.note-hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: #94a3b8;
}

.note-panel-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid #f1f5f9;
  background: #fafafa;
  border-radius: 0 0 16px 16px;
}

.note-del-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: white;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.note-del-btn:hover {
  background: #fef2f2;
  border-color: #f87171;
}

.note-cancel-btn {
  padding: 10px 20px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.note-cancel-btn:hover {
  background: #f3f4f6;
}

.note-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.note-save-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

@media (max-width: 640px) {
  .note-panel {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 12px;
  }
  
  .note-panel-header {
    border-radius: 12px 12px 0 0;
  }
  
  .note-panel-footer {
    border-radius: 0 0 12px 12px;
    flex-wrap: wrap;
  }
  
  .note-del-btn {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 8px;
  }
}

/* =============================================
   PANEL FAVORIS - POPUP MODERNE
   ============================================= */
.fav-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.fav-panel-overlay[hidden] {
  display: none;
}

.fav-panel {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.fav-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  flex-shrink: 0;
}

.fav-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.fav-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.fav-header-info {
  display: flex;
  flex-direction: column;
}

.fav-header-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.fav-header-subtitle {
  margin: 2px 0 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.fav-close-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.fav-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.fav-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}

.fav-search i {
  color: #94a3b8;
  font-size: 14px;
}

.fav-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #1e293b;
  outline: none;
}

.fav-search input::placeholder {
  color: #94a3b8;
}

.fav-panel-content {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.fav-list {
  display: flex;
  flex-direction: column;
}

.fav-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 24px;
  background: white;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
  cursor: pointer;
}

.fav-item:hover {
  background: #fef2f2;
}

.fav-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #dc2626;
  font-size: 14px;
  flex-shrink: 0;
}

.fav-item-content {
  flex: 1;
  min-width: 0;
}

.fav-item-ref {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 4px 0;
}

.fav-item-ref button {
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.fav-item-ref button:hover {
  color: #dc2626;
}

.fav-item-text {
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fav-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.fav-item-action {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #94a3b8;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.fav-item-action:hover {
  background: #f1f5f9;
  color: #475569;
}

.fav-item-action.delete:hover {
  background: #fee2e2;
  color: #dc2626;
}

.fav-panel-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.fav-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fav-action-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.fav-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: #ef4444;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fav-clear-btn:hover {
  background: #fef2f2;
}

/* Popup de confirmation intégré aux favoris */
.fav-confirm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: 16px;
  animation: fadeIn 0.2s ease;
}

.fav-confirm-overlay[hidden] {
  display: none;
}

.fav-confirm-box {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 340px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.25s ease;
}

.fav-confirm-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.fav-confirm-icon i {
  font-size: 24px;
  color: #dc2626;
}

.fav-confirm-title {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 8px;
}

.fav-confirm-text {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 8px;
  line-height: 1.5;
}

.fav-confirm-count {
  font-size: 13px;
  color: #ef4444;
  font-weight: 600;
  margin: 0 0 24px;
}

.fav-confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.fav-confirm-btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.fav-confirm-cancel {
  background: #f3f4f6;
  color: #374151;
}

.fav-confirm-cancel:hover {
  background: #e5e7eb;
}

.fav-confirm-ok {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.fav-confirm-ok:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-1px);
}

.fav-empty {
  padding: 60px 24px;
  text-align: center;
}

.fav-empty i {
  font-size: 48px;
  color: #e5e7eb;
  margin-bottom: 16px;
}

.fav-empty p {
  margin: 0;
  font-size: 15px;
  color: #64748b;
  line-height: 1.5;
}

/* =============================================
   PANEL SURLIGNÉS - POPUP MODERNE
   ============================================= */
.marks-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.marks-panel-overlay[hidden] {
  display: none;
}

.marks-panel {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.marks-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
  color: white;
  flex-shrink: 0;
}

.marks-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.marks-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.marks-header-info {
  display: flex;
  flex-direction: column;
}

.marks-header-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.marks-header-subtitle {
  margin: 2px 0 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

.marks-close-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.marks-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.marks-panel-content {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.marks-list {
  display: flex;
  flex-direction: column;
}

.marks-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 24px;
  background: white;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}

.marks-item:hover {
  background: #fefce8;
}

.marks-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: linear-gradient(135deg, #fef9c3 0%, #fef08a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ca8a04;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.marks-item-content {
  flex: 1;
  min-width: 0;
}

.marks-item-ref {
  font-size: 14px;
  font-weight: 600;
  color: #92400e;
  margin: 0 0 4px 0;
}

.marks-item-text {
  font-size: 14px;
  color: #1e293b;
  line-height: 1.6;
}

.marks-panel-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #fffbeb;
  border-top: 1px solid #fde68a;
  flex-shrink: 0;
}

.marks-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: white;
  border: 1px solid #fde68a;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: #92400e;
  cursor: pointer;
  transition: all 0.15s ease;
}

.marks-action-btn:hover {
  background: #fef3c7;
  border-color: #fcd34d;
}

.marks-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: #b45309;
  cursor: pointer;
  transition: all 0.15s ease;
}

.marks-clear-btn:hover {
  background: #fef3c7;
}

.marks-empty {
  padding: 60px 24px;
  text-align: center;
}

.marks-empty i {
  font-size: 48px;
  color: #fde68a;
  margin-bottom: 16px;
}

.marks-empty p {
  margin: 0;
  font-size: 15px;
  color: #92400e;
  line-height: 1.5;
}

/* Mobile Responsive - Favoris & Surlignés */
@media (max-width: 768px) {
  .fav-panel-overlay,
  .marks-panel-overlay {
    padding: 0;
    align-items: flex-end;
  }
  
  .fav-panel,
  .marks-panel {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
  }
  
  .fav-panel-header,
  .marks-panel-header {
    padding: 16px 20px;
  }
  
  .fav-header-icon,
  .marks-header-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  
  .fav-item,
  .marks-item {
    padding: 14px 20px;
  }
  
  .fav-panel-footer,
  .marks-panel-footer {
    padding: 14px 20px;
    flex-direction: column;
    gap: 10px;
  }
  
  .fav-action-btn,
  .fav-clear-btn,
  .marks-action-btn,
  .marks-clear-btn {
    width: 100%;
    justify-content: center;
  }
}

/* --------- Responsive généraux --------- */
@media (max-width:640px){
  .content-box{font-size:22px}
  .ba-grid{grid-template-columns:1fr;gap:10px}
  #bible-app .ba-tool{font-size:13px!important;border-radius:8px!important}
  #bible-app .ba-btn{padding:8px 12px!important;font-size:14px!important}
  .ba-actions{flex-wrap:wrap;justify-content:flex-end;}
}

/* CTA Note */
#bible-app .note-link{color:#6b4bb3 !important;font-weight:600 !important;}
#bible-app .note-link:visited{color:#5c40ad !important;}
#bible-app .note-link:hover{color:#2a0d47 !important;text-decoration:underline;}
#note-modal .ba-close-x{
  width:22px!important;
  height:22px!important;
  padding:0!important;
  line-height:1!important;
  font-size:16px!important;
  border:none!important;
  box-shadow:none!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
}

/* Mes surlignages (modal) */
.marks-list{max-height:320px;overflow:auto;font-size:15px;}
.marks-item{margin:0 0 10px 0;}
.marks-ref{font-weight:600;color:#2a0d47;}
.marks-text{display:block;margin-top:2px;color:#111;}

/* ============================================
   SYSTÈME DE POP-UP GLOBAL CENTRÉ
   Remplace les alert() natifs
   ============================================ */
#global-alert-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999999;
  display: none;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#global-alert-overlay.visible {
  display: flex;
}

#global-alert-box {
  background: white;
  border-radius: 20px;
  padding: 32px 36px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25), 0 10px 30px rgba(0, 0, 0, 0.15);
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}
#global-alert-overlay.visible #global-alert-box {
  transform: scale(1) translateY(0);
  opacity: 1;
}

#global-alert-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 20px auto;
  font-size: 28px;
}
#global-alert-icon.info {
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
  color: #0284c7;
}
#global-alert-icon.success {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  color: #16a34a;
}
#global-alert-icon.warning {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #d97706;
}
#global-alert-icon.error {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #dc2626;
}

#global-alert-message {
  font-size: 16px;
  color: #1f2937;
  margin: 0 0 28px 0;
  line-height: 1.6;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
}

#global-alert-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
  padding: 14px 56px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}
#global-alert-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
}
#global-alert-btn:active {
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 480px) {
  #global-alert-box {
    padding: 28px 24px;
    margin: 0 16px;
    border-radius: 16px;
  }
  #global-alert-icon {
    width: 56px;
    height: 56px;
    font-size: 24px;
  }
  #global-alert-message {
    font-size: 15px;
    margin-bottom: 24px;
  }
  #global-alert-btn {
    padding: 12px 44px;
    font-size: 14px;
  }
}

/* POPUP GÉNÉRIQUE */
.ba-popup-overlay[hidden]{display:none!important;}
.ba-popup-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.35);
  z-index:140;
  display:flex;
  align-items:center;
  justify-content:center;
}
.ba-popup-box{
  width:min(420px,90vw);
  background:#fff;
  border-radius:4px;
  box-shadow:0 20px 60px rgba(0,0,0,.25);
  overflow:hidden;
  font-family:inherit;
}
.ba-popup-head{
  padding:12px 16px;
  border-bottom:1px solid #eee;
  background:#2a0d47;
  color:#fff;
}
.ba-popup-title{
  font-weight:600;
  font-size:16px;
}
.ba-popup-text{
  padding:16px;
  font-size:15px;
  color:#111;
  white-space:pre-line;
}
.ba-popup-actions{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 16px;
  border-top:1px solid #eee;
  background:#f9fafb;
}
.ba-popup-actions .ba-btn{
  font-size:14px!important;
  padding:6px 14px!important;
  border-radius:4px!important;
  font-weight:500!important;
  box-shadow:none!important;
  display:inline-flex!important;
  align-items:center!important;
  gap:6px!important;
  cursor:pointer!important;
}
.ba-popup-share{
  border:1px solid #111!important;
  background:#111!important;
  color:#fff!important;
}
.ba-popup-cancel{
  border:1px solid #e5e7eb!important;
  background:#f7f7f8!important;
  color:#111!important;
}
.ba-popup-ok{
  border:1px solid #2a0d47!important;
  background:#2a0d47!important;
  color:#fff!important;
}

/* Watermark Global Streaming Africa */
a.ba-popup-watermark{
  display:block;
  text-align:center;
  margin:8px 0 4px;
  font-size:12px !important;
  font-weight:300 !important;
  color:#949494 !important;
  text-decoration:none !important;
}

/* --------- POPUP COMPARAISON - DESIGN ÉPURÉ --------- */
.compare-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 12px;
}

.compare-panel-overlay[hidden] {
  display: none !important;
}

.compare-panel {
  width: min(1000px, 100%);
  max-height: calc(100vh - 24px);
  min-height: min(700px, 90vh);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow-y: auto;
}

/* Header minimal */
.compare-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  flex-shrink: 0;
}

.compare-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compare-header-icon {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.compare-header-info {
  display: flex;
  flex-direction: column;
}

.compare-header-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: white;
}

.compare-header-subtitle {
  font-size: 11px;
  color: rgba(255,255,255,0.8);
  margin: 0;
}

.compare-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  width: 32px;
  height: 32px;
}

.compare-close-btn:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.05);
}

/* Tabs */
.compare-tabs {
  display: flex;
  gap: 0;
  padding: 0;
  background: #f8fafc;
  flex-shrink: 0;
}

.compare-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  background: transparent;
  border-radius: 0;
  font-size: 15px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  flex: 1;
  border-bottom: 2px solid transparent;
}

.compare-tab:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.compare-tab.active {
  background: white;
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}

.compare-tab svg {
  flex-shrink: 0;
}

/* Content */
.compare-content {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.compare-mode-panel {
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.compare-mode-panel.collapsed {
  display: none;
}

/* Warning */
.compare-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 4px;
  color: #92400e;
  font-size: 12px;
  margin-bottom: 8px;
}

.compare-warning svg {
  flex-shrink: 0;
  color: #f59e0b;
}

/* Version Selector */
.compare-version-selector {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.compare-version-card {
  flex: 1;
  min-width: 150px;
}

.compare-version-card.full {
  flex: 1 1 100%;
  margin-bottom: 4px;
}

.compare-version-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  margin-bottom: 4px;
}

.compare-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #1e293b;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%2364748b'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

.compare-select:focus {
  outline: none;
  border-color: #3b82f6;
}

.compare-arrow-icon {
  width: 32px;
  height: 32px;
  background: #3b82f6;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

/* Quick Actions */
.compare-quick-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.compare-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  flex: 1;
}

.compare-action-btn.primary {
  background: #3b82f6;
  color: white;
}

.compare-action-btn.primary:hover {
  background: #2563eb;
}

.compare-action-btn.secondary {
  background: #64748b;
  color: white;
}

.compare-action-btn.secondary:hover {
  background: #475569;
}

.compare-action-btn.full-width {
  flex: 1 1 100%;
  margin-top: 8px;
}

/* Chapter Mode */
.compare-chapter-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compare-chapter-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #f1f5f9;
  border-radius: 4px;
  color: #64748b;
  font-size: 11px;
}

.compare-chapter-current {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f1f5f9;
  border-radius: 4px;
  border-left: 3px solid #3b82f6;
}

.compare-chapter-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #3b82f6;
  background: white;
  padding: 3px 6px;
  border-radius: 4px;
}

.compare-chapter-ref {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.compare-version-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

/* Results */
.compare-results-wrapper {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  max-height: calc(100vh - 280px);
}

.compare-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 8px;
  flex-shrink: 0;
  gap: 8px;
  flex-wrap: wrap;
}

/* Navigation inline dans les résultats */
.compare-nav-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.compare-nav-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: #f1f5f9;
  border-radius: 4px;
  color: #3b82f6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.compare-nav-btn:hover {
  background: #3b82f6;
  color: white;
}
.compare-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.compare-nav-select {
  flex: 1;
  min-width: 90px;
  max-width: 160px;
  height: 28px;
  padding: 0 22px 0 8px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2364748b'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 2px center;
  background-size: 16px;
  color: #1e293b;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.compare-nav-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}
.compare-nav-select:hover {
  border-color: #94a3b8;
}
.compare-nav-select.compare-nav-chapter {
  max-width: 85px;
  min-width: 75px;
}

/* Custom Dropdown for Navigation */
.compare-dropdown {
  position: relative;
  flex: 1;
  min-width: 120px;
  max-width: 180px;
}
.compare-dropdown.compare-dropdown-chapter {
  min-width: 90px;
  max-width: 110px;
}
.compare-dropdown-btn {
  width: 100%;
  height: 28px;
  padding: 0 24px 0 10px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: white;
  color: #1e293b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  transition: border-color 0.1s, box-shadow 0.1s;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}
.compare-dropdown-btn:hover {
  border-color: #94a3b8;
}
.compare-dropdown-btn:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}
.compare-dropdown-btn svg {
  flex-shrink: 0;
  color: #64748b;
  position: absolute;
  right: 4px;
}
.compare-dropdown-text {
  overflow: hidden;
  text-overflow: ellipsis;
}
.compare-dropdown-menu {
  position: absolute;
  left: 0;
  min-width: 100%;
  max-width: 200px;
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  z-index: 9999;
  display: none;
}
/* Default: open downward */
.compare-dropdown-menu {
  top: calc(100% + 4px);
  bottom: auto;
}
/* Open upward when needed */
.compare-dropdown.open-up .compare-dropdown-menu {
  top: auto;
  bottom: calc(100% + 4px);
}
.compare-dropdown.open .compare-dropdown-menu {
  display: block !important;
  animation: dropdownFadeIn 0.1s ease-out;
}
.compare-dropdown.open-up.open .compare-dropdown-menu {
  animation: dropdownFadeUp 0.1s ease-out;
}
@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes dropdownFadeUp {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.compare-dropdown-item {
  padding: 8px 12px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compare-dropdown-item:hover {
  background: #f1f5f9;
}
.compare-dropdown-item.active {
  background: #eff6ff;
  color: #3b82f6;
  font-weight: 600;
}
.compare-dropdown-menu::-webkit-scrollbar {
  width: 6px;
}
.compare-dropdown-menu::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}
.compare-dropdown-menu::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
.compare-dropdown-menu::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Custom Dropdown for Main Panel (LIVRE / CHAPITRE) */
.compare-custom-dropdown {
  position: relative;
  width: 100%;
}
.compare-custom-dropdown-btn {
  width: 100%;
  height: 42px;
  padding: 0 36px 0 14px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: white;
  color: #1e293b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.compare-custom-dropdown-btn:hover {
  border-color: #94a3b8;
}
.compare-custom-dropdown-btn:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.compare-custom-dropdown-btn svg {
  position: absolute;
  right: 10px;
  color: #64748b;
  flex-shrink: 0;
}
.compare-custom-dropdown-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compare-custom-dropdown-menu {
  position: absolute;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 1001;
  display: none;
}
.compare-custom-dropdown-menu {
  top: calc(100% + 4px);
  bottom: auto;
}
.compare-custom-dropdown.open-up .compare-custom-dropdown-menu {
  top: auto;
  bottom: calc(100% + 4px);
}
.compare-custom-dropdown.open .compare-custom-dropdown-menu {
  display: block;
  animation: customDropdownFade 0.1s ease-out;
}
@keyframes customDropdownFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.compare-custom-dropdown-item {
  padding: 10px 14px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  transition: background 0.1s;
}
.compare-custom-dropdown-item:hover {
  background: #f1f5f9;
}
.compare-custom-dropdown-item.active {
  background: #eff6ff;
  color: #3b82f6;
  font-weight: 600;
}
.compare-custom-dropdown-menu::-webkit-scrollbar {
  width: 6px;
}
.compare-custom-dropdown-menu::-webkit-scrollbar-track {
  background: #f8fafc;
}
.compare-custom-dropdown-menu::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.compare-results-count {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  display: none; /* Caché pour gagner de l'espace */
}

.compare-results-actions {
  display: flex;
  gap: 4px;
}

.compare-mini-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 4px;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-size: 12px;
  font-weight: 600;
}

.compare-mini-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.compare-results {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 16px;
  min-height: 0;
  max-height: 100%;
}

.compare-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  text-align: center;
  color: #94a3b8;
  gap: 10px;
}

.compare-empty-state p {
  margin: 0;
  font-size: 13px;
  color: #94a3b8;
}

/* Result Groups */
.compare-result-group {
  background: #f8fafc;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.compare-result-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #3b82f6;
  color: white;
  cursor: pointer;
  transition: all 0.15s;
}

.compare-result-group-header:hover {
  background: #2563eb;
}

.compare-result-ref {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.compare-result-toggle {
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.compare-result-group.collapsed .compare-result-toggle {
  transform: rotate(-90deg);
}

.compare-result-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  padding: 12px;
  background: #f8fafc;
}

.compare-result-group.collapsed .compare-result-cards {
  display: none;
}

/* Result Cards - Design épuré avec box-shadow */
.compare-card {
  background: white;
  border-radius: 8px;
  padding: 12px;
  border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  transition: all 0.2s ease;
}

.compare-card:hover {
  box-shadow: 0 4px 12px rgba(59,130,246,0.15), 0 2px 4px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.compare-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.compare-card-version {
  font-size: 11px;
  font-weight: 700;
  color: #3b82f6;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.compare-card-actions {
  display: flex;
  gap: 4px;
}

.compare-card-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  border-radius: 4px;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.compare-card-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.compare-card-text {
  font-size: 13px;
  line-height: 1.5;
  color: #334155;
  margin: 0;
}

/* Chapter Comparison Side-by-Side */
.compare-chapter-results {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.compare-chapter-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.compare-chapter-column:first-child {
  border-right: 1px solid #e2e8f0;
}

.compare-chapter-column-header {
  padding: 6px;
  background: transparent;
  font-weight: 600;
  font-size: 12px;
  text-align: center;
  flex-shrink: 0;
}

/* Version selector in column headers */
.compare-header-select {
  width: 100%;
  padding: 10px 28px 10px 12px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  text-align-last: center;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: all 0.15s ease;
}

/* First column - blue */
.compare-chapter-column:first-child .compare-header-select {
  background-color: #3b82f6;
  color: white;
}

.compare-chapter-column:first-child .compare-header-select:hover {
  background-color: #2563eb;
}

/* Second column - slate */
.compare-chapter-column:nth-child(2) .compare-header-select {
  background-color: #64748b;
  color: white;
}

.compare-chapter-column:nth-child(2) .compare-header-select:hover {
  background-color: #475569;
}

.compare-header-select:focus {
  outline: 2px solid rgba(255,255,255,0.5);
  outline-offset: -2px;
}

.compare-chapter-verses {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  min-height: 0;
}

.compare-verse-row {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-bottom: none;
}

.compare-verse-row:nth-child(odd) {
  background: rgba(248,250,252,0.5);
}

.compare-verse-num {
  font-size: 10px;
  font-weight: 700;
  color: #3b82f6;
  background: #eff6ff;
  padding: 2px 6px;
  border-radius: 4px;
  height: fit-content;
  flex-shrink: 0;
  min-width: 24px;
  text-align: center;
}

.compare-verse-text {
  font-size: 13px;
  line-height: 1.5;
  color: #334155;
}

/* Book/Chapter selector row for chapter mode */
.compare-book-chapter-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
  background: #f8fafc;
  border-radius: 8px;
}

.compare-book-col {
  flex: 1;
  min-width: 0;
}

.compare-chapter-col {
  flex: 1;
  min-width: 0;
}

.compare-book-chapter-row .compare-version-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #475569;
  margin-bottom: 6px;
}

.compare-book-chapter-row .compare-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
  background: white;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%2364748b'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.compare-book-chapter-row .compare-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.compare-book-chapter-row .compare-select:hover {
  border-color: #94a3b8;
}

/* Text zoom classes - Extended range */
.compare-results.zoom-1 .compare-card-text,
.compare-results.zoom-1 .compare-verse-text { font-size: 10px; line-height: 1.3; }
.compare-results.zoom-2 .compare-card-text,
.compare-results.zoom-2 .compare-verse-text { font-size: 11px; line-height: 1.35; }
.compare-results.zoom-3 .compare-card-text,
.compare-results.zoom-3 .compare-verse-text { font-size: 12px; line-height: 1.4; }
.compare-results.zoom-4 .compare-card-text,
.compare-results.zoom-4 .compare-verse-text { font-size: 13px; line-height: 1.45; }
.compare-results.zoom-5 .compare-card-text,
.compare-results.zoom-5 .compare-verse-text { font-size: 14px; line-height: 1.5; }
.compare-results.zoom-6 .compare-card-text,
.compare-results.zoom-6 .compare-verse-text { font-size: 15px; line-height: 1.55; }
.compare-results.zoom-7 .compare-card-text,
.compare-results.zoom-7 .compare-verse-text { font-size: 16px; line-height: 1.6; }
.compare-results.zoom-8 .compare-card-text,
.compare-results.zoom-8 .compare-verse-text { font-size: 18px; line-height: 1.65; }

/* Mini buttons style */
.compare-mini-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: none;
  background: #f1f5f9;
  border-radius: 6px;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s;
}

.compare-mini-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

/* Loading State */
.compare-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.compare-loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: compareSpinner 0.5s linear infinite;
}

@keyframes compareSpinner {
  to { transform: rotate(360deg); }
}

.compare-loading-text {
  font-size: 13px;
  color: #64748b;
}

/* Responsive */
@media (max-width: 900px) {
  .compare-chapter-results {
    grid-template-columns: 1fr;
  }
  
  .compare-chapter-column:first-child {
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }
  
  .compare-version-grid {
    grid-template-columns: 1fr;
  }
  
  .compare-version-selector {
    flex-direction: column;
    align-items: stretch;
  }
  
  .compare-arrow-icon {
    align-self: center;
    transform: rotate(90deg);
  }
}

@media (max-width: 640px) {
  .compare-panel-overlay {
    padding: 10px;
  }
  
  .compare-panel {
    max-height: calc(100vh - 20px);
    border-radius: 16px;
  }
  
  .compare-results-wrapper {
    max-height: calc(100vh - 320px);
  }
  
  .compare-tabs {
    padding: 8px 16px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  
  .compare-tab {
    white-space: nowrap;
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .compare-content {
    padding: 14px 16px;
  }
  
  .compare-result-cards {
    grid-template-columns: 1fr;
  }
  
  .compare-quick-actions {
    flex-direction: column;
  }
  
  .compare-action-btn {
    min-width: auto;
  }
}

/* Keep old styles for backward compatibility */
.ba-compare-box{
  width:min(1120px,96vw);
  max-height:calc(100vh - 40px);
  background:#fff;
  border-radius:4px;
  box-shadow:0 20px 60px rgba(0,0,0,.25);
  display:flex;
  flex-direction:column;
  font-family:inherit;
}
.ba-compare-head{
  padding:10px 16px;
  border-bottom:1px solid #eee;
  background:#111;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.ba-compare-head-left{display:flex;flex-direction:column;gap:2px;}
.ba-compare-title{font-size:16px;font-weight:600;}
.ba-compare-ref{font-size:12px;opacity:.8;text-transform:uppercase;letter-spacing:.02em;}
.ba-compare-close{
  border:none;
  background:#fff;
  color:#111;
  width:28px;
  height:28px;
  border-radius:4px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.ba-compare-body{
  padding:14px 18px 12px;
  overflow-y:auto;
}
.ba-compare-warning{
  background:#fff7e6;
  border-radius:6px;
  padding:10px 12px;
  font-size:13px;
  color:#92400e;
  margin-bottom:10px;
}
.ba-compare-dual{
  display:flex;
  align-items:flex-end;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:10px;
}
.ba-compare-select{flex:1 1 0;}
.ba-compare-label{
  display:block;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.03em;
  color:#6b7280;
  margin-bottom:4px;
}
.ba-compare-arrow{
  width:36px;
  height:36px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#111;
  color:#fff;
  flex:0 0 auto;
}
.ba-compare-actions{
  display:flex;
  gap:8px;
  margin-bottom:12px;
  flex-wrap:wrap;
}
.ba-compare-btn,
.ba-compare-btn-alt{
  border-radius:4px;
  padding:5px 14px;
  font-size:13px;
  font-weight:500;
  cursor:pointer;
}
.ba-compare-btn{
  border:1px solid #111;
  background:#111;
  color:#fff;
}
.ba-compare-btn:hover{background:#000;}
.ba-compare-btn-alt{
  border:1px solid #b89400;
  background:#b89400;
  color:#fff;
}
.ba-compare-btn-alt:hover{
  background:#9b7600;
  border-color:#9b7600;
}
.ba-compare-results{
  display:flex;
  flex-direction:column;
  gap:18px;
  margin-top:4px;
}
.ba-compare-group-title{
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:#6b7280;
  margin-bottom:4px;
}
.ba-compare-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}
.ba-compare-card{
  background:#f5f5f5;
  border-radius:8px;
  padding:12px 14px;
}
.ba-compare-card-header{
  margin-bottom:4px;
}
.ba-compare-card-version{
  font-weight:600;
  font-size:14px;
  margin:0;
}
.ba-compare-card-ref{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.03em;
  color:#6b7280;
}
.ba-compare-card-text{
  font-size:14px;
  margin:6px 0 2px;
}
.ba-compare-watermark{
  margin-top:12px;
}

/* responsive compare grid */
@media (max-width:900px){
  .ba-compare-grid{grid-template-columns:1fr;}
}

/* s'assurer que le pop-up comparaison part un peu du haut sur mobile */
@media (max-width:640px){
  .ba-popup-overlay{
    align-items:flex-start;
    padding-top:20px;
  }
}

/* =========================
   PLANS DE LECTURE (UI)
   ========================= */
.ba-plans-controls{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  margin:10px 0;
}
#plan-select{
  min-width:260px;
  max-width:360px;
}
.ba-plan-progress{
  font-size:13px;
  opacity:.85;
}

/* =========================
   BOUTONS PRINCIPAUX (Lire, Études, Comparer, Favoris)
   ========================= */
.ba-controls-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 16px 0;
}

.ba-controls-row .btn-primary {
  background: #3b82f6 !important;
  color: white !important;
  padding: 10px 20px !important;
  border-radius: 4px !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  border: none !important;
  cursor: pointer !important;
  transition: background 0.2s !important;
  width: auto !important;
  margin: 0 !important;
}

.ba-controls-row .btn-primary:hover {
  background: #2563eb !important;
}

.ba-study-nav-btn {
  background: #8b5cf6 !important;
  color: white !important;
  padding: 10px 20px !important;
  border-radius: 4px !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  border: none !important;
  cursor: pointer !important;
  transition: background 0.2s !important;
}

.ba-study-nav-btn:hover {
  background: #7c3aed !important;
}

.ba-compare-nav-btn {
  background: #8b5cf6 !important;
  color: white !important;
  padding: 10px 20px !important;
  border-radius: 4px !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  border: none !important;
  cursor: pointer !important;
  transition: background 0.2s !important;
}

.ba-compare-nav-btn:hover {
  background: #7c3aed !important;
}

.ba-controls-row .ba-fav-btn {
  background: white !important;
  color: #22c55e !important;
  padding: 8px 16px !important;
  border-radius: 4px !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  border: 2px solid #22c55e !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  margin-left: auto !important;
}

.ba-controls-row .ba-fav-btn:hover {
  background: #f0fdf4 !important;
}

/* =========================
   GRILLE DES OUTILS SECONDAIRES
   ========================= */
#bible-app .ba-tools {
  display: grid !important;
  grid-template-columns: repeat(6, 1fr) !important;
  gap: 8px !important;
  margin-top: 16px !important;
}

#bible-app .ba-tool {
  background: white !important;
  border: 1px solid #e5e7eb !important;
  color: #374151 !important;
  padding: 10px 8px !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
}

#bible-app .ba-tool:hover {
  background: #f3f4f6 !important;
  border-color: #8b5cf6 !important;
  color: #8b5cf6 !important;
}

#bible-app .ba-tool i {
  font-size: 14px !important;
}

/* Responsive pour les outils */
@media (max-width: 900px) {
  #bible-app .ba-tools {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

@media (max-width: 640px) {
  #bible-app .ba-tools {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  
  .ba-controls-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .ba-controls-row .btn-primary,
  .ba-study-nav-btn,
  .ba-compare-nav-btn,
  .ba-controls-row .ba-fav-btn {
    width: 100% !important;
    justify-content: center !important;
    margin-left: 0 !important;
  }
}

@media (max-width: 480px) {
  #bible-app .ba-tools {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ========================================
   STYLES VERSET DU JOUR & VERSET ALÉATOIRE
   Responsive + Scrollbar cachée
   ======================================== */

/* VOTD Popup Box */
.votd-popup-box {
  max-width: 480px;
  width: 94vw;
  max-height: 92vh;
  margin-top: 20px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}

.votd-header {
  background: linear-gradient(135deg, #6B21A8, #9333EA);
  padding: 20px;
  text-align: center;
  position: relative;
  flex-shrink: 0;
  box-sizing: border-box;
}

/* Conteneur du bouton X dans le header */
.votd-header > div:first-child,
.random-header > div:first-child {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
}

.votd-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* Ciblage direct par ID pour garantir visibilité */
#votd-close-x, #random-close-x {
  position: relative;
  z-index: 100;
}

.votd-icon-circle {
  width: 50px;
  height: 50px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  backdrop-filter: blur(10px);
}

.votd-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.votd-date {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  font-weight: 500;
}

/* Contenu scrollable avec scrollbar cachée */
.votd-scroll-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.votd-scroll-content::-webkit-scrollbar {
  display: none;
}

.votd-main-content {
  padding: 20px;
}

.votd-footer {
  flex-shrink: 0;
  background: linear-gradient(to bottom, #f9fafb, #f3f4f6);
  border-top: 1px solid #e5e7eb;
}

.votd-share-section {
  padding: 12px 20px;
}

.votd-share-label {
  margin: 0 0 10px;
  font-size: 11px;
  color: #6b7280;
  text-align: center;
  font-weight: 500;
}

.votd-share-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.votd-share-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  font-size: 18px;
}
.votd-share-btn:hover {
  transform: scale(1.1);
}

.votd-close-section {
  padding: 0 20px 14px;
}

.votd-close-main-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #6B21A8, #7c3aed);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(107, 33, 168, 0.25);
}

/* RANDOM Popup Box */
.random-popup-box {
  max-width: 480px;
  width: 94vw;
  max-height: 92vh;
  margin-top: 20px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}

.random-header {
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  padding: 20px;
  text-align: center;
  position: relative;
  flex-shrink: 0;
  box-sizing: border-box;
}

.random-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.random-icon-circle {
  width: 50px;
  height: 50px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  backdrop-filter: blur(10px);
}

.random-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.random-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  font-weight: 500;
}

/* Contenu scrollable avec scrollbar cachée */
.random-scroll-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.random-scroll-content::-webkit-scrollbar {
  display: none;
}

.random-main-content {
  padding: 20px;
}

.random-footer {
  flex-shrink: 0;
  background: linear-gradient(to bottom, #f9fafb, #f3f4f6);
  border-top: 1px solid #e5e7eb;
}

.random-share-section {
  padding: 12px 20px;
}

.random-share-label {
  margin: 0 0 10px;
  font-size: 11px;
  color: #6b7280;
  text-align: center;
  font-weight: 500;
}

.random-share-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.random-share-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  font-size: 18px;
}
.random-share-btn:hover {
  transform: scale(1.1);
}

.random-close-section {
  padding: 0 20px 14px;
}

.random-close-main-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(30, 64, 175, 0.25);
}

/* Styles communs pour les deux panels */
#votd-reference, #random-verse-reference {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.5px;
}
#votd-reference { color: #6B21A8; }
#random-verse-reference { color: #1e40af; transition: opacity 0.15s ease-out; }

#votd-text, #random-verse-text {
  margin: 0;
  font-size: 18px;
  line-height: 1.5;
  color: #1f2937;
  text-align: center;
  font-weight: 500;
}
#random-verse-text { transition: opacity 0.15s ease-out; }

/* Sélecteur de version */
.votd-main-content > div, .random-main-content > div {
  margin-top: 16px;
}

/* ============================================
   RESPONSIVE - LAPTOPS & TABLETTES (601px - 1366px)
   POPUP CENTRÉ - PAS fullscreen sur laptop
   ============================================ */
@media (min-width: 601px) and (max-width: 1366px) {
  /* IMPORTANT: Respect de l'attribut hidden sur les overlays */
  #votd-overlay[hidden], #random-verse-overlay[hidden] {
    display: none !important;
  }
  
  /* Overlay avec fond semi-transparent - POPUP CENTRÉ */
  #votd-overlay:not([hidden]), #random-verse-overlay:not([hidden]) {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,0.5) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999 !important;
    padding: 20px !important;
  }
  
  /* Panel POPUP CENTRÉ - PAS fullscreen */
  .votd-popup-box, .random-popup-box {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 90% !important;
    max-width: 500px !important;
    height: 85vh !important;
    max-height: 85vh !important;
    border-radius: 16px !important;
    margin: 0 !important;
    transform: none !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  /* Conteneur principal scrollable */
  .votd-main-content, .random-main-content {
    flex: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Header avec bouton X visible */
  .votd-header, .random-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    padding: 16px 60px 16px 20px !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
  }
  
  /* Conteneur du bouton X */
  .votd-header > div[style*="absolute"],
  .random-header > div[style*="absolute"] {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    z-index: 100 !important;
  }
  
  /* Bouton X - toujours visible */
  .votd-close-btn, .random-close-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    font-size: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 101 !important;
    background: rgba(255,255,255,0.25) !important;
    border-radius: 50% !important;
  }
  
  .votd-icon-circle, .random-icon-circle {
    width: 46px;
    height: 46px;
  }
  
  .votd-title, .random-title {
    font-size: 17px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  .votd-main-content, .random-main-content {
    padding: 20px 24px;
    box-sizing: border-box;
  }
  
  #votd-text, #random-verse-text {
    font-size: 18px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
  
  .votd-share-btn, .random-share-btn {
    width: 42px;
    height: 42px;
    font-size: 17px;
  }
  
  .votd-share-buttons, .random-share-buttons {
    gap: 10px;
  }
  
  .votd-footer, .random-footer {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 10 !important;
  }
  
  /* Boutons avec texte sur plusieurs lignes si nécessaire */
  #votd-toggle-history, #random-new-verse, #random-study-verse, #votd-study-verse {
    white-space: normal;
    word-wrap: break-word;
    text-align: center;
    line-height: 1.3;
    min-height: 44px;
  }
}

/* ============================================
   RESPONSIVE - SMARTPHONES (max-width: 600px)
   Même logique que le panel Thème
   ============================================ */
@media (max-width: 600px) {
  /* BLOQUER TOUT SCROLL HORIZONTAL */
  html, body {
    overflow-x: hidden !important;
  }
  
  body.votd-open, body.random-verse-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
  }
  
  /* IMPORTANT: Respect de l'attribut hidden sur les overlays */
  #votd-overlay[hidden], #random-verse-overlay[hidden] {
    display: none !important;
  }
  
  /* Panel en plein écran - STRICTEMENT FIXÉ */
  #votd-overlay:not([hidden]), #random-verse-overlay:not([hidden]) {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
    -webkit-overflow-scrolling: touch;
    background: rgba(0,0,0,0.5) !important;
    padding: 0 !important;
    margin: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }
  
  .votd-popup-box, .random-popup-box {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    transform: none !important;
    overflow: hidden !important;
  }
  
  /* Header - FIXÉ EN HAUT, X VISIBLE */
  .votd-header, .random-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    padding: 14px 60px 14px 16px !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }
  
  /* Conteneur du bouton X - position absolue ajustée pour mobile */
  .votd-header > div[style*="absolute"],
  .random-header > div[style*="absolute"] {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    z-index: 1001 !important;
  }
  
  /* Bouton X - TOUJOURS VISIBLE À DROITE ET ENTIER */
  .votd-close-btn, .random-close-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    font-size: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1002 !important;
    background: rgba(255,255,255,0.3) !important;
    border-radius: 50% !important;
    border: none !important;
    color: white !important;
    cursor: pointer !important;
  }
  
  .votd-icon-circle, .random-icon-circle {
    width: 40px;
    height: 40px;
    margin-bottom: 8px;
  }
  
  .votd-icon-circle i, .random-icon-circle i {
    font-size: 20px !important;
  }
  
  .votd-title, .random-title {
    font-size: 15px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  .votd-date, .random-subtitle {
    font-size: 11px;
  }
  
  /* Contenu scrollable */
  .votd-scroll-content, .random-scroll-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100vw;
  }
  
  .votd-main-content, .random-main-content {
    padding: 14px 16px;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  
  #votd-reference, #random-verse-reference {
    font-size: 13px;
    margin-bottom: 10px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  #votd-text, #random-verse-text {
    font-size: 16px;
    line-height: 1.45;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    padding: 0 2px;
  }
  
  /* Footer fixe en bas */
  .votd-footer, .random-footer {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 1000 !important;
  }
  
  .votd-share-section, .random-share-section {
    padding: 10px 14px;
  }
  
  .votd-share-btn, .random-share-btn {
    width: 38px;
    height: 38px;
    font-size: 15px;
    flex-shrink: 0;
  }
  
  .votd-share-buttons, .random-share-buttons {
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .votd-close-section, .random-close-section {
    padding: 0 14px 12px;
  }
  
  .votd-close-main-btn, .random-close-main-btn {
    padding: 11px;
    font-size: 13px;
    white-space: normal;
    word-wrap: break-word;
  }
  
  /* Boutons internes - texte sur plusieurs lignes si long */
  #votd-version-select, #random-version-select {
    padding: 9px 10px;
    font-size: 12px;
    width: 100%;
    box-sizing: border-box;
  }
  
  #votd-toggle-history, #random-new-verse, #random-study-verse, #votd-study-verse {
    padding: 10px 12px;
    font-size: 12px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: center;
    line-height: 1.3;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Labels et textes */
  .votd-share-label, .random-share-label {
    font-size: 10px;
  }
  
  /* Sélecteur de version */
  .votd-main-content label, .random-main-content label {
    font-size: 10px;
  }
}

/* ============================================
   COMPARE PANEL - VISUAL ENHANCEMENTS & MOBILE
   ============================================ */

/* Enhanced visual polish */
.compare-panel {
  box-shadow: 0 25px 80px rgba(0,0,0,0.25), 0 10px 30px rgba(0,0,0,0.15);
}

.compare-header {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
  position: relative;
  overflow: hidden;
}

.compare-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.compare-header-icon {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
}

.compare-close-btn {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
}

.compare-close-btn:hover {
  background: rgba(255,255,255,0.25);
  transform: scale(1.08);
}

/* Improved tabs */
.compare-tabs {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border-bottom: 1px solid #e2e8f0;
}

.compare-tab {
  position: relative;
  transition: all 0.2s ease;
}

.compare-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 3px 3px 0 0;
}

/* Enhanced cards */
.compare-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  transition: all 0.2s ease;
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.compare-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15);
  transform: translateY(-2px);
}

.compare-card-version {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

/* Smooth loading animation */
.compare-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: compareSpinSmooth 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes compareSpinSmooth {
  to { transform: rotate(360deg); }
}

/* Enhanced chapter comparison columns */
.compare-chapter-column {
  background: #ffffff;
  transition: all 0.2s ease;
}

.compare-chapter-column:hover {
  background: #fafbfc;
}

.compare-verse-row {
  transition: background 0.15s ease;
  border-radius: 6px;
  margin: 2px 0;
  padding: 8px !important;
}

.compare-verse-row:hover {
  background: rgba(59, 130, 246, 0.08);
}

.compare-verse-num {
  background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  min-width: 28px;
}

/* Results header polish */
.compare-results-header {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border-bottom: 1px solid #e2e8f0;
}

/* Action buttons polish */
.compare-action-btn.primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
  transition: all 0.2s ease;
}

.compare-action-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.compare-action-btn.secondary {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border: 1px solid #cbd5e1;
  color: #334155 !important;
}

.compare-action-btn.secondary:hover {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  color: #1e293b !important;
}

/* Fix scroll comparaison - Laptops */
@media (min-width: 1025px) and (max-width: 1366px) {
  .compare-panel {
    min-height: min(800px, 96vh);
    max-height: 96vh;
  }
  
  .compare-results-wrapper {
    max-height: calc(96vh - 220px);
    overflow: hidden;
  }
  
  .compare-results {
    overflow-y: auto;
    max-height: 100%;
  }
}

/* ============================================
   RESPONSIVE - TABLETS (768px - 1024px)
   Sur tablettes et laptops: popup centré normal
   ============================================ */
@media (min-width: 768px) and (max-width: 1024px) {
  .compare-panel-overlay {
    padding: 20px !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .compare-panel {
    width: 90% !important;
    max-width: 900px !important;
    height: auto !important;
    min-height: min(650px, 88vh) !important;
    max-height: 90vh !important;
    border-radius: 16px !important;
    margin: auto !important;
  }
  
  .compare-results-wrapper {
    max-height: calc(90vh - 280px);
    overflow: hidden;
  }
  
  .compare-results {
    overflow-y: auto;
  }
  
  .compare-header {
    padding: 16px 20px;
    border-radius: 0;
  }
  
  .compare-header-title {
    font-size: 18px;
  }
  
  .compare-tabs {
    padding: 0;
  }
  
  .compare-tab {
    padding: 14px 24px;
    font-size: 15px;
  }
  
  .compare-content {
    padding: 16px 20px;
    flex: 1;
    overflow-y: auto;
  }
  
  .compare-chapter-results {
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }
  
  .compare-chapter-column-header {
    padding: 8px;
  }
  
  .compare-header-select {
    font-size: 14px;
    padding: 12px 32px 12px 14px;
  }
  
  .compare-results-wrapper {
    flex: 1;
    min-height: 0;
  }
  
  .compare-close-btn {
    width: 40px;
    height: 40px;
  }
  
  .compare-close-btn svg {
    width: 24px;
    height: 24px;
  }
}

/* ============================================
   RESPONSIVE - SMARTPHONES (< 768px)
   ============================================ */
@media (max-width: 767px) {
  /* Full screen overlay */
  .compare-panel-overlay {
    padding: 0 !important;
    background: #ffffff !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    overflow: hidden !important;
  }
  
  /* Full screen panel */
  .compare-panel {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important; /* Dynamic viewport height for mobile browsers */
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    overflow-x: hidden !important;
  }
  
  /* Prevent horizontal scroll on results */
  .compare-results,
  .compare-chapter-results {
    overflow-x: hidden !important;
    max-width: 100% !important;
  }
  
  /* Fix version dropdown width on mobile */
  .compare-chapter-column {
    min-width: 0 !important;
    overflow: hidden !important;
  }
  
  .compare-chapter-column-header {
    padding: 4px !important;
    overflow: hidden !important;
  }
  
  .compare-header-select {
    width: 100% !important;
    max-width: 100% !important;
    font-size: 11px !important;
    padding: 8px 20px 8px 6px !important;
    min-height: 40px;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    background-position: right 4px center !important;
    background-size: 10px 10px !important;
  }
  
  /* Compact header */
  .compare-header {
    padding: 12px 16px;
    border-radius: 0;
    min-height: 56px;
  }
  
  .compare-header-icon {
    width: 36px;
    height: 36px;
  }
  
  .compare-header-icon svg {
    width: 18px;
    height: 18px;
  }
  
  .compare-header-title {
    font-size: 16px;
  }
  
  .compare-header-subtitle {
    font-size: 11px;
  }
  
  /* Close button - prominent for touch */
  .compare-close-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
  }
  
  .compare-close-btn svg {
    width: 22px;
    height: 22px;
  }
  
  /* Tabs - scrollable */
  .compare-tabs {
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  
  .compare-tabs::-webkit-scrollbar {
    display: none;
  }
  
  .compare-tab {
    padding: 12px 16px;
    font-size: 14px;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
  }
  
  .compare-tab span {
    display: inline;
  }
  
  .compare-tab svg {
    width: 18px;
    height: 18px;
  }
  
  /* Content area - full height */
  .compare-content {
    padding: 12px 14px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }
  
  /* Version selector - stacked */
  .compare-version-selector {
    flex-direction: column;
    gap: 12px;
  }
  
  .compare-version-card {
    min-width: 100%;
  }
  
  .compare-arrow-icon {
    align-self: center;
    transform: rotate(90deg);
    width: 28px;
    height: 28px;
  }
  
  .compare-select {
    padding: 12px 14px;
    font-size: 14px;
    min-height: 48px;
  }
  
  /* Action buttons - full width, stacked */
  .compare-quick-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .compare-action-btn {
    width: 100%;
    padding: 14px 16px;
    font-size: 14px;
    min-height: 50px;
    border-radius: 10px;
  }
  
  .compare-action-btn.full-width {
    margin-top: 8px;
  }
  
  /* Book/Chapter selector */
  .compare-book-chapter-row {
    flex-direction: column;
    gap: 12px;
  }
  
  .compare-book-col,
  .compare-chapter-col {
    width: 100%;
  }
  
  .compare-custom-dropdown-btn {
    min-height: 48px;
    font-size: 14px;
    padding: 12px 40px 12px 14px;
  }
  
  .compare-custom-dropdown-menu {
    max-height: 250px;
  }
  
  .compare-custom-dropdown-item {
    padding: 14px 16px;
    font-size: 14px;
  }
  
  /* Version grid - stacked */
  .compare-version-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  /* Results wrapper */
  .compare-results-wrapper {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  
  /* Results header - compact */
  .compare-results-header {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .compare-results-count {
    font-size: 12px;
  }
  
  /* Navigation inline - compact but showing both dropdowns */
  .compare-nav-inline {
    display: flex !important;
    flex-wrap: nowrap;
    overflow-x: visible;
    overflow-y: visible;
    padding-bottom: 4px;
    gap: 6px;
    align-items: center;
    min-width: 0;
  }
  
  .compare-nav-inline .compare-dropdown {
    flex: 0 0 auto;
    min-width: 80px;
    max-width: 120px;
    position: relative;
    z-index: 1000;
  }
  
  .compare-nav-inline .compare-dropdown-chapter {
    min-width: 75px;
    max-width: 95px;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  .compare-nav-btn {
    min-width: 32px;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }
  
  .compare-dropdown-btn {
    padding: 6px 24px 6px 10px;
    font-size: 12px;
    min-height: 36px;
    height: 36px;
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.3);
    touch-action: manipulation;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    z-index: 100;
    pointer-events: auto !important;
  }
  
  /* Make dropdown button more visible and clickable */
  .compare-nav-inline .compare-dropdown {
    position: relative;
    z-index: 100;
    pointer-events: auto !important;
  }
  
  .compare-nav-inline .compare-dropdown-btn {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    pointer-events: auto !important;
  }
  
  .compare-nav-inline .compare-dropdown-btn:active {
    background: #e2e8f0;
    transform: scale(0.98);
  }
  
  /* Ensure dropdown menus work on mobile */
  .compare-nav-inline .compare-dropdown-menu {
    position: absolute;
    z-index: 99999 !important;
    min-width: 160px;
    max-height: 250px;
    left: 0;
    top: 100%;
    margin-top: 4px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    pointer-events: auto !important;
  }
  
  .compare-nav-inline .compare-dropdown.open .compare-dropdown-menu {
    display: block !important;
  }
  
  .compare-nav-inline .compare-dropdown-item {
    padding: 12px 14px;
    font-size: 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    pointer-events: auto !important;
  }
  
  .compare-nav-inline .compare-dropdown-item:last-child {
    border-bottom: none;
  }
  
  .compare-nav-inline .compare-dropdown-item:active {
    background: #eff6ff;
  }
  
  /* Results container */
  #compare-results {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Result groups */
  .compare-result-group {
    margin-bottom: 12px;
    border-radius: 10px;
  }
  
  .compare-result-group-header {
    padding: 12px 14px;
    font-size: 13px;
  }
  
  /* Cards - optimized for touch */
  .compare-result-cards {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }
  
  .compare-card {
    padding: 12px;
    border-radius: 10px;
  }
  
  .compare-card-header {
    margin-bottom: 8px;
  }
  
  .compare-card-version {
    font-size: 12px;
  }
  
  .compare-card-text {
    font-size: 14px;
    line-height: 1.6;
  }
  
  .compare-card-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }
  
  /* Chapter comparison - stacked on mobile */
  .compare-chapter-results {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .compare-chapter-column {
    border-right: none !important;
  }
  
  .compare-chapter-column:first-child {
    border-bottom: 2px solid #e2e8f0;
  }
  
  .compare-chapter-column-header {
    padding: 6px 8px;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  
  .compare-header-select {
    font-size: 13px;
    padding: 10px 28px 10px 12px;
    min-height: 44px;
  }
  
  .compare-chapter-verses {
    padding: 8px;
    max-height: 40vh;
  }
  
  .compare-verse-row {
    padding: 10px 8px !important;
    gap: 10px;
  }
  
  .compare-verse-num {
    font-size: 13px;
    min-width: 24px;
  }
  
  .compare-verse-text {
    font-size: 14px;
    line-height: 1.6;
  }
  
  /* Empty state */
  .compare-empty-state {
    padding: 40px 20px;
  }
  
  .compare-empty-state svg {
    width: 40px;
    height: 40px;
  }
  
  .compare-empty-state p {
    font-size: 13px;
  }
  
  /* Loading state */
  .compare-loading {
    padding: 40px 20px;
  }
  
  .compare-loading-spinner {
    width: 32px;
    height: 32px;
  }
  
  .compare-loading-text {
    font-size: 13px;
  }
  
  /* Warning */
  .compare-warning {
    padding: 10px 12px;
    font-size: 12px;
    border-radius: 8px;
  }
  
  /* Tools buttons */
  .compare-tools {
    gap: 6px;
  }
  
  .compare-tool-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }
}

/* ============================================
   EXTRA SMALL SCREENS (< 375px)
   ============================================ */
@media (max-width: 374px) {
  .compare-header {
    padding: 10px 12px;
  }
  
  .compare-header-title {
    font-size: 14px;
  }
  
  .compare-tab {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  .compare-tab svg {
    display: none;
  }
  
  .compare-content {
    padding: 10px;
  }
  
  .compare-action-btn {
    padding: 12px 14px;
    font-size: 13px;
  }
  
  .compare-card-text {
    font-size: 13px;
  }
  
  .compare-verse-text {
    font-size: 13px;
  }
  
  /* Even smaller version dropdown for tiny screens */
  .compare-header-select {
    font-size: 10px !important;
    padding: 6px 16px 6px 4px !important;
    background-position: right 2px center !important;
  }
  
  .compare-chapter-column-header {
    padding: 2px !important;
  }
}

/* ============================================
   iOS SPECIFIC FIXES
   ============================================ */
@supports (-webkit-touch-callout: none) {
  /* Safe area insets for notched devices */
  .compare-panel {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  
  .compare-header {
    padding-top: calc(12px + env(safe-area-inset-top));
  }
  
  /* Fix for iOS rubber-band scrolling */
  .compare-panel-overlay {
    position: fixed;
    overflow-x: hidden;
    overflow-y: auto;
  }
  
  .compare-content {
    overscroll-behavior: contain;
    overflow-y: auto;
  }
  
  #compare-results {
    overscroll-behavior: contain;
  }
}

/* ============================================
   LANDSCAPE ORIENTATION ON MOBILE
   ============================================ */
@media (max-width: 900px) and (orientation: landscape) {
  .compare-header {
    padding: 8px 16px;
    min-height: 48px;
  }
  
  .compare-header-icon {
    width: 32px;
    height: 32px;
  }
  
  .compare-header-title {
    font-size: 14px;
  }
  
  .compare-header-subtitle {
    display: none;
  }
  
  .compare-tab {
    padding: 8px 16px;
    font-size: 13px;
  }
  
  .compare-content {
    padding: 8px 12px;
  }
  
  .compare-chapter-verses {
    max-height: 50vh;
  }
  
  .compare-action-btn {
    padding: 10px 14px;
    min-height: 40px;
  }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .compare-card:hover {
    transform: none;
    box-shadow: none;
    border-color: #e2e8f0;
  }
  
  .compare-verse-row:hover {
    background: transparent;
  }
  
  /* Active states for touch */
  .compare-card:active {
    background: #f8fafc;
    transform: scale(0.99);
  }
  
  .compare-verse-row:active {
    background: rgba(59, 130, 246, 0.1);
  }
  
  .compare-action-btn:active {
    transform: scale(0.98);
  }
  
  .compare-tab:active {
    background: #e2e8f0;
  }
  
  /* Ensure touch targets are at least 44x44px */
  .compare-close-btn,
  .compare-nav-btn,
  .compare-tool-btn,
  .compare-card-btn {
    min-width: 44px;
    min-height: 44px;
  }
}

/* ============================================
   INNOVATIVE FEATURE: DIFFERENCE HIGHLIGHTING
   ============================================ */

/* Feature button active state */
.compare-feature-btn.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-color: #3b82f6;
}

.compare-feature-btn.active:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* Highlighted differences in text */
.compare-diff-word {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  padding: 1px 4px;
  border-radius: 3px;
  border-bottom: 2px solid #f59e0b;
  font-weight: 500;
}

.compare-diff-added {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border-bottom-color: #10b981;
}

.compare-diff-removed {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border-bottom-color: #ef4444;
  text-decoration: line-through;
  opacity: 0.7;
}

/* Comparison stats badge */
.compare-stats-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
}

.compare-stats-badge svg {
  width: 12px;
  height: 12px;
}

.compare-stats-item {
  display: flex;
  align-items: center;
  gap: 3px;
}

.compare-stats-item.similarity {
  color: #10b981;
}

.compare-stats-item.differences {
  color: #f59e0b;
}

/* Sync scroll indicator */
.compare-sync-indicator {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(59, 130, 246, 0.95);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.compare-sync-indicator.visible {
  opacity: 1;
}

.compare-sync-indicator svg {
  width: 16px;
  height: 16px;
  animation: syncPulse 1.5s ease-in-out infinite;
}

@keyframes syncPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Quick jump dots for chapter navigation */
.compare-chapter-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.compare-chapter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.compare-chapter-dot:hover {
  background: #94a3b8;
  transform: scale(1.3);
}

.compare-chapter-dot.active {
  background: #3b82f6;
  transform: scale(1.4);
}

.compare-chapter-dot.read {
  background: #10b981;
}

/* Swipe hint for mobile */
@media (max-width: 767px) {
  .compare-swipe-hint {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: swipeHintFade 3s ease-in-out forwards;
    pointer-events: none;
  }
  
  @keyframes swipeHintFade {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    10% { opacity: 1; transform: translateX(-50%) translateY(0); }
    80% { opacity: 1; }
    100% { opacity: 0; }
  }
  
  .compare-swipe-hint svg {
    width: 16px;
    height: 16px;
    animation: swipeIcon 1s ease-in-out infinite;
  }
  
  @keyframes swipeIcon {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(5px); }
  }
}