/* ===================== GENERAL ===================== */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  scroll-behavior: smooth;
}

/* ===================== ANTI-SELECT / PROTECTION ===================== */
#canvas-container,
#pdf-canvas,
#pdf-overlay {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

#pdf-overlay {
  cursor: default;
}

/* ===================== PRINT PROTECTION ===================== */
@media print {
  body {
    display: none !important;
  }
  html::after {
    content: "La impresion de este contenido no esta permitida.";
    display: block;
    font-size: 24px;
    text-align: center;
    padding: 40px;
  }
}

/* ===================== LOADING SPINNER ===================== */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(36, 113, 163, 0.15);
  border-top-color: #2471a3;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===================== CUSTOM SCROLLBAR ===================== */
.playlist-scroll::-webkit-scrollbar {
  width: 6px;
}

.playlist-scroll::-webkit-scrollbar-track {
  background: #0f1520;
  border-radius: 3px;
}

.playlist-scroll::-webkit-scrollbar-thumb {
  background: #2a3a4e;
  border-radius: 3px;
}

.playlist-scroll::-webkit-scrollbar-thumb:hover {
  background: #3a4f6a;
}

/* Firefox */
.playlist-scroll {
  scrollbar-width: thin;
  scrollbar-color: #2a3a4e #0f1520;
}

/* ===================== PLAYLIST ITEMS ===================== */
.playlist-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.playlist-item:last-child {
  border-bottom: none;
}

.playlist-item:hover {
  background: rgba(30, 45, 61, 0.6);
  border-left-color: rgba(36, 113, 163, 0.3);
}

.playlist-item.active {
  background: rgba(36, 113, 163, 0.08);
  border-left-color: #2471a3;
}

.playlist-item.active .playlist-number {
  background: #2471a3;
  color: #0f1520;
}

.playlist-item .playlist-number {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: rgba(30, 45, 61, 0.8);
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.playlist-item:hover .playlist-number {
  background: rgba(36, 113, 163, 0.15);
  color: #2471a3;
}

.playlist-item .playlist-info {
  flex: 1;
  min-width: 0;
}

.playlist-item .playlist-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s ease;
}

.playlist-item:hover .playlist-title,
.playlist-item.active .playlist-title {
  color: #ffffff;
}

.playlist-item .playlist-desc {
  font-size: 0.75rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.125rem;
}

.playlist-item .playlist-icon {
  flex-shrink: 0;
  color: #94a3b8;
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.playlist-item:hover .playlist-icon,
.playlist-item.active .playlist-icon {
  opacity: 1;
  color: #2471a3;
}

/* ===================== PDF ANNOTATION LINKS ===================== */
#annotation-layer {
  pointer-events: none;
}

.pdf-link-annot {
  pointer-events: auto;
  cursor: pointer;
  border-radius: 2px;
  transition: background-color 0.2s ease;
}

.pdf-link-annot:hover {
  background-color: rgba(36, 113, 163, 0.15);
}

/* ===================== WATERMARK ===================== */
.watermark-text {
  white-space: nowrap;
  letter-spacing: 0.15em;
}

/* ===================== FADE TRANSITION ===================== */
#pdf-canvas {
  transition: opacity 0.3s ease;
}

#pdf-canvas.fade-out {
  opacity: 0;
}

/* ===================== FEATURE CARDS ANIMATION ===================== */
.feature-card {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.feature-card.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===================== FULLSCREEN MODE ===================== */
.bg-pmp-dark:fullscreen {
  background: #0f1520;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
}

.bg-pmp-dark:fullscreen #canvas-container {
  flex: 1;
  min-height: 0 !important;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Compact header/controls in fullscreen on small screens */
@media (max-height: 500px) {
  .bg-pmp-dark:fullscreen .border-b,
  .bg-pmp-dark:fullscreen .border-t {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }
}

/* ===================== RESPONSIVE ADJUSTMENTS ===================== */
@media (max-width: 1023px) {
  #canvas-container {
    min-height: 350px !important;
  }

  .playlist-scroll {
    max-height: 360px !important;
  }
}

@media (max-width: 640px) {
  #canvas-container {
    min-height: 250px !important;
  }
}

/* Landscape mobile: shrink min-height so canvas + controls fit */
@media (max-height: 500px) and (orientation: landscape) {
  #canvas-container {
    min-height: 180px !important;
  }
}
