/**
 * DESIGN REYES - CSS Anti-Copia
 * Estilos de protección global + Toast Premium
 */

/* ═══════════════════════════════════════════════════════════════
   TOAST PREMIUM DE PROTECCIÓN
   ═══════════════════════════════════════════════════════════════ */
#dr-protection-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

#dr-protection-toast.dr-toast-show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

#dr-protection-toast.dr-toast-hide {
  transform: translateX(-50%) translateY(100px);
  opacity: 0;
  visibility: hidden;
}

.dr-toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: linear-gradient(135deg, rgba(26, 11, 43, 0.95), rgba(15, 5, 30, 0.98));
  border: 1px solid rgba(124, 58, 237, 0.4);
  border-radius: 14px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(124, 58, 237, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.dr-toast-icon {
  width: 22px;
  height: 22px;
  color: #a78bfa;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(167, 139, 250, 0.5));
}

.dr-toast-text {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: #f5f3ff;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ═══════════════════════════════════════════════════════════════
   BLOQUEAR SELECCIÓN DE TEXTO (solo usuarios normales)
   ═══════════════════════════════════════════════════════════════ */
body:not(.dr-admin),
body:not(.dr-admin) * {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Admins pueden seleccionar todo */
body.dr-admin,
body.dr-admin * {
  -webkit-user-select: auto;
  -moz-user-select: auto;
  -ms-user-select: auto;
  user-select: auto;
  -webkit-touch-callout: default;
}

/* Permitir selección en inputs y textareas SIEMPRE */
input,
textarea,
select,
[contenteditable="true"] {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
  -webkit-touch-callout: default !important;
}

/* ═══════════════════════════════════════════════════════════════
   PROTECCIÓN DE IMÁGENES (solo usuarios normales)
   ═══════════════════════════════════════════════════════════════ */
body:not(.dr-admin) img {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  pointer-events: auto;
  -webkit-touch-callout: none;
}

/* Admins pueden arrastrar imágenes */
body.dr-admin img {
  -webkit-user-drag: auto;
  -webkit-touch-callout: default;
}

/* ═══════════════════════════════════════════════════════════════
   BLOQUEAR ARRASTRE (solo usuarios normales)
   ═══════════════════════════════════════════════════════════════ */
body:not(.dr-admin) img,
body:not(.dr-admin) a {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
}

/* ═══════════════════════════════════════════════════════════════
   OCULTAR EN IMPRESIÓN
   ═══════════════════════════════════════════════════════════════ */
@media print {
  body {
    display: none !important;
  }
  
  html::after {
    content: "Este contenido está protegido y no puede ser impreso.";
    display: block;
    padding: 50px;
    text-align: center;
    font-size: 24px;
    color: #7c3aed;
  }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE TOAST
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  #dr-protection-toast {
    bottom: 20px;
    left: 16px;
    right: 16px;
    transform: translateX(0) translateY(100px);
  }
  
  #dr-protection-toast.dr-toast-show {
    transform: translateX(0) translateY(0);
  }
  
  #dr-protection-toast.dr-toast-hide {
    transform: translateX(0) translateY(100px);
  }
  
  .dr-toast-content {
    padding: 12px 16px;
    justify-content: center;
  }
  
  .dr-toast-text {
    font-size: 0.82rem;
    white-space: normal;
    text-align: center;
  }
}

/* ═══════════════════════════════════════════════════════════════
   SISTEMA ANTIPLAGIO BASADO EN ROLES
   ═══════════════════════════════════════════════════════════════ */

/* Modal de protección - Diseño elegante cyberpunk */
.swal2-popup.protection-modal {
  background: linear-gradient(
    135deg,
    rgba(15, 5, 30, 0.99) 0%,
    rgba(25, 10, 45, 0.98) 50%,
    rgba(15, 5, 30, 0.99) 100%
  ) !important;
  backdrop-filter: blur(25px) !important;
  -webkit-backdrop-filter: blur(25px) !important;
  border: 2px solid rgba(139, 92, 246, 0.35) !important;
  border-radius: 24px !important;
  box-shadow: 
    0 25px 80px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(168, 85, 247, 0.15) inset,
    0 0 50px rgba(124, 58, 237, 0.35),
    0 0 80px rgba(168, 85, 247, 0.15) !important;
  padding: 2.5rem !important;
  width: 460px !important;
  position: relative !important;
  overflow: hidden !important;
  animation: modalBreathe 4s ease-in-out infinite !important;
}

