/* ============================================
   BASE WRAPPER FIX
   ============================================ */
.spi-wrapper {
  position: relative;
  display: block;
  overflow: hidden;
  /* Fixes mysterious gaps/white space under images */
  line-height: 0;
  font-size: 0;
  max-width: 100%; /* Ensures responsive images don't overflow */
}

/* Ensure the image inside fills the wrapper correctly */
/* Ensure the image inside fills the wrapper corresctly */
.spi-wrapper img {
  /* REMOVED: display: block; max-width: 100%; height: auto; */
  /* We want to preserve the original image styles */
}

.pinterest-icon {
  width: 12px;
  height: 12px;
  fill: currentColor;
  margin-right: 6px;
  vertical-align: middle;
  display: inline-block;
}

/* Base Button */
.spi-btn {
  position: absolute;
  z-index: 999; /* High Z-index to sit on top of everything */
  cursor: pointer;
  line-height: 1; /* Reset line-height for text */
  display: flex;
  align-items: center;
  text-decoration: none !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  transform: scale(0.9);
  white-space: nowrap; /* Prevents text breaking */
}

/* ============================================
   POSITIONING (Coordinates relative to Image)
   ============================================ */
.spi-btn.top-left {
  top: 15px;
  left: 15px;
}
.spi-btn.top-right {
  top: 15px;
  right: 15px;
}
.spi-btn.bottom-left {
  bottom: 15px;
  left: 15px;
}
.spi-btn.bottom-right {
  bottom: 15px;
  right: 15px;
}

/* ============================================
   HOVER LOGIC
   ============================================ */
.spi-wrapper:hover .spi-btn,
.spi-wrapper.spi-always-show .spi-btn {
  opacity: 1;
  transform: scale(1);
}

.spi-btn:hover {
  transform: scale(1.05) translateY(-2px) !important;
}

/* ============================================
   DESIGNS
   ============================================ */
/* 1. Red */
.spi-btn.design-1 {
  background-color: #e60023;
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  font-family: sans-serif;
  padding: 9px 16px;
  border-radius: 24px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.spi-btn.design-1:hover {
  background-color: #ad001b;
}

/* 2. White */
.spi-btn.design-2 {
  background-color: #fff;
  color: #111 !important;
  font-size: 14px;
  font-weight: 600;
  font-family: sans-serif;
  padding: 9px 16px;
  border-radius: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.spi-btn.design-2:hover {
  background-color: #f0f0f0;
}
.spi-btn.design-2 .pinterest-icon {
  fill: #e60023;
}

/* 3. Dark */
.spi-btn.design-3 {
  background-color: #111;
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  font-family: sans-serif;
  padding: 9px 16px;
  border-radius: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.spi-btn.design-3:hover {
  background-color: #000;
}

/* 4. Rounded Square */
.spi-btn.design-4 {
  background-color: #e60023;
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  font-family: sans-serif;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(230, 0, 35, 0.3);
}
.spi-btn.design-4:hover {
  background-color: #ad001b;
}

/* 5. Glass */
.spi-btn.design-5 {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #e60023 !important;
  font-size: 14px;
  font-weight: 600;
  font-family: sans-serif;
  padding: 9px 16px;
  border-radius: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.spi-btn.design-5:hover {
  background: rgba(255, 255, 255, 1);
}
.spi-btn.design-5 .pinterest-icon {
  fill: #e60023;
}

/* 6. Icon Only */
.spi-btn.design-6 {
  background-color: #e60023;
  color: #fff !important;
  font-size: 0;
  padding: 11px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(230, 0, 35, 0.3);
  width: 40px;
  height: 40px;
  justify-content: center;
}
.spi-btn.design-6:hover {
  background-color: #ad001b;
}
.spi-btn.design-6 .pinterest-icon {
  width: 18px;
  height: 18px;
  margin: 0;
}

/* 7. Outlined */
.spi-btn.design-7 {
  background-color: transparent;
  border: 2px solid #fff;
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  font-family: sans-serif;
  padding: 8px 16px;
  border-radius: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
}
.spi-btn.design-7:hover {
  background-color: #fff;
  color: #e60023 !important;
}
.spi-btn.design-7:hover .pinterest-icon {
  fill: #e60023;
}

/* 8. Gradient */
.spi-btn.design-8 {
  background: linear-gradient(135deg, #e60023 0%, #c60019 100%);
  color: #fff !important;
  font-size: 14px;
  font-weight: 700;
  font-family: sans-serif;
  padding: 11px 20px;
  border-radius: 28px;
  box-shadow: 0 4px 12px rgba(230, 0, 35, 0.4);
}

/* ============================================
   RECIPE POPUP
   ============================================ */
.spi-recipe-popup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  padding: 12px;
  z-index: 10000;
  max-width: 350px;
  width: auto;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  visibility: hidden;
  border: 1px solid rgba(0,0,0,0.05);
}

.spi-recipe-popup.spi-show {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Image */
.spi-recipe-popup-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  margin-right: 12px;
  flex-shrink: 0;
}

/* Content */
.spi-recipe-popup-content {
  flex-grow: 1;
  margin-right: 24px;
}

.spi-recipe-popup-title {
  font-size: 14px;
  font-weight: 600;
  color: #111;
  margin-bottom: 4px;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.spi-recipe-popup-cta {
  font-size: 12px;
  color: #666;
}

/* Save Button (Mini version of main button) */
.spi-recipe-popup .spi-btn-save {
  background-color: #e60023;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.spi-recipe-popup .spi-btn-save:hover {
  background-color: #ad001b;
}

.spi-recipe-popup .pinterest-icon {
  width: 10px;
  height: 10px;
  margin-right: 6px;
  fill: currentColor;
}

/* Close Button */
.spi-recipe-popup-close {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.1);
  color: #555;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: all 0.2s;
  font-size: 14px;
  line-height: 1;
}

.spi-recipe-popup-close:hover {
  background: #f0f0f0;
  color: #000;
  transform: scale(1.1);
}

/* Mobile Responsive */
@media screen and (max-width: 480px) {
  .spi-recipe-popup {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 12px 12px 0 0; /* Rounded top only */
    padding: 16px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    transform: translateY(100%); /* Slide form bottom */
    border: none;
    border-top: 1px solid rgba(0,0,0,0.05);
  }
  
  .spi-recipe-popup.spi-show {
    transform: translateY(0);
  }

  .spi-recipe-popup-close {
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    box-shadow: none;
    font-size: 20px;
    color: #999;
  }
  
  .spi-recipe-popup-img {
    width: 50px;
    height: 50px;
  }
}
