/* ═══════════════════════════════════════════════════
   WritexNova — Premium Floating Tools Sidebar
═══════════════════════════════════════════════════ */

.wx-tools-sidebar {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 6px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(99,102,241,0.12);
  border-left: none;
  border-radius: 0 16px 16px 0;
  box-shadow: 4px 0 32px rgba(99,102,241,0.12), 0 8px 32px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
}

[data-theme="dark"] .wx-tools-sidebar {
  background: rgba(18,18,30,0.92);
  border-color: rgba(99,102,241,0.2);
  box-shadow: 4px 0 32px rgba(99,102,241,0.15), 0 8px 32px rgba(0,0,0,0.3);
}

.wx-tool-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(.34,1.56,.64,1);
  color: #64748b;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.wx-tool-btn svg {
  width: 22px;
  height: 22px;
  transition: all 0.2s ease;
}

.wx-tool-btn:hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.1));
  border-color: rgba(99,102,241,0.25);
  transform: scale(1.12) translateX(3px);
  color: #6366f1;
}

.wx-tool-btn:hover svg {
  filter: drop-shadow(0 0 4px rgba(99,102,241,0.5));
}

.wx-tool-btn.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
}

.wx-tool-btn.active svg {
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.6));
}

/* Tooltip */
.wx-tool-btn::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: #1e1b4b;
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  transform: translateY(-50%) translateX(-4px);
  letter-spacing: .01em;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.wx-tool-btn::before {
  content: '';
  position: absolute;
  left: calc(100% + 7px);
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: #1e1b4b;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.wx-tool-btn:hover::after,
.wx-tool-btn:hover::before {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Divider */
.wx-sidebar-divider {
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.2), transparent);
  margin: 2px auto;
}

/* Mobile — hide sidebar on very small screens */
/* sidebar hidden on mobile — handled by bottom media query */

/* Entrance animation */
@keyframes wx-sidebar-in {
  from { opacity: 0; transform: translateY(-50%) translateX(-20px); }
  to   { opacity: 1; transform: translateY(-50%) translateX(0); }
}

.wx-tools-sidebar {
  animation: wx-sidebar-in 0.4s cubic-bezier(.34,1.56,.64,1) both;
}

/* ═══════════════════════════════════════════════════
   Mobile Bottom Tools Bar
═══════════════════════════════════════════════════ */

.wx-mobile-tools-btn {
  display: flex;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99,102,241,0.45);
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(.34,1.56,.64,1), box-shadow 0.2s ease;
  color: #fff;
}

.wx-mobile-tools-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(99,102,241,0.55);
}

.wx-mobile-tools-btn svg {
  width: 24px;
  height: 24px;
  transition: transform 0.3s ease;
}

.wx-mobile-tools-btn.open svg {
  transform: rotate(45deg);
}

/* Backdrop */
.wx-mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 998;
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  display: none;
}

.wx-mobile-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Slide-up drawer */
.wx-mobile-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: var(--bg-card, #fff);
  border-radius: 20px 20px 0 0;
  padding: 12px 16px 32px;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.15);
  transform: translateY(100%);
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(.34,1.26,.64,1);
  display: none;
}

[data-theme="dark"] .wx-mobile-drawer {
  background: #1a1a2e;
}

.wx-mobile-drawer.open {
  transform: translateY(0);
  pointer-events: auto;
}

.wx-drawer-handle {
  width: 36px;
  height: 4px;
  background: rgba(99,102,241,0.25);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.wx-drawer-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 12px;
  padding-left: 4px;
}

.wx-drawer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.wx-drawer-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: 14px;
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: all 0.2s ease;
  background: var(--bg-2, #f8fafc);
  cursor: pointer;
}

[data-theme="dark"] .wx-drawer-item {
  background: rgba(255,255,255,0.05);
}

.wx-drawer-item:active {
  transform: scale(0.95);
}

.wx-drawer-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(139,92,246,0.12));
  border-color: rgba(99,102,241,0.3);
}

.wx-drawer-item svg {
  width: 24px;
  height: 24px;
  color: #6366f1;
}

.wx-drawer-item.active svg {
  filter: drop-shadow(0 0 4px rgba(99,102,241,0.5));
}

.wx-drawer-item span {
  font-size: .65rem;
  font-weight: 600;
  color: var(--text, #1e293b);
  text-align: center;
  line-height: 1.2;
}

[data-theme="dark"] .wx-drawer-item span {
  color: #e2e8f0;
}

.wx-drawer-item.active span {
  color: #6366f1;
}

@media (max-width: 767px) {
  .wx-tools-sidebar { display: none !important; }
  .wx-mobile-tools-btn { display: flex; }
  .wx-mobile-backdrop { display: block; pointer-events: none; }
  .wx-mobile-drawer { display: block; pointer-events: none; }
}

@media (min-width: 768px) {
  .wx-mobile-tools-btn { display: none !important; }
  .wx-mobile-backdrop { display: none !important; }
  .wx-mobile-drawer { display: none !important; }
}
/* ═══════════════════════════════════════════════════
   iPad / Tablet Fix (768px - 1024px)
   Sidebar stays, body gets left padding to avoid overlap
═══════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1024px) {
  .wx-tools-sidebar {
    padding: 6px 4px;
    gap: 2px;
  }

  .wx-tool-btn {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }

  .wx-tool-btn svg {
    width: 17px;
    height: 17px;
  }

  /* Push content right so sidebar doesn't overlap */
  body {
    padding-left: 46px;
  }

  /* Hide tooltip on tablet (no hover on touch) */
  .wx-tool-btn::after,
  .wx-tool-btn::before {
    display: none;
  }
}