/* ═══════════════════════════════════════════════════════
   TEP Advanced Clipper CSS v1.0.4
   v1.0.4: CRITICAL FIX — removed pointer-events:none!important from
   #tep-clip-overlay rule. The fullpage viewer CSS was overriding the
   JS-set pointer-events:auto, making drag/drop completely non-functional.
   pointer-events toggling is now done exclusively via JS using setAttribute
   with !important so it always wins over any cascade rule.
═══════════════════════════════════════════════════════ */

/* ── OVERLAY ── */
/* v1.0.4: pointer-events NOT set here — controlled exclusively via JS setAttribute.
   Default hidden state is set via JS as well. Initial CSS just provides base positioning. */
.tep-clip-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  cursor: crosshair;
  z-index: 600;
  background: rgba(26,26,46,.08);
  transition: background .2s;
  display: none;
}
.tep-clipping-mode .tep-clip-overlay {
  background: rgba(26,26,46,.18);
}
.tep-clipping-mode .tep-page-img {
  pointer-events: none;
  user-select: none;
}

/* ── SELECTION BOX ── */
.tep-clip-selection {
  position: absolute;
  border: 2px dashed #e94560;
  background: rgba(233,69,96,.07);
  /* pointer-events:none so overlay receives all events for new draws */
  pointer-events: none;
  z-index: 601;
  min-width: 20px;
  min-height: 20px;
  cursor: default;
  overflow: visible;
  box-shadow: 0 0 0 1px rgba(233,69,96,.3), inset 0 0 0 1px rgba(233,69,96,.15);
}
.tep-clip-selection.tep-clip-has-selection {
  border: 2px solid #e94560;
  cursor: crosshair;
}
/* Handles always receive pointer events when visible */
.tep-clip-size-label {
  position: absolute;
  top: -26px;
  left: 0;
  font-size: 10px;
  font-weight: 700;
  background: #e94560;
  color: #fff;
  padding: 3px 10px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  font-family: monospace;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

/* ── RESIZE HANDLES — 8 directional ── */
.tep-clip-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #e94560;
  border: 2px solid #fff;
  border-radius: 3px;
  pointer-events: all;
  z-index: 650;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  transition: transform .1s;
  touch-action: none;
}
.tep-clip-handle:hover { transform: scale(1.25); background: #c9203d; }
/* Corners */
.tep-handle-nw { top: -7px;  left: -7px;               cursor: nw-resize; }
.tep-handle-ne { top: -7px;  right: -7px;               cursor: ne-resize; }
.tep-handle-se { bottom: -7px; right: -7px;              cursor: se-resize; }
.tep-handle-sw { bottom: -7px; left: -7px;               cursor: sw-resize; }
/* Edges */
.tep-handle-n  { top: -7px;  left: calc(50% - 7px);     cursor: n-resize; border-radius: 3px; }
.tep-handle-e  { top: calc(50% - 7px); right: -7px;      cursor: e-resize; border-radius: 3px; }
.tep-handle-s  { bottom: -7px; left: calc(50% - 7px);   cursor: s-resize; border-radius: 3px; }
.tep-handle-w  { top: calc(50% - 7px); left: -7px;       cursor: w-resize; border-radius: 3px; }
/* Corner handles slightly bigger */
.tep-handle-nw, .tep-handle-ne, .tep-handle-se, .tep-handle-sw { width: 16px; height: 16px; top: -8px; }
.tep-handle-ne, .tep-handle-se { right: -8px; left: auto; }
.tep-handle-se, .tep-handle-sw { bottom: -8px !important; top: auto !important; }
.tep-handle-sw, .tep-handle-nw { left: -8px !important; right: auto !important; }

/* ── PANEL ── */
.tep-clip-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 950;
  background: #fff;
  border-top: 3px solid #e94560;
  padding: 10px 16px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.15);
  animation: tep-slide-up .2s ease;
}
@keyframes tep-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.tep-clip-panel-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 1200px;
  margin: 0 auto;
}
.tep-clip-size-badge {
  background: #1a1a2e;
  color: #fff;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 700;
  white-space: nowrap;
  font-family: monospace;
}
.tep-clip-title-inp {
  flex: 1;
  min-width: 180px;
  padding: 8px 12px;
  border: 1.5px solid #dde1e7;
  border-radius: 7px;
  font-size: 13px;
  outline: none;
}
.tep-clip-title-inp:focus { border-color: #e94560; }
.tep-clip-expiry-sel {
  padding: 7px 10px;
  border: 1.5px solid #dde1e7;
  border-radius: 7px;
  font-size: 12px;
  background: #fff;
}

/* ── SHARE MODAL ── */
.tep-clip-share-wrap { display: flex; gap: 16px; flex-wrap: wrap; }
.tep-clip-preview-img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #eee;
  background: #f7f8fc;
}
.tep-clip-share-info { flex: 1; min-width: 200px; }
.tep-clip-share-title { font-size: 15px; font-weight: 700; margin: 0 0 8px; color: #1a1a2e; }
.tep-clip-expiry-note { font-size: 11px; color: #e94560; margin: 0 0 12px; font-weight: 600; }
.tep-clip-share-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tep-clip-url-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.tep-clip-url-inp {
  flex: 1;
  padding: 7px 10px;
  border: 1.5px solid #dde1e7;
  border-radius: 7px;
  font-size: 12px;
  background: #f7f8fc;
}

/* ── AD ZONES (public) ── */
.tep-ad-zone { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin: 6px 0; }
.tep-ad-zone:empty { display: none; }
.tep-user-ad { position: relative; display: inline-block; vertical-align: top; }
.tep-user-ad .tep-ad-label {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 8px;
  background: rgba(0,0,0,.35);
  color: #fff;
  padding: 1px 5px;
  border-radius: 0 4px 0 4px;
  pointer-events: none;
}
.tep-ad-type-native { max-width: 400px; width: 100%; }
.tep-ad-type-classified { max-width: 500px; width: 100%; }
.tep-ad-type-video video { border-radius: 6px; }

/* ── POPUP / INTERSTITIAL ADS ── */
#tep-popup-entry,
#tep-exit-intent {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 99999;
  align-items: center;
  justify-content: center;
}
#tep-anchor-ad {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  background: #fff;
  border-top: 1px solid #eee;
  text-align: center;
  padding: 3px 0;
  box-shadow: 0 -2px 8px rgba(0,0,0,.1);
}
#tep-floating-sidebar {
  position: fixed;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 500;
}

