/* ==========================================================================
   Elementor Sidebar Widget – sidebar-widget.css
   Version: 1.0.0
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (overridden via JS from data attributes)
   -------------------------------------------------------------------------- */
.esw-wrapper {
  --esw-sidebar-width: 420px;
  --esw-transition-speed: 0.35s;
  --esw-transition-easing: cubic-bezier(0.4, 0, 0.2, 1);
  --esw-z-overlay: 99998;
  --esw-z-sidebar: 99999;
  --esw-z-btn: 100000;
}

/* --------------------------------------------------------------------------
   Floating Toggle Button
   -------------------------------------------------------------------------- */
.esw-toggle-btn {
  position: fixed;
  bottom: 30px;
  right: 20px;
  z-index: var(--esw-z-btn);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 14px 18px;

  background-color: #0073aa;
  color: #ffffff;
  border: none;
  border-radius: 50px;
  cursor: pointer;

  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;

  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition:
    transform var(--esw-transition-speed) var(--esw-transition-easing),
    box-shadow var(--esw-transition-speed) var(--esw-transition-easing),
    opacity 0.2s ease;
  will-change: transform;
}

.esw-toggle-btn[data-btn-pos="left"] {
  right: auto;
  left: 20px;
}

.esw-toggle-btn[data-btn-pos="right"] {
  left: auto;
  right: 20px;
}

.esw-toggle-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.esw-toggle-btn:active {
  transform: translateY(0) scale(0.98);
}

.esw-toggle-btn:focus-visible {
  outline: 3px solid rgba(0, 115, 170, 0.5);
  outline-offset: 3px;
}

.esw-toggle-btn i,
.esw-toggle-btn svg {
  display: block;
  font-size: 18px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Overlay
   -------------------------------------------------------------------------- */
.esw-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--esw-z-overlay);

  background-color: rgba(0, 0, 0, 0.5);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition:
    opacity var(--esw-transition-speed) var(--esw-transition-easing),
    visibility var(--esw-transition-speed) var(--esw-transition-easing);
}

.esw-wrapper.esw-open .esw-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Sidebar Panel
   -------------------------------------------------------------------------- */
.esw-sidebar {
  position: fixed;
  top: 0;
  height: 100%;
  width: var(--esw-sidebar-width);
  max-width: 100%;
  z-index: var(--esw-z-sidebar);

  background-color: #ffffff;
  overflow: hidden;
  display: flex;
  flex-direction: column;

  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.15);
  transition: transform var(--esw-transition-speed) var(--esw-transition-easing);
  will-change: transform;
}

/* Slide from Right */
.esw-sidebar--right {
  right: 0;
  left: auto;
  transform: translateX(100%);
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.15);
}

/* Slide from Left */
.esw-sidebar--left {
  left: 0;
  right: auto;
  transform: translateX(-100%);
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.15);
}

/* Open state */
.esw-wrapper.esw-open .esw-sidebar {
  transform: translateX(0);
}

/* Hide toggle button when sidebar is open */
.esw-wrapper.esw-open .esw-toggle-btn {
  opacity: 0;
  transform: scale(0.75);
  pointer-events: none;
  visibility: hidden;
}

/* --------------------------------------------------------------------------
   Close Button
   -------------------------------------------------------------------------- */
.esw-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;

  background-color: transparent;
  color: #333333;
  border: none;
  border-radius: 50%;
  cursor: pointer;

  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.esw-close-btn:hover {
  background-color: rgba(0, 0, 0, 0.08);
  transform: rotate(90deg);
}

.esw-close-btn:focus-visible {
  outline: 3px solid rgba(0, 115, 170, 0.5);
  outline-offset: 2px;
}

.esw-close-btn i,
.esw-close-btn svg {
  display: block;
  font-size: 20px;
  width: 20px;
  height: 20px;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Sidebar Content (scrollable)
   -------------------------------------------------------------------------- */
.esw-sidebar-content {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;

  /* Scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
}

.esw-sidebar-content::-webkit-scrollbar {
  width: 5px;
}

.esw-sidebar-content::-webkit-scrollbar-track {
  background: transparent;
}

.esw-sidebar-content::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.18);
  border-radius: 10px;
}

/* Spacing for close button */
.esw-sidebar:has(.esw-close-btn) .esw-sidebar-content {
  padding-top: 52px;
}

/* No-template placeholder */
.esw-no-template {
  color: #888;
  font-style: italic;
  text-align: center;
  margin-top: 40px;
}

/* --------------------------------------------------------------------------
   Body lock when sidebar is open
   -------------------------------------------------------------------------- */
body.esw-body-lock {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Responsive Visibility Helpers
   -------------------------------------------------------------------------- */

/* Desktop: ≥ 1025px */
@media (min-width: 1025px) {
  .esw-hide-desktop .esw-toggle-btn {
    display: none !important;
  }
}

/* Tablet: 768px – 1024px */
@media (min-width: 768px) and (max-width: 1024px) {
  .esw-hide-tablet .esw-toggle-btn {
    display: none !important;
  }

  .esw-sidebar {
    width: var(--esw-sidebar-width-tablet, var(--esw-sidebar-width));
  }
}

/* Mobile: ≤ 767px */
@media (max-width: 767px) {
  .esw-hide-mobile .esw-toggle-btn {
    display: none !important;
  }

  .esw-sidebar {
    width: var(--esw-sidebar-width-mobile, 100%) !important;
  }
}

/* --------------------------------------------------------------------------
   Elementor editor: ensure sidebar-related elements visible in preview
   -------------------------------------------------------------------------- */
.elementor-editor-active .esw-wrapper .esw-toggle-btn {
  position: relative !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  display: inline-flex !important;
  margin-bottom: 12px;
}

.elementor-editor-active .esw-wrapper .esw-sidebar {
  position: relative !important;
  transform: none !important;
  width: 100% !important;
  box-shadow: 0 0 0 2px #93b7f7;
}
