:root {
   --iadn-dark: #213d5d;
   --iadn-mid: #3f73af;
   --iadn-light: #e8f0fa;
   --iadn-accent: #f0a500;
}

* {
   box-sizing: border-box;
}

body {
   background: #f4f7fb;
   font-family: 'Segoe UI', system-ui, sans-serif;
   min-height: 100vh;
}

/* ── Header ── */
.site-header {
   background: linear-gradient(135deg, var(--iadn-dark) 0%, var(--iadn-mid) 100%);
   padding: 28px 0 60px;
   position: relative;
   overflow: hidden;
}

.site-header::after {
   content: '';
   position: absolute;
   bottom: -20px;
   left: 0;
   right: 0;
   height: 60px;
   background: #f4f7fb;
   clip-path: ellipse(55% 100% at 50% 100%);
}

.site-header .logo-text {
   font-size: 1.1rem;
   font-weight: 700;
   letter-spacing: 2px;
   color: rgba(255, 255, 255, .55);
   text-transform: uppercase;
}

.site-header h1 {
   color: #fff;
   font-size: clamp(1.4rem, 4vw, 2rem);
   font-weight: 700;
   margin: 6px 0 0;
}

.site-header p {
   color: rgba(255, 255, 255, .7);
   font-size: .9rem;
   margin: 6px 0 0;
}

/* ── Header layout ── */
.header-inner {
   position: relative;
   display: flex;
   align-items: center;
   justify-content: center;
   min-height: 70px;
}

.header-logo {
   position: absolute;
   left: 0;
   top: 50%;
   transform: translateY(-50%);
}

.site-logo img {
   height: 72px;
   width: auto;
   object-fit: contain;
   filter: brightness(0) invert(1) opacity(.75);
   transition: opacity .2s;
}

.site-logo:hover {
   opacity: 1;
   filter: brightness(0) invert(1) opacity(1);
}

/* Responsive : logo plus petit sur mobile */
@media (max-width: 575px) {
   .site-logo {
      height: 48px;
   }

   .header-inner {
      flex-direction: column;
      gap: 10px;
   }

   .header-logo {
      position: static;
      transform: none;
   }
}

/* ── Lecteur sticky ── */
.player-wrap {
   position: sticky;
   top: 12px;
   z-index: 100;
   filter: drop-shadow(0 4px 16px rgba(33, 61, 93, .25));
}

/* ── Cartes audio ── */
.audio-card {
   background: #fff;
   border-radius: 12px;
   border: 1.5px solid #e2e8f4;
   padding: 14px 16px;
   cursor: pointer;
   transition: border-color .2s, box-shadow .2s, transform .15s;
   position: relative;
   overflow: hidden;
}

.audio-card::before {
   content: '';
   position: absolute;
   left: 0;
   top: 0;
   bottom: 0;
   width: 4px;
   background: var(--iadn-mid);
   border-radius: 4px 0 0 4px;
   transform: scaleY(0);
   transition: transform .2s;
}

.audio-card:hover,
.audio-card.active {
   border-color: var(--iadn-mid);
   box-shadow: 0 4px 18px rgba(63, 115, 175, .15);
   transform: translateX(3px);
}

.audio-card:hover::before,
.audio-card.active::before {
   transform: scaleY(1);
}

.audio-card.active {
   background: var(--iadn-light);
}

.audio-card .badge-manuel {
   font-size: .68rem;
   background: var(--iadn-light);
   color: var(--iadn-dark);
   border-radius: 20px;
   padding: 2px 8px;
   font-weight: 600;
}

.audio-card .badge-page {
   font-size: .68rem;
   background: var(--iadn-accent);
   color: #fff;
   border-radius: 20px;
   padding: 2px 8px;
   font-weight: 700;
}

.audio-card .libelle {
   font-size: .95rem;
   font-weight: 600;
   color: var(--iadn-dark);
   margin: 5px 0 2px;
   line-height: 1.3;
}

.audio-card .ic-play {
   color: var(--iadn-mid);
   font-size: 1.6rem;
   flex-shrink: 0;
   transition: transform .2s;
}

.audio-card:hover .ic-play,
.audio-card.active .ic-play {
   transform: scale(1.15);
}

.audio-card.no-file {
   opacity: .55;
   cursor: default;
   pointer-events: none;
}

/* ── Filtres ── */
.filters-wrap .form-select,
.filters-wrap .form-control {
   border-radius: 20px;
   border: 1.5px solid #d0daec;
   font-size: .9rem;
   color: var(--iadn-dark);
   transition: border-color .2s;
}

