/* === UNLIMITPDF UX PHASE 2: MEGA-MENU, FLOATING BAR, UNDO & CHAINED FLOW === */

/* 1. Botón y Panel del Mega-Menú Superior */
.ux-mega-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(37, 99, 235, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.ux-mega-trigger:hover,
.ux-mega-trigger.active {
  background: #2563eb;
  border-color: #3b82f6;
  color: #ffffff !important;
}
body.light-mode .ux-mega-trigger {
  background: #eff6ff !important;
  border-color: #93c5fd !important;
  color: #1d4ed8 !important;
}
body.light-mode .ux-mega-trigger:hover,
body.light-mode .ux-mega-trigger.active {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
}

#uxMegaMenuPanel {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: min(96vw, 980px);
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  z-index: 98;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid #334155;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.65);
  padding: 16px;
  display: none;
  backdrop-filter: blur(12px);
}
#uxMegaMenuPanel.open { display: block; }
body.light-mode #uxMegaMenuPanel {
  background: rgba(255, 255, 255, 0.99) !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.16) !important;
}

.ux-mega-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 14px;
}
@media (min-width: 640px) {
  .ux-mega-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .ux-mega-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.ux-mega-col-title {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #60a5fa;
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.7);
}
body.light-mode .ux-mega-col-title {
  color: #1d4ed8 !important;
  border-color: #e2e8f0 !important;
}
.ux-mega-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
  text-decoration: none;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.ux-mega-item:hover {
  background: rgba(37, 99, 235, 0.2);
  color: #ffffff;
}
body.light-mode .ux-mega-item {
  color: #1e293b !important;
}
body.light-mode .ux-mega-item:hover {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
}

/* 2. Barra Flotante Contextual sobre el texto editado en el PDF */
#uxFloatTextToolbar {
  position: fixed;
  z-index: 88;
  display: none;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid #3b82f6;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}
#uxFloatTextToolbar.visible { display: inline-flex; }
body.light-mode #uxFloatTextToolbar {
  background: #ffffff !important;
  border-color: #2563eb !important;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18) !important;
}
.ux-ft-btn {
  padding: 3px 7px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 800;
  background: #1e293b;
  border: 1px solid #334155;
  color: #f8fafc;
  cursor: pointer;
  line-height: 1.2;
}
.ux-ft-btn:hover,
.ux-ft-btn.active {
  background: #2563eb;
  border-color: #3b82f6;
  color: #ffffff !important;
}
body.light-mode .ux-ft-btn {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}
body.light-mode .ux-ft-btn:hover,
body.light-mode .ux-ft-btn.active {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
}
.ux-ft-sep {
  width: 1px;
  height: 16px;
  background: #334155;
  margin: 0 2px;
}
body.light-mode .ux-ft-sep { background: #cbd5e1; }
.ux-ft-color {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  color: #cbd5e1;
  cursor: pointer;
}
body.light-mode .ux-ft-color { color: #334155 !important; }
.ux-ft-color input[type="color"] {
  width: 18px;
  height: 18px;
  border: 0;
  padding: 0;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
}

/* 3. Botón Deshacer en barra del visor PDF + Cápsula viva de privacidad RAM */
#uxUndoBtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  cursor: pointer;
  transition: all 0.15s;
  margin-left: 4px;
}
#uxUndoBtn:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.28);
  color: #ffffff;
}
#uxUndoBtn:disabled {
  opacity: 0.42;
  cursor: default;
}
body.light-mode #uxUndoBtn {
  background: #fffbeb !important;
  border-color: #fcd34d !important;
  color: #b45309 !important;
}

#uxRamShieldBadge {
  position: fixed;
  bottom: 14px;
  left: 14px;
  z-index: 45;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(6, 78, 59, 0.9);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #a7f3d0;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
body.light-mode #uxRamShieldBadge {
  background: #ecfdf5 !important;
  border-color: #6ee7b7 !important;
  color: #047857 !important;
}
@media (max-width: 768px) {
  #uxRamShieldBadge { display: none !important; }
}

/* 4. Tira Guía Paso a Paso (① → ② → ③) en Estudio de Imagen / Escáner */
#uxScannerStepBar {
  margin: 6px 12px 2px;
  padding: 7px 12px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #dbeafe;
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
body.light-mode #uxScannerStepBar {
  background: #eff6ff !important;
  border-color: #93c5fd !important;
  color: #1e3a8a !important;
}

/* 5. Tarjeta de Flujo Encadenado Post-Descarga (estilo Smallpdf) */
#uxPostDownloadCard {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: min(92vw, 390px);
  z-index: 96;
  border-radius: 18px;
  background: #0f172a;
  border: 1.5px solid #10b981;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
  padding: 15px 16px;
  display: none;
}
#uxPostDownloadCard.open { display: block; }
body.light-mode #uxPostDownloadCard {
  background: #ffffff !important;
  border-color: #10b981 !important;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18) !important;
}
.ux-chain-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}
.ux-chain-btn {
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 700;
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
  cursor: pointer;
  text-align: left;
  transition: all 0.14s;
}
.ux-chain-btn:hover {
  border-color: #3b82f6;
  background: rgba(37, 99, 235, 0.22);
}
body.light-mode .ux-chain-btn {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}
body.light-mode .ux-chain-btn:hover {
  background: #eff6ff !important;
  border-color: #2563eb !important;
}