@keyframes modalBreathe {
  0%, 100% {
    box-shadow: 
      0 25px 80px rgba(0, 0, 0, 0.7),
      0 0 0 1px rgba(168, 85, 247, 0.15) inset,
      0 0 50px rgba(124, 58, 237, 0.35),
      0 0 80px rgba(168, 85, 247, 0.15);
  }
  50% {
    box-shadow: 
      0 25px 80px rgba(0, 0, 0, 0.7),
      0 0 0 1px rgba(168, 85, 247, 0.15) inset,
      0 0 60px rgba(124, 58, 237, 0.45),
      0 0 100px rgba(168, 85, 247, 0.25);
  }
}

/* Efecto glow animado en el borde */
.swal2-popup.protection-modal::before {
  content: '' !important;
  position: absolute !important;
  inset: -2px !important;
  border-radius: 20px !important;
  padding: 2px !important;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(168, 85, 247, 0.4),
    transparent,
    rgba(192, 132, 252, 0.4),
    transparent
  ) !important;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0) !important;
  -webkit-mask-composite: xor !important;
  mask-composite: exclude !important;
  animation: borderGlow 3s linear infinite !important;
  pointer-events: none !important;
  z-index: -1 !important;
}

@keyframes borderGlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Icono del modal */
.swal2-popup.protection-modal .swal2-icon {
  border: none !important;
  width: 80px !important;
  height: 80px !important;
  margin: 0 auto 1.8rem !important;
  animation: iconFloat 3s ease-in-out infinite !important;
}

@keyframes iconFloat {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* Icono de error - estilo neon rojo */
.swal2-popup.protection-modal .swal2-icon.swal2-error {
  color: #ff3b3b !important;
  border: 2px solid rgba(255, 59, 59, 0.4) !important;
  background: radial-gradient(circle at 30% 30%, rgba(255, 59, 59, 0.15) 0%, transparent 60%) !important;
  box-shadow: 
    0 0 40px rgba(255, 59, 59, 0.4),
    0 0 80px rgba(255, 59, 59, 0.2),
    inset 0 0 20px rgba(255, 59, 59, 0.1) !important;
  border-radius: 50% !important;
}

.swal2-popup.protection-modal .swal2-icon.swal2-error [class^='swal2-x-mark-line'] {
  background-color: #ff3b3b !important;
  box-shadow: 0 0 15px rgba(255, 59, 59, 0.6) !important;
}

/* Icono de warning - estilo neon amarillo */
.swal2-popup.protection-modal .swal2-icon.swal2-warning {
  color: #fbbf24 !important;
  border: 2px solid rgba(251, 191, 36, 0.4) !important;
  background: radial-gradient(circle at 30% 30%, rgba(251, 191, 36, 0.15) 0%, transparent 60%) !important;
  box-shadow: 
    0 0 40px rgba(251, 191, 36, 0.4),
    0 0 80px rgba(251, 191, 36, 0.2),
    inset 0 0 20px rgba(251, 191, 36, 0.1) !important;
  border-radius: 50% !important;
}

.swal2-popup.protection-modal .swal2-icon.swal2-warning .swal2-icon-content {
  color: #fbbf24 !important;
  text-shadow: 0 0 15px rgba(251, 191, 36, 0.6) !important;
  font-weight: bold !important;
}

/* Icono de success - estilo neon verde */
.swal2-popup.protection-modal .swal2-icon.swal2-success {
  border: 2px solid rgba(34, 197, 94, 0.3) !important;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.1) 0%, transparent 70%) !important;
  box-shadow: 
    0 0 30px rgba(34, 197, 94, 0.3),
    0 0 60px rgba(34, 197, 94, 0.2) !important;
}

.swal2-popup.protection-modal .swal2-icon.swal2-success [class^='swal2-success-line'] {
  background-color: #22c55e !important;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5) !important;
}

.swal2-popup.protection-modal .swal2-icon.swal2-success .swal2-success-ring {
  border-color: rgba(34, 197, 94, 0.3) !important;
}

/* Título del modal */
.swal2-popup.protection-modal .swal2-title {
  color: #ffffff !important;
  font-size: 1.6rem !important;
  font-weight: 800 !important;
  margin: 0 0 0.8rem 0 !important;
  text-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(168, 85, 247, 0.3) !important;
  line-height: 1.2 !important;
  letter-spacing: -0.5px !important;
}

