/* KP Notes Studio Sheet Music Generator & Action Button */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700;800&display=swap');

.kp-pdf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.38rem 0.9rem;
  font-family: var(--bb-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  color: #ffffff !important;
  background: #ea2b2b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  cursor: pointer;
  text-decoration: none !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(234, 43, 43, 0.2);
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.kp-pdf-btn:hover {
  background: #b91c1c;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(234, 43, 43, 0.35);
  color: #ffffff !important;
}

.kp-pdf-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.kp-pdf-btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.kp-pdf-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.kp-pdf-btn:hover svg {
  transform: translateY(1px);
}

.kp-pdf-btn--loading {
  opacity: 0.85;
  pointer-events: none;
  cursor: wait;
}

.kp-pdf-btn--loading svg {
  animation: kp-pdf-spin 0.8s linear infinite;
}

@keyframes kp-pdf-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Toast Notification */
.kp-pdf-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #f8fafc;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  font-family: 'JetBrains Mono', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  z-index: 999999;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.kp-pdf-toast.kp-pdf-toast--visible,
.kp-pdf-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.kp-pdf-toast__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #ea2b2b;
  border-radius: 50%;
  animation: kp-pdf-spin 0.8s linear infinite;
}

/* Printable stage container */
#kp-pdf-render-stage {
  width: 794px;
  background: #ffffff !important;
  color: #0f172a !important;
  font-family: "JetBrains Mono", Consolas, "SF Mono", monospace !important;
  padding: 32px 36px !important;
  box-sizing: border-box !important;
  overflow: visible;
}

#kp-pdf-render-stage * {
  box-sizing: border-box !important;
}

#kp-pdf-render-stage .kp-bb-ad,
#kp-pdf-render-stage .kp-practice-toolbar,
#kp-pdf-render-stage #music-toolbar,
#kp-pdf-render-stage .kp-song__actions,
#kp-pdf-render-stage button {
  display: none !important;
}

/* Responsive banner integration */
.kp-notation__panel-banner,
.kp-sargam-notation__bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.kp-notation__panel-banner .kp-pdf-btn,
.kp-sargam-notation__bar .kp-pdf-btn {
  margin-left: auto;
}

@media (max-width: 640px) {
  .kp-notation__panel-banner,
  .kp-sargam-notation__bar {
    justify-content: space-between;
  }
  .kp-pdf-btn {
    font-size: 0.75rem;
    padding: 0.3rem 0.65rem;
  }
}

/* Disable selection and copying of notation content */
#music-post-content,
#music-post-content *,
#music-post-content-hindi,
#music-post-content-hindi *,
.kp-song__notes,
.kp-song__notes *,
.kp-sargam-notation,
.kp-sargam-notation *,
#kp-sargam-notation,
#kp-sargam-notation *,
.kp-sargam-tabset,
.kp-sargam-tabset *,
.kp-notation-surface,
.kp-notation-surface *,
.lyrics-text,
.notation-text,
.notes-heading,
.tab-panel[data-script] * {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

/* Display-ad gate before PDF download */
html.kp-pdf-ad-gate-open,
html.kp-pdf-ad-gate-open body {
  overflow: hidden;
}

.kp-pdf-ad-gate {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.kp-pdf-ad-gate__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
}

.kp-pdf-ad-gate__panel {
  position: relative;
  width: min(420px, 100%);
  background: #ffffff;
  color: #0f172a;
  border-radius: 16px;
  padding: 1.25rem 1.25rem 1rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  font-family: var(--bb-font, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

.kp-pdf-ad-gate__close {
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
}

.kp-pdf-ad-gate__title {
  margin: 0 1.5rem 0.35rem 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.kp-pdf-ad-gate__copy {
  margin: 0 0 0.65rem;
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.45;
  min-height: 1.3em;
}

.kp-pdf-ad-gate__progress {
  height: 8px;
  border-radius: 9999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-bottom: 0.35rem;
}

.kp-pdf-ad-gate__progress-bar {
  height: 100%;
  width: 3%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #ea2b2b, #f97316);
  transition: width 0.85s ease;
}

.kp-pdf-ad-gate__pct {
  text-align: right;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.75rem;
}

.kp-pdf-ad-gate__ad {
  min-height: 120px;
  margin-bottom: 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
}

.kp-pdf-ad-gate__placeholder {
  padding: 1.25rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.8125rem;
}

.kp-pdf-ad-gate__continue {
  width: 100%;
  border: 0;
  border-radius: 9999px;
  padding: 0.7rem 1rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  background: #ea2b2b;
  cursor: pointer;
}

.kp-pdf-ad-gate__continue:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.kp-pdf-ad-gate__cancel {
  display: block;
  width: 100%;
  margin-top: 0.45rem;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 0.8125rem;
  cursor: pointer;
  padding: 0.45rem;
}

