/* Hotel-Nägele PopUp – Frontend Styles */
/* Developed by ConstructMedia / constructmedia.de */
/* Version: 1.0.4 */

:root {
  --hn-accent: #9f8a5b;
  --hn-accent-dark: #7e6c46;
  --hn-white: #ffffff;
  --hn-overlay-bg: rgba(0, 0, 0, 0.55);
  --hn-popup-radius: 6px;
  --hn-popup-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  --hn-transition: 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  --hn-mobile-transition: 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  --hn-sticky-width: 44px;
  --hn-sticky-height: 160px;
  --hn-z-popup: 2147483640;
  --hn-z-sticky: 2147483630;
  --hn-close-bar-height: 52px;
}

/* =========================================
   BODY SCROLL LOCK (iOS-safe)
   ========================================= */

body.hn-scroll-locked {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
  /* top is set dynamically via JS to preserve scroll position */
}

/* =========================================
   OVERLAY
   ========================================= */

.hn-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--hn-z-popup);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--hn-overlay-bg);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--hn-transition), visibility var(--hn-transition);
  box-sizing: border-box;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.hn-popup-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.hn-popup-overlay.is-open .hn-popup-container {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* =========================================
   POPUP CONTAINER – Desktop
   ========================================= */

.hn-popup-container {
  position: relative;
  background: var(--hn-white);
  border-radius: var(--hn-popup-radius);
  box-shadow: var(--hn-popup-shadow);
  max-width: var(--hn-popup-max-width, 700px);
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(24px) scale(0.97);
  opacity: 0;
  transition: transform var(--hn-transition), opacity var(--hn-transition);
  box-sizing: border-box;
  will-change: transform, opacity;
}

/* =========================================
   CLOSE BAR – always visible, never scrolls away
   ========================================= */

.hn-popup-close-bar {
  position: relative;
  flex-shrink: 0;
  height: var(--hn-close-bar-height);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 12px;
  z-index: 9999;
  background: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
}

/* =========================================
   DRAG HANDLE – visible only on mobile
   ========================================= */

.hn-popup-drag-handle {
  display: none; /* shown only on mobile via media query */
  width: 40px;
  height: 4px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 2px;
  flex-shrink: 0;
  cursor: grab;
}

/* =========================================
   CLOSE BUTTON
   ========================================= */

.hn-popup-close {
  position: relative;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  background: rgba(0, 0, 0, 0.06);
  border: none;
  border-radius: 22px;
  cursor: pointer;
  color: #444;
  transition: background var(--hn-transition), color var(--hn-transition), transform 0.15s ease;
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  white-space: nowrap;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
}

.hn-popup-close:hover,
.hn-popup-close:active {
  background: var(--hn-accent);
  color: var(--hn-white);
}

.hn-popup-close:focus-visible {
  outline: 2px solid var(--hn-accent);
  outline-offset: 2px;
}

.hn-popup-close svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  pointer-events: none;
}

/* Label text – visible on desktop, hidden on mobile */
.hn-popup-close__label {
  display: inline;
}

/* =========================================
   POPUP BODY – scrollable area
   ========================================= */

.hn-popup-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--hn-accent) transparent;
}

.hn-popup-body::-webkit-scrollbar { width: 4px; }
.hn-popup-body::-webkit-scrollbar-track { background: transparent; }
.hn-popup-body::-webkit-scrollbar-thumb {
  background-color: var(--hn-accent);
  border-radius: 4px;
}

/* =========================================
   POPUP CONTENT AREA
   ========================================= */

.hn-popup-content {
  /* Avada Builder content fills this naturally */
}

.hn-popup-content .fusion-builder-row,
.hn-popup-content .fusion-layout-column,
.hn-popup-content .fusion-column-wrapper {
  margin-bottom: 0 !important;
}

/* =========================================
   STICKY GROUP – wrapper for both sticky buttons
   ========================================= */

.hn-sticky-group {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: var(--hn-z-sticky);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.hn-sticky-group--left  { left: 0; }
.hn-sticky-group--right { right: 0; }

/* Border-radius: outer corners rounded, inner edge flat */
.hn-sticky-group--left  .hn-sticky-btn,
.hn-sticky-group--left  .hn-sticky-review { border-radius: 0 6px 6px 0; }
.hn-sticky-group--right .hn-sticky-btn,
.hn-sticky-group--right .hn-sticky-review { border-radius: 6px 0 0 6px; }

/* =========================================
   STICKY BUTTON – popup opener
   ========================================= */

.hn-sticky-btn {
  display: none; /* shown via .is-visible when popup closes */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: var(--hn-sticky-width);
  height: var(--hn-sticky-height);
  background-color: var(--hn-accent);
  border: none;
  cursor: pointer;
  padding: 12px 0;
  color: var(--hn-white);
  box-shadow: -2px 0 16px rgba(0, 0, 0, 0.22);
  transition: background-color var(--hn-transition), box-shadow var(--hn-transition);
  box-sizing: border-box;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.hn-sticky-group--left .hn-sticky-btn {
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.22);
}

.hn-sticky-btn.is-visible { display: flex; }

.hn-sticky-btn:hover,
.hn-sticky-btn:active {
  background-color: var(--hn-accent-dark);
  box-shadow: -3px 0 24px rgba(0, 0, 0, 0.32);
}

.hn-sticky-btn:focus-visible {
  outline: 2px solid var(--hn-accent);
  outline-offset: 3px;
}

.hn-sticky-btn__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hn-sticky-btn__icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  pointer-events: none;
}

