/* LovelyPDF Dock v2 — lovelypdf.in
   macOS-style magnifying launcher for all tools.
   Fixes: clip-path replaces overflow-hidden hack,
   floating tooltip outside clipped region,
   smooth keyboard nav, mobile touch support. */

/* ── Wrapper: fixed bottom, holds tooltip + shell ── */
.lp-dock-wrap {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 16px;
  z-index: 9999;
  pointer-events: none;
}

/* ── Floating tooltip — lives OUTSIDE the clipped track ── */
.lp-dock-tip {
  position: absolute;
  bottom: 0;
  left: 0;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: #1a1a1a;
  background: rgba(255, 255, 255, 0.92);
  border: 0.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 7px;
  padding: 4px 10px;
  pointer-events: none;
  z-index: 10000;
  opacity: 0;
  transform: translateX(-50%) translateY(0);
  transition: opacity 0.12s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.lp-dock-tip.lp-tip-on {
  opacity: 1;
}

[data-theme="dark"] .lp-dock-tip {
  color: #eee;
  background: rgba(36, 36, 42, 0.92);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 0 0.5px rgba(255, 255, 255, 0.06);
}

/* ── Shell: contains arrows + track ── */
.lp-dock-shell {
  position: relative;
  pointer-events: all;
  display: flex;
  align-items: flex-end;
  max-width: min(880px, 93vw);
  width: min(880px, 93vw);
}

/* ── Track: THE FIX — clip-path instead of overflow ──
   inset(-200px 0 -20px 0) means:
   • 200px breathing room above (magnified icons + tooltip)
   • clip flush on left & right (hides scrolled-out items)
   • 20px room below for visual comfort                    */
.lp-dock-track {
  overflow: visible;
  max-width: 100%;
  clip-path: inset(-200px 0px -20px 0px);
}

/* ── Dock rail ── */
.lp-dock {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  padding: 6px 14px;
  background: none;
  border: none;
  white-space: nowrap;
  transition: transform 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

/* Glass backing behind icons */
.lp-dock-bg {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 62px;
  border-radius: 18px;
  background: rgba(245, 245, 245, 0.55);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: none;
  z-index: -1;
  transition: width 0.3s ease;
}
[data-theme="dark"] .lp-dock-bg {
  background: rgba(30, 30, 36, 0.6);
  border-color: rgba(255, 255, 255, 0.08);
}

/* ── Scroll arrows ── */
.lp-dock-arrow {
  position: absolute;
  bottom: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  background: rgba(100, 100, 100, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  transition: opacity 0.2s, background 0.15s, transform 0.15s;
  user-select: none;
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  pointer-events: all;
  line-height: 1;
}
.lp-dock-arrow:hover {
  background: rgba(100, 100, 100, 0.45);
  transform: scale(1.08);
}
.lp-dock-arrow:active {
  transform: scale(0.95);
}
.lp-dock-arrow.lp-hide {
  opacity: 0;
  pointer-events: none;
}
.lp-al { left: -34px; }
.lp-ar { right: -34px; }

/* ── Dock item (each tool) ── */
.lp-di {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transform-origin: bottom center;
  transition: transform 0.09s ease-out, opacity 0.15s ease;
  position: relative;
  text-decoration: none;
  flex-shrink: 0;
  outline: none;
  vertical-align: bottom;
  -webkit-tap-highlight-color: transparent;
}
.lp-di:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.6);
  outline-offset: 4px;
  border-radius: 8px;
}

/* ── Icon square ── */
.lp-di-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.09s ease-out, height 0.09s ease-out, border-radius 0.09s ease-out, box-shadow 0.15s ease;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.1);
}
.lp-di:hover .lp-di-icon,
.lp-di.lp-focused .lp-di-icon {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22), 0 2px 4px rgba(0, 0, 0, 0.12);
}

/* Drag-over glow */
.lp-di-icon.lp-glow {
  box-shadow: 0 0 0 2.5px rgba(55, 138, 221, 0.85), 0 4px 18px rgba(55, 138, 221, 0.4);
}

/* ── Separator ── */
.lp-dock-sep {
  width: 1px;
  height: 28px;
  background: rgba(128, 128, 128, 0.25);
  align-self: center;
  flex-shrink: 0;
  margin: 0 4px;
  display: inline-block;
  vertical-align: bottom;
  border-radius: 1px;
}

/* ── Page content clearance ── */
body { padding-bottom: 96px !important; }

/* ── Mobile: smaller base, no magnify ── */
@media (max-width: 600px) {
  .lp-dock-wrap { padding-bottom: 10px; }
  .lp-dock-shell { max-width: 98vw; width: 98vw; }
  .lp-dock { gap: 6px; padding: 5px 8px; }
  .lp-dock-bg { height: 54px; border-radius: 14px; }
  .lp-al { left: -2px; }
  .lp-ar { right: -2px; }
  body { padding-bottom: 80px !important; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .lp-dock,
  .lp-di,
  .lp-di-icon,
  .lp-dock-tip,
  .lp-dock-arrow {
    transition: none !important;
  }
}