/* ── MOBILE ── */
@media (max-width: 768px) {
  .tep-clip-panel-inner { flex-direction: column; align-items: stretch; }
  .tep-clip-title-inp { width: 100%; }
  .tep-clip-share-wrap { flex-direction: column; }
  .tep-handle-n, .tep-handle-e, .tep-handle-w, .tep-handle-s { display: none; }
  .tep-handle-nw, .tep-handle-ne, .tep-handle-se, .tep-handle-sw { display: flex; width: 20px; height: 20px; }
}

/* ── BRAND PREVIEW IN PANEL ── */
.tep-clip-brand-preview {
  display: block;
  line-height: 1;
  border: 1.5px solid rgba(255,255,255,.12);
  cursor: default;
  user-select: none;
}
.tep-clip-brand-preview * { line-height: normal; }
.tep-clip-panel-inner { flex-direction: column; align-items: stretch; }
@media (min-width: 769px) {
  .tep-clip-panel-inner { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .tep-clip-brand-preview { max-width: 260px; margin-bottom: 0 !important; margin-right: 8px; }
}

@media print {
  .tep-clip-overlay, .tep-clip-panel, #tep-clip-modal,
  #tep-popup-entry, #tep-exit-intent, #tep-anchor-ad,
  #tep-floating-sidebar { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════════
   Clip toolbar button balance fix
   Make Create Clip and Crop & Download equal width.
═══════════════════════════════════════════════════════════════ */
#tep-clip-create-btn,
#tep-clip-dl-btn {
  min-width: 128px !important;
  flex-shrink: 0 !important;
  text-align: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
}
/* Clip action bar: keep buttons aligned */
.tep-clip-action-bar,
#tep-clip-toolbar {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  align-items: center !important;
  overflow: hidden !important;
}