.hn-sticky-btn__text {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.2;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.hn-sticky-group--left .hn-sticky-btn__text {
  transform: rotate(180deg);
}

/* =========================================
   STICKY REVIEW BUTTON – always visible Google link
   ========================================= */

.hn-sticky-review {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: var(--hn-sticky-width);
  height: var(--hn-sticky-height);
  background-color: var(--hn-accent);
  cursor: pointer;
  padding: 12px 0;
  color: var(--hn-white);
  text-decoration: none;
  box-shadow: -2px 0 16px rgba(0, 0, 0, 0.22);
  transition: background-color var(--hn-transition), box-shadow var(--hn-transition);
  box-sizing: border-box;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.hn-sticky-group--left .hn-sticky-review {
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.22);
}

.hn-sticky-review:hover,
.hn-sticky-review:active {
  background-color: var(--hn-accent-dark);
  box-shadow: -3px 0 24px rgba(0, 0, 0, 0.32);
  text-decoration: none;
  color: var(--hn-white);
}

.hn-sticky-review:focus-visible {
  outline: 2px solid var(--hn-accent);
  outline-offset: 3px;
}

.hn-sticky-review__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hn-sticky-review__icon svg {
  width: 20px;
  height: 20px;
  fill: var(--hn-white);
  pointer-events: none;
}

.hn-sticky-review__text {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.2;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.hn-sticky-group--left .hn-sticky-review__text {
  transform: rotate(180deg);
}

/* =========================================
   ACCESSIBILITY: REDUCED MOTION
   ========================================= */

@media (prefers-reduced-motion: reduce) {
  .hn-popup-overlay,
  .hn-popup-container,
  .hn-popup-close,
  .hn-sticky-btn {
    transition: none;
  }
}

/* =========================================
   MOBILE BREAKPOINT (≤ 640px)
   Bottom sheet: slides up from the bottom
   ========================================= */

@media (max-width: 640px) {

  /* --- Overlay: no padding, align to bottom --- */
  .hn-popup-overlay {
    padding: 0;
    align-items: flex-end;
    /* Tap the dark area above to close */
  }

  /* --- Container: full-width bottom sheet --- */
  .hn-popup-container {
    width: 100%;
    max-width: 100%;
    max-height: 88vh;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.22);
    /* Override desktop animation: slide up from below */
    transform: translateY(100%);
    opacity: 1; /* always visible, position does the hiding */
    transition: transform var(--hn-mobile-transition);
  }

  /* Open state: slide into view */
  .hn-popup-overlay.is-open .hn-popup-container {
    transform: translateY(0);
    opacity: 1;
  }

  /* --- Close bar: show drag handle prominently --- */
  .hn-popup-close-bar {
    height: 60px;
    padding: 0 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    /* Stack: drag-handle centred at top, close btn right */
    position: relative;
  }

  /* Drag handle: centred pill at the top of close bar */
  .hn-popup-drag-handle {
    display: block;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
  }

  /* Close button: icon-only circle on mobile */
  .hn-popup-close {
    margin-left: auto;
    margin-top: 12px; /* push below drag handle */
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    padding: 0;
    background: rgba(0, 0, 0, 0.07);
  }

  /* Hide text label on mobile – icon is enough */
  .hn-popup-close__label {
    display: none;
  }

  .hn-popup-close svg {
    width: 18px;
    height: 18px;
  }

  /* Body: safe-area padding for notch/home-bar devices */
  .hn-popup-body {
    padding-bottom: env(safe-area-inset-bottom, 12px);
  }

  /* --- Sticky group: slightly smaller on mobile --- */
  .hn-sticky-group {
    gap: 6px;
  }

  .hn-sticky-btn,
  .hn-sticky-review {
    --hn-sticky-width: 36px;
    --hn-sticky-height: 110px;
  }

  .hn-sticky-btn__text,
  .hn-sticky-review__text { font-size: 9px; letter-spacing: 0.04em; }

  .hn-sticky-btn__icon svg,
  .hn-sticky-review__icon svg { width: 15px; height: 15px; }
}
