/* Style frontendu wtyczki SweetMap */

/* Hard reset for the viewer subtree so theme CSS cannot break the layout. */
.sweetmap-viewer,
.sweetmap-viewer *,
.sweetmap-viewer *::before,
.sweetmap-viewer *::after {
  box-sizing: border-box;
}

.sweetmap-viewer {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 20px 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #333;
  perspective: 1500px;
  overflow: visible;
}

.sweetmap-viewer .sweetmap-map-wrapper {
  position: relative;
  width: 100%;
  display: inline-block;
  background-color: #f3f4f6;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: transform 0.46s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.46s ease, filter 0.46s ease;
  transform-style: preserve-3d;
  transform-origin: center center;
  backface-visibility: hidden;
}

/* Efekty przejść perspektyw i map */
.sweetmap-viewer .sweetmap-map-wrapper.sm-transitioning {
  will-change: transform, opacity, filter;
}

.sweetmap-viewer .sweetmap-map-wrapper.sm-transition-setup {
  transition: none !important;
}

.sweetmap-viewer .sweetmap-map-wrapper.sm-transition-fade-exit,
.sweetmap-viewer .sweetmap-map-wrapper.sm-transition-fade-enter {
  opacity: 0;
  filter: blur(2px);
}

.sweetmap-viewer .sweetmap-map-wrapper.sm-transition-flip-h-exit {
  transform: perspective(1200px) rotateY(78deg) scale(0.94);
  opacity: 0.5;
}

.sweetmap-viewer .sweetmap-map-wrapper.sm-transition-flip-h-enter {
  transform: perspective(1200px) rotateY(-78deg) scale(0.94);
  opacity: 0.5;
}

.sweetmap-viewer .sweetmap-map-wrapper.sm-transition-flip-v-exit {
  transform: perspective(1200px) rotateX(-70deg) scale(0.94);
  opacity: 0.5;
}

.sweetmap-viewer .sweetmap-map-wrapper.sm-transition-flip-v-enter {
  transform: perspective(1200px) rotateX(70deg) scale(0.94);
  opacity: 0.5;
}

.sweetmap-viewer .sweetmap-map-wrapper.sm-transition-zoom-3d-exit {
  transform: perspective(1200px) translateZ(-180px) scale(0.72) rotateX(12deg) rotateY(-8deg);
  opacity: 0.25;
  filter: blur(4px);
}

.sweetmap-viewer .sweetmap-map-wrapper.sm-transition-zoom-3d-enter {
  transform: perspective(1200px) translateZ(100px) scale(1.16) rotateX(-8deg) rotateY(6deg);
  opacity: 0.3;
  filter: blur(4px);
}

.sweetmap-bg-image {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.sweetmap-svg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.sweetmap-polygon {
  cursor: pointer;
  transition: fill 0.2s ease, stroke 0.2s ease;
}

.sweetmap-polygon:focus {
  outline: none;
}

.sweetmap-polygon:focus-visible {
  outline: 3px solid rgba(124, 58, 237, 0.85);
  outline-offset: 1px;
}

/* Tooltip / Chmurka podpowiedzi */
.sweetmap-tooltip {
  display: none;
  position: absolute;
  pointer-events: none;
  background-color: rgba(18, 19, 24, 0.95);
  border: 1px solid #2f3344;
  color: #f3f4f6;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  z-index: 99999;
  transform: translate(-50%, -100%);
  margin-top: -10px;
  max-width: min(280px, calc(100vw - 24px));
  text-align: center;
  white-space: pre-line;
}

.sweetmap-polygon-label-text {
  dominant-baseline: middle;
  paint-order: fill;
}

@media (prefers-reduced-motion: reduce) {
  .sweetmap-viewer .sweetmap-map-wrapper {
    transition: none !important;
  }
}

/* Nawigacja okruszkowa (Breadcrumbs) */
.sweetmap-breadcrumbs-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: #374151;
}