.filters-wrap .form-select:focus,
.filters-wrap .form-control:focus {
   border-color: var(--iadn-mid);
   box-shadow: none;
}

.search-icon-wrap {
   position: relative;
}

.search-icon-wrap .bi-search {
   position: absolute;
   left: 14px;
   top: 50%;
   transform: translateY(-50%);
   color: #8a9bbf;
   pointer-events: none;
}

.search-icon-wrap .form-control {
   padding-left: 38px;
}

/* ── Spinner ── */
#loadingSpinner {
   display: none;
   text-align: center;
   padding: 20px 0;
   color: var(--iadn-mid);
}

/* ── Empty state ── */
.empty-state {
   text-align: center;
   color: #a0aec0;
   padding: 40px 0;
}

/* ── Pagination ── */
.pagination .page-link {
   color: var(--iadn-mid);
   border-color: #d0daec;
   min-width: 34px;
   text-align: center;
}

.pagination .page-item.active .page-link {
   background: var(--iadn-mid);
   border-color: var(--iadn-mid);
   color: #fff;
}

.pagination .page-item.disabled .page-link {
   color: #b0bec5;
}

/* ── Footer ── */
footer {
   background: var(--iadn-dark);
   color: rgba(255, 255, 255, .5);
   text-align: center;
   font-size: .8rem;
   padding: 16px;
   margin-top: 48px;
}

/* ── Bouton QR scanner centré sous l'en-tête ── */
.qr-scan-center {
   display: flex;
   flex-direction: column;
   align-items: center;
   gap: 6px;
   margin-bottom: 2rem;
   margin-top: -40px;
}

.qr-scan-label {
   font-size: .78rem;
   font-weight: 600;
   color: var(--iadn-mid);
   letter-spacing: .5px;
   text-transform: uppercase;
}

.btn-qr-scan {
   background: var(--iadn-mid);
   border: 2px solid var(--iadn-dark);
   color: #fff;
   border-radius: 14px;
   width: 52px;
   height: 52px;
   font-size: 1.4rem;
   display: flex;
   align-items: center;
   justify-content: center;
   cursor: pointer;
   transition: background .2s, transform .2s, box-shadow .2s;
   box-shadow: 0 2px 12px rgba(33, 61, 93, .22);
}

.btn-qr-scan:hover {
   background: var(--iadn-dark);
   transform: scale(1.08);
   box-shadow: 0 4px 18px rgba(33, 61, 93, .35);
}

.btn-qr-scan:active {
   transform: scale(.97);
}

/* ── Modal QR ── */
.qr-modal-content {
   background: linear-gradient(#555, #111);
   color: #e0e0e0;
   border: none;
   border-radius: 18px;
   overflow: hidden;
}

.qr-modal-content .modal-header {
   background: rgba(3, 31, 73, 0.712);
}

.qr-modal-content .modal-title {
   color: #fff;
   font-weight: 600;
   margin: 0 10px 15px;
}

#qr-reader {
   border-radius: 12px;
   overflow: hidden;
   border: 3px solid rgba(255, 255, 255, 0.15);
   max-width: 300px;
   margin: 0 auto;
}

/* Masquer les éléments inutiles injectés par html5-qrcode */
#qr-reader__header_message,
#qr-reader__filescan_input,
#qr-reader__dashboard_section_swaplink {
   display: none !important;
}

#qr-reader__dashboard {
   display: none !important;
}

.qr-hint {
   font-size: .82rem;
}

/* ── Prompt autoplay ── */
.btn-autoplay-prompt {
   display: flex;
   align-items: center;
   justify-content: center;
   width: 100%;
   margin-top: .75rem;
   padding: .6rem 1rem;
   background: linear-gradient(135deg, #4f8ef7, #7c5ce0);
   color: #fff;
   font-weight: 600;
   font-size: .9rem;
   border: none;
   border-radius: 7px;
   cursor: pointer;
   box-shadow: 0 4px 14px rgba(79, 142, 247, .35);
   transition: opacity .2s, transform .15s;
   animation: pulsePlay 1.8s ease-in-out infinite;
}

.btn-autoplay-prompt:hover {
   opacity: .88;
   transform: scale(1.02);
}

.btn-autoplay-prompt:active {
   transform: scale(.97);
}

@keyframes pulsePlay {

   0%,
   100% {
      box-shadow: 0 4px 14px rgba(79, 142, 247, .35);
   }

   50% {
      box-shadow: 0 4px 22px rgba(79, 142, 247, .65);
   }
}