/* Tunnelium Post Widget (frontend)
 * Icons: bundled inline SVGs (Feather/Lucide style)
 */

/* Kill the blue hover/tap highlight across browsers/themes */
.tunpw-widget,
.tunpw-widget *{
  -webkit-tap-highlight-color: transparent !important;
}

.tunpw-widget a,
.tunpw-widget button,
.tunpw-widget [role="button"]{
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

.tunpw-widget a:hover,
.tunpw-widget a:focus,
.tunpw-widget a:active,
.tunpw-widget button:hover,
.tunpw-widget button:focus,
.tunpw-widget button:active{
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

.tunpw-widget{
  position: fixed;
  right: var(--tunpw-right, 24px);
  top: var(--tunpw-top, 50%);
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  z-index: 99999;
  user-select: none;
}

.tunpw-item{
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none !important;
  color: #000;
}

.tunpw-btn{
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
}

.tunpw-btn::-moz-focus-inner{
  border: 0;
  padding: 0;
}

.tunpw-count{
  margin-top: 6px;
  font-family: IRANSansXFaNum, IRANSans, sans-serif;
  font-weight: 400;
  font-size: 10px;
  line-height: 15px;
  color: #666666;
  text-align: center;
}

/* Icon swapping (outline -> filled)
 * IMPORTANT: only swap the *main* icon inside each item button.
 * Do NOT affect icons inside the Share panel.
 */
.tunpw-icon{
  position: relative;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.tunpw-ico--regular,
.tunpw-ico--solid{
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tunpw-icon svg{
  width: 22px;
  height: 22px;
  display: block;
}

.tunpw-ico--solid{
  opacity: 0;
  transform: scale(0.98);
  transition: opacity .12s ease, transform .12s ease;
}

.tunpw-ico--regular{
  opacity: 1;
  transition: opacity .12s ease;
}

.tunpw-item:hover > .tunpw-btn .tunpw-ico--solid,
.tunpw-item:focus-within > .tunpw-btn .tunpw-ico--solid,
.tunpw-item.is-active > .tunpw-btn .tunpw-ico--solid,
.tunpw-share.is-open > .tunpw-btn .tunpw-ico--solid{
  opacity: 1;
  transform: scale(1);
}

.tunpw-item:hover > .tunpw-btn .tunpw-ico--regular,
.tunpw-item:focus-within > .tunpw-btn .tunpw-ico--regular,
.tunpw-item.is-active > .tunpw-btn .tunpw-ico--regular,
.tunpw-share.is-open > .tunpw-btn .tunpw-ico--regular{
  opacity: 0;
}

/* Loading state (like/bookmark) */
.tunpw-item.is-loading .tunpw-btn{
  cursor: progress;
  pointer-events: none;
}

.tunpw-spinner{
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.25);
  border-top-color: rgba(0,0,0,1);
  animation: tunpw-spin .7s linear infinite;
  opacity: 0;
  left: 50%;
  top: 50%;
  margin-left: -9px;
  margin-top: -9px;
  z-index: 3;
}

/* Rounded halo behind the spinner while saving */
.tunpw-item.is-loading .tunpw-btn::after{
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.92);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  z-index: 2;
}

.tunpw-item.is-loading .tunpw-spinner{
  opacity: 1;
}

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

/* Share */
.tunpw-share{
  position: relative;
}

.tunpw-share-panel{
  position: absolute;
  right: calc(100% + 8px);
  top: 4px;
  width: 225px;
  height: 32px;
  padding: 0 8px;
  background: #FFFFFF;
  box-shadow: 4px 0px 4px rgba(0,0,0,0.1), 0px 4px 4px rgba(0,0,0,0.1);
  border-radius: 5px;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateX(6px);
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}

/* bridge the hover gap so moving from icon -> panel doesn't close it */
.tunpw-share-panel::before{
  content: "";
  position: absolute;
  right: -10px;
  top: 0;
  width: 10px;
  height: 100%;
  background: transparent;
}

.tunpw-share:hover .tunpw-share-panel,
.tunpw-share:focus-within .tunpw-share-panel,
.tunpw-share.is-open .tunpw-share-panel{
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.tunpw-share-panel button,
.tunpw-share-panel a{
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent !important;
  padding: 0;
  color: #1A1A1A;
  cursor: pointer;
  text-decoration: none;
  border-radius: 0;
}

.tunpw-share-panel button:hover,
.tunpw-share-panel a:hover,
.tunpw-share-panel button:focus,
.tunpw-share-panel a:focus,
.tunpw-share-panel button:active,
.tunpw-share-panel a:active{
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
}

.tunpw-share-panel svg{
  width: 14px;
  height: 14px;
  display: block;
}

/* Prevent themes from forcing icon colors (e.g. white) on hover/focus */
.tunpw-share-panel,
.tunpw-share-panel *{
  color: #1A1A1A !important;
}
.tunpw-share-panel svg [stroke]{
  stroke: #1A1A1A !important;
}
.tunpw-share-panel svg [fill]:not([fill="none"]){
  fill: #1A1A1A !important;
}

.tunpw-url{
  flex: 1;
  min-width: 0;
  font-family: IRANSansXFaNum, IRANSans, sans-serif;
  font-weight: 500;
  font-size: 11px;
  line-height: 16px;
  color: #000000;
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: left;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  user-select: text;
  touch-action: pan-x;
  cursor: grab;
  scrollbar-width: none; /* Firefox */
}

.tunpw-url.is-dragging{
  cursor: grabbing;
}

.tunpw-url::-webkit-scrollbar{
  height: 0;
}

/* toast */
.tunpw-toast{
  position: absolute;
  right: calc(100% + 10px);
  top: 42px;
  background: #111;
  color: #fff;
  font-family: IRANSansXFaNum, IRANSans, sans-serif;
  font-size: 11px;
  line-height: 16px;
  padding: 6px 10px;
  border-radius: 6px;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
  white-space: nowrap;
}

.tunpw-toast.is-visible{
  opacity: 1;
  transform: translateY(0);
}