.sweetmap-back-btn {
  position: absolute;
  top: 15px;
  left: 15px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background-color: rgba(18, 19, 24, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
  z-index: 100;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.sweetmap-back-btn:hover:not(:disabled) {
  background-color: rgba(18, 19, 24, 0.95);
  transform: scale(1.05);
}

.sweetmap-back-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

.sweetmap-back-btn svg {
  width: 18px;
  height: 18px;
}

.sweetmap-breadcrumb {
  cursor: pointer;
  color: inherit;
  font-weight: 600;
  transition: opacity 0.15s ease;
}

.sweetmap-breadcrumb:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.sweetmap-breadcrumb::after {
  content: "/";
  margin-left: 8px;
  color: currentColor;
  opacity: 0.6;
  pointer-events: none;
  display: inline-block;
}

.sweetmap-breadcrumb:last-child {
  opacity: 0.8;
  cursor: default;
  pointer-events: none;
}

.sweetmap-breadcrumb:last-child::after {
  display: none;
}

/* Modal Popup */
.sweetmap-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sweetmap-modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sweetmap-modal-content {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: fit-content;
  min-width: min(500px, 95%);
  max-width: 95%;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.25s ease;
  overflow: hidden;
  box-sizing: border-box;
}

.sweetmap-modal-overlay.active .sweetmap-modal-content {
  transform: scale(1);
}

.sweetmap-modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  color: #9ca3af;
  transition: color 0.15s ease;
  line-height: 1;
  padding: 5px;
}

.sweetmap-modal-close:hover {
  color: #374151;
}

.sweetmap-modal-body-content {
  padding: 30px;
  max-height: 80vh;
  overflow-y: auto;
}

/* Przycisk Pełnego Ekranu */
.sweetmap-fullscreen-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background-color: rgba(18, 19, 24, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
  z-index: 100;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  padding: 0;
}

.sweetmap-fullscreen-btn:hover {
  background-color: rgba(18, 19, 24, 0.95);
  transform: scale(1.05);
}

.sweetmap-fullscreen-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

/* Ikony enter/exit w zależności od stanu */
.sweetmap-fullscreen-btn svg .sm-fs-icon-exit {
  display: none;
}

.sweetmap-viewer.sweetmap-is-fullscreen .sweetmap-fullscreen-btn svg .sm-fs-icon-enter {
  display: none;
}

.sweetmap-viewer.sweetmap-is-fullscreen .sweetmap-fullscreen-btn svg .sm-fs-icon-exit {
  display: block;
}

/* Stan pełnoekranowy (Overlay) */
.sweetmap-viewer.sweetmap-is-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  z-index: 2147483647 !important;
  background-color: rgba(17, 24, 39, 0.98) !important;
  margin: 0 !important;
  padding: 30px !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  isolation: isolate !important;
}

.sweetmap-viewer.sweetmap-is-fullscreen .sweetmap-breadcrumbs-container {
  width: 100% !important;
  max-width: 1200px !important;
  color: #fff !important;
  margin-bottom: 20px !important;
}

.sweetmap-viewer.sweetmap-is-fullscreen .sweetmap-breadcrumb {
  color: #a78bfa !important;
}

.sweetmap-viewer.sweetmap-is-fullscreen .sweetmap-breadcrumb:hover {
  color: #c084fc !important;
}

.sweetmap-viewer.sweetmap-is-fullscreen .sweetmap-breadcrumb::after {
  color: #4b5563 !important;
}

.sweetmap-viewer.sweetmap-is-fullscreen .sweetmap-breadcrumb:last-child {
  color: #9ca3af !important;
}

.sweetmap-viewer.sweetmap-is-fullscreen .sweetmap-map-wrapper {
  max-width: 100% !important;
  max-height: calc(100vh - 120px) !important;
  width: auto !important;
  height: auto !important;
  display: flex !important;
  position: relative !important;
  align-items: center !important;
  justify-content: center !important;
  background-color: transparent !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}

.sweetmap-viewer.sweetmap-is-fullscreen .sweetmap-bg-image {
  max-width: 100% !important;
  max-height: calc(100vh - 120px) !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
}

/* Panel perspektyw / widoków (obracanie budynku) */
.sweetmap-perspectives-container {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 19, 24, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 30px;
  padding: 4px 6px;
  display: flex;
  gap: 4px;
  z-index: 150;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
}

.sweetmap-perspective-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.sweetmap-perspective-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.sweetmap-perspective-btn.active {
  color: #fff;
  background: #ef4444;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.sweetmap-logo-image {
  pointer-events: none !important;
}

/* Izolacja od globalnych stylów motywu. Układ jest identyczny na każdym ekranie. */
.sweetmap-viewer .sweetmap-map-wrapper {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  line-height: 0 !important;
  font-size: 0 !important;
}

.sweetmap-viewer .sweetmap-map-wrapper::before,
.sweetmap-viewer .sweetmap-map-wrapper::after {
  content: none !important;
}

.sweetmap-viewer .sweetmap-bg-image {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  object-fit: contain !important;
  z-index: 1;
}

.sweetmap-viewer .sweetmap-svg-overlay {
  position: absolute !important;
  inset: auto !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  z-index: 10;
  pointer-events: auto !important;
  touch-action: manipulation;
}

.sweetmap-viewer .sweetmap-polygon {
  pointer-events: all !important;
  touch-action: manipulation;
}

.sweetmap-viewer .sweetmap-polygon-label-text,
.sweetmap-viewer .sweetmap-logo-image {
  pointer-events: none !important;
}

.sweetmap-viewer .sweetmap-back-btn,
.sweetmap-viewer .sweetmap-fullscreen-btn {
  position: absolute !important;
  top: 15px !important;
  display: flex !important;
  width: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
  box-sizing: border-box !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  pointer-events: auto !important;
  touch-action: manipulation;
  z-index: 100 !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.sweetmap-viewer .sweetmap-back-btn:disabled {
  display: flex !important;
  visibility: visible !important;
  opacity: 0.7 !important;
}

.sweetmap-viewer .sweetmap-back-btn {
  left: 15px !important;
  right: auto !important;
}

.sweetmap-viewer .sweetmap-fullscreen-btn {
  right: 15px !important;
  left: auto !important;
}