/* Contenido del modal */
.swal2-popup.protection-modal .swal2-html-container {
  color: #d9d6f0 !important;
  font-size: 1rem !important;
  line-height: 1.7 !important;
  margin: 0 0 2rem 0 !important;
  opacity: 0.95 !important;
  font-weight: 500 !important;
}

/* Botón del modal */
.swal2-popup.protection-modal .swal2-confirm {
  background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 50%, #7c3aed 100%) !important;
  background-size: 200% 200% !important;
  border: 2px solid rgba(168, 85, 247, 0.5) !important;
  border-radius: 14px !important;
  padding: 1rem 3rem !important;
  font-weight: 700 !important;
  font-size: 1rem !important;
  color: #fff !important;
  box-shadow: 
    0 8px 25px rgba(124, 58, 237, 0.5),
    0 0 40px rgba(124, 58, 237, 0.25),
    0 4px 10px rgba(0, 0, 0, 0.4) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  cursor: pointer !important;
  position: relative !important;
  overflow: hidden !important;
  will-change: transform, box-shadow !important;
}

/* Efecto hover del botón */
.swal2-popup.protection-modal .swal2-confirm:hover {
  transform: translateY(-4px) scale(1.05) !important;
  box-shadow: 
    0 12px 40px rgba(124, 58, 237, 0.7),
    0 0 60px rgba(124, 58, 237, 0.5),
    0 6px 16px rgba(0, 0, 0, 0.5) !important;
  border-color: rgba(168, 85, 247, 0.8) !important;
  background-position: 100% 100% !important;
}

.swal2-popup.protection-modal .swal2-confirm:active {
  transform: translateY(0) !important;
}

/* Efecto de onda en el botón */
.swal2-popup.protection-modal .swal2-confirm::before {
  content: '' !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  width: 0 !important;
  height: 0 !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.3) !important;
  transform: translate(-50%, -50%) !important;
  transition: width 0.6s, height 0.6s !important;
}

.swal2-popup.protection-modal .swal2-confirm:hover::before {
  width: 300px !important;
  height: 300px !important;
}

/* Overlay del modal */
.swal2-container.swal2-backdrop-show {
  background: rgba(6, 0, 13, 0.85) !important;
  backdrop-filter: blur(10px) !important;
}

/* Animación de entrada */
.swal2-popup.protection-modal.swal2-show {
  animation: protectionModalIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes protectionModalIn {
  0% {
    opacity: 0;
    transform: scale(0.5) rotateY(90deg) translateY(-40px);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotateY(0deg) translateY(0);
  }
}

/* Variantes por tipo de alerta */
.swal2-popup.protection-modal.alert-user .swal2-icon.swal2-error {
  animation: pulseRed 2s infinite !important;
}

.swal2-popup.protection-modal.alert-admin .swal2-icon.swal2-warning {
  animation: pulseYellow 2s infinite !important;
}

@keyframes pulseRed {
  0%, 100% {
    box-shadow: 
      0 0 40px rgba(255, 59, 59, 0.4),
      0 0 80px rgba(255, 59, 59, 0.2);
  }
  50% {
    box-shadow: 
      0 0 60px rgba(255, 59, 59, 0.6),
      0 0 120px rgba(255, 59, 59, 0.4);
  }
}

@keyframes pulseYellow {
  0%, 100% {
    box-shadow: 
      0 0 40px rgba(251, 191, 36, 0.4),
      0 0 80px rgba(251, 191, 36, 0.2);
  }
  50% {
    box-shadow: 
      0 0 60px rgba(251, 191, 36, 0.6),
      0 0 120px rgba(251, 191, 36, 0.4);
  }
}

/* Protección de imágenes - overlay transparente */
.dr-product-image-frame::after,
.design-card-img-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  z-index: 999;
  pointer-events: auto;
}

/* Modo super admin - sin protecciones */
body.super-admin-mode .dr-product-image-frame::after,
body.super-admin-mode .design-card-img-wrapper::after {
  display: none !important;
}

body.super-admin-mode * {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
  pointer-events: auto !important;
}

/* Protección de impresión */
@media print {
  .dr-product-image-frame img,
  .design-card-img-wrapper img,
  .catalog-card img,
  .product-image img {
    visibility: hidden !important;
  }
  
  .dr-product-image-frame::before {
    content: '🔒 Contenido Protegido - Design Reyes' !important;
    position: absolute !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f5f3ff !important;
    color: #7c3aed !important;
    font-size: 1.2rem !important;
    font-weight: bold !important;
    visibility: visible !important;
  }
}
