/* =======================================================
   🎵 MHG PDF Viewer — Style Métronome (Cuir & Laiton)
   ======================================================= */

:root {
  --mhg-pdf-bg: #4a2e14;
  --mhg-pdf-bg-texture: url('https://www.cours-de-guitare-montpellier.fr/wp-content/uploads/2025/11/texture-cuir-fonce.jpg');
  --mhg-pdf-panel: rgba(10, 5, 0, 0.55);
  --mhg-pdf-gold: #e8c47a;
  --mhg-pdf-cream: #f6e7d0;
  --mhg-pdf-accent: #ba8225;
  --mhg-pdf-shadow: rgba(0, 0, 0, 0.7);
  --mhg-pdf-radius: 14px;
  --mhg-pdf-border: 1px solid rgba(255, 255, 255, 0.12);
  --mhg-pdf-blur: blur(8px);
  --mhg-pdf-gap: 12px;
  --mhg-pdf-font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

.mhg-pdf-viewer {
  position: relative;
  width: 100%;
  margin: 22px auto;
  padding: 18px 18px 16px;
  box-sizing: border-box;
  font-family: var(--mhg-pdf-font);
  color: var(--mhg-pdf-cream);
  background: var(--mhg-pdf-bg) var(--mhg-pdf-bg-texture) center/cover;
  border-radius: var(--mhg-pdf-radius);
  border: var(--mhg-pdf-border);
  box-shadow: 0 10px 25px var(--mhg-pdf-shadow);
  overflow: hidden;
  isolation: isolate;
}

.mhg-pdf-viewer::before,
.mhg-pdf-viewer::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--mhg-pdf-radius);
  pointer-events: none;
}

.mhg-pdf-viewer::before {
  background: radial-gradient(circle at 20% 20%, rgba(255, 240, 210, 0.08), transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(255, 210, 140, 0.07), transparent 35%);
  opacity: 0.9;
  z-index: 0;
}

.mhg-pdf-viewer::after {
  backdrop-filter: var(--mhg-pdf-blur);
  -webkit-backdrop-filter: var(--mhg-pdf-blur);
  z-index: 0;
}

.mhg-pdf-viewer > * {
  position: relative;
  z-index: 1;
}

/* ---- Toolbar ---- */
.mhg-pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--mhg-pdf-gap);
  padding: 10px 12px;
  background: var(--mhg-pdf-panel);
  border-radius: calc(var(--mhg-pdf-radius) - 4px);
  border: var(--mhg-pdf-border);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.45);
}

.mhg-pdf-toolbar .mhg-pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: var(--mhg-pdf-cream);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 10px;
  border: var(--mhg-pdf-border);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.01));
  box-shadow:
    0 5px 14px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.3s ease;
  user-select: none;
}

.mhg-pdf-toolbar .mhg-pdf-btn img {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}

.mhg-pdf-toolbar .mhg-pdf-btn:focus,
.mhg-pdf-toolbar .mhg-pdf-btn:hover {
  outline: none;
  transform: translateY(-1px) scale(1.01);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.6),
    0 0 0 2px rgba(255, 255, 255, 0.12);
}

.mhg-pdf-toolbar .mhg-pdf-btn:active {
  transform: translateY(0) scale(0.99);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.15), rgba(255, 255, 255, 0));
}

.mhg-pdf-toolbar .mhg-pdf-btn[data-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.4);
}

/* ---- Canvas ---- */
.mhg-pdf-canvas-wrapper {
  margin: 16px auto 12px;
  width: 100%;
  background: var(--mhg-pdf-panel);
  border-radius: calc(var(--mhg-pdf-radius) - 2px);
  border: var(--mhg-pdf-border);
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.55),
    0 10px 25px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  position: relative;
  padding: 14px;
  box-sizing: border-box;
}

.mhg-pdf-canvas {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
  background: #fff;
  box-shadow:
    0 12px 25px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  transition: opacity 0.25s ease;
}

/* ---- Pagination ---- */
.mhg-pdf-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px 6px;
  color: var(--mhg-pdf-cream);
  font-weight: 600;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.25));
  border-radius: calc(var(--mhg-pdf-radius) - 6px);
  border: var(--mhg-pdf-border);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.35);
}

.mhg-pdf-pagination .mhg-page-number,
.mhg-pdf-pagination .mhg-total-pages {
  color: var(--mhg-pdf-gold);
  font-variant-numeric: tabular-nums;
}

/* ---- States ---- */
.mhg-pdf-viewer[data-mhg-loading="true"] .mhg-pdf-canvas {
  opacity: 0.35;
  filter: grayscale(0.1) blur(0.3px);
}

.mhg-pdf-error {
  color: #ffd3cf;
  background: rgba(130, 16, 16, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  font-weight: 600;
  text-align: center;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .mhg-pdf-viewer {
    padding: 14px;
    border-radius: 12px;
  }

  .mhg-pdf-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .mhg-pdf-toolbar .mhg-pdf-btn {
    justify-content: center;
    width: 100%;
  }

  .mhg-pdf-canvas-wrapper {
    padding: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mhg-pdf-viewer,
  .mhg-pdf-canvas,
  .mhg-pdf-toolbar .mhg-pdf-btn {
    transition: none !important;
  }
}
