/* Component Reset & Isolation */
.teddy-ic-container,
.teddy-ic-container *,
.teddy-ic-container *::before,
.teddy-ic-container *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: none;
  font-family: inherit;
  line-height: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.teddy-ic-container {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  cursor: ew-resize;
  background: #000; /* Fallback background */
}

/* The background (after) image defines the height/width if smaller than container */
.teddy-ic-container > img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  filter: none !important;
}

.teddy-ic-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
  z-index: 10;
  background:black;
}

/* The overlay (before) image must cover the background exactly */
.teddy-ic-container .teddy-ic-overlay img {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--container-width, 100%); 
  height: auto;
  display: block;
  max-width: none !important;
}

.teddy-ic-slider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 20;
  transform: translateX(-50%);
  transition: background 0.2s;
}

.teddy-ic-container:hover .teddy-ic-slider {
  background: rgba(255, 255, 255, 0.8);
}

.teddy-ic-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: grab;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, background 0.2s;
  z-index: 30;
}

.teddy-ic-handle:active {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(0.9);
}

.teddy-ic-handle::before,
.teddy-ic-handle::after {
  content: '';
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.teddy-ic-handle::before {
  border-right: 8px solid #ffffff;
  margin-right: 4px;
}

.teddy-ic-handle::after {
  border-left: 8px solid #ffffff;
  margin-left: 4px;
}

.teddy-ic-dragging .teddy-ic-handle {
  background: rgba(255, 255, 255, 0.4);
}

.teddy-ic-label {
  position: absolute;
  bottom: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 0.85rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 500;
  border-radius: 6px;
  pointer-events: none;
  z-index: 15;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.teddy-ic-container:hover .teddy-ic-label {
  opacity: 1;
  visibility: visible;
}

.teddy-ic-label-before {
  left: 1rem;
}

.teddy-ic-label-after {
  right: 1rem;
}
