/*
 * Product Share Popup Styling
 * Custom share functionality for single product pages
 */

/* Hide the share button in product meta section completely */
.product_meta .product-share-wrapper {
  display: none !important;
}

/* Hide parent theme's default share section - be very specific */
.product_meta > span:not(.product-share-wrapper):not(.sku_wrapper):not(.posted_in):not(.tagged_as) {
  /* Will be hidden by JavaScript if contains "share" */
}

.product_meta .share-links,
.product_meta > .product-share:not(.product-share-wrapper),
.product_meta > span a[class*="facebook"]:not(.share-facebook),
.product_meta > span a[class*="twitter"]:not(.share-twitter) {
  display: none !important;
}

/* Share Button beside Cart and Wishlist - Match their design */
.product-share-beside-cart {
  display: flex !important;
  align-items: center !important;
  flex: 0 0 auto !important;
  margin: 0 !important;
  padding: 0 !important;
  align-self: center !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.product-share-button-styled {
  /* Match vs-btn and wishlist button styling */
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: none !important;
  text-transform: uppercase !important;
  text-align: center !important;
  background-color: var(--vs-border-color2) !important;
  color: var(--white-color) !important;
  font-family: var(--body-font) !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  padding: 19px 22px !important; /* Slightly less padding for icon-only button */
  border-radius: 0 !important;
  z-index: 1 !important;
  overflow: hidden !important;
  letter-spacing: 0.1px !important;
  width: auto !important;
  height: 65px !important;
  min-height: 65px !important;
  max-height: 65px !important;
  flex: 0 0 auto !important;
  box-sizing: border-box !important;
  box-shadow: none !important;
  border-width: 0 !important;
  outline: none !important;
  margin: 0 !important;
  vertical-align: middle !important;
  transition: all 0.3s ease-in-out !important;
  cursor: pointer !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Add before/after pseudo-elements for hover effects matching wishlist button */
.product-share-button-styled::after,
.product-share-button-styled::before {
  width: 101% !important;
  height: 100% !important;
  content: "" !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  background: var(--theme-color) !important;
  transition: all ease 0.5s !important;
  z-index: -1 !important;
}

.product-share-button-styled:before {
  transform: rotateX(90deg) !important;
}

.product-share-button-styled:after {
  transform: rotateY(90deg) !important;
}

/* Hover state matching wishlist button */
.product-share-button-styled:hover {
  color: var(--white-color) !important;
  background-color: var(--vs-border-color2) !important;
}

.product-share-button-styled:hover:before {
  transform: rotateX(0) !important;
}

.product-share-button-styled:hover:after {
  transform: rotateY(0) !important;
}

/* SVG icon styling */
.product-share-button-styled svg {
  width: 20px !important;
  height: 20px !important;
  display: block !important;
}

/* Share Modal Overlay */
.product-share-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 99999 !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px;
  backdrop-filter: blur(5px);
  overflow-y: auto;
  outline: none;
}

/* Modal focus state */
.product-share-modal:focus {
  outline: none;
}

/* Only show modal when it has .show class or inline style */
.product-share-modal[style*="display: none"] {
  display: none !important;
}

.product-share-modal[style*="display: flex"],
.product-share-modal.show {
  display: flex !important;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Modal Content */
.product-share-modal-content {
  background-color: #1a1d23;
  border-radius: 12px;
  max-width: 550px;
  width: 100%;
  margin: auto;
  position: relative;
  animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal Header */
.product-share-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 25px 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.product-share-modal-header h3 {
  margin: 0;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.product-share-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease-in-out;
  border-radius: 50%;
  min-width: 40px;
  min-height: 40px;
  position: relative;
  z-index: 10;
}

.product-share-close:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.15);
  transform: rotate(90deg);
}

.product-share-close svg {
  width: 24px;
  height: 24px;
  pointer-events: none;
}

/* Modal Body */
.product-share-modal-body {
  padding: 30px;
}

/* Share Options Grid */
.share-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 30px;
}

.share-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 15px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  transition: all 0.3s ease-in-out;
  cursor: pointer;
}

.share-option:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--theme-color, #d4af37);
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.share-option:focus {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: var(--theme-color, #d4af37);
  outline: 2px solid var(--theme-color, #d4af37);
  outline-offset: 2px;
  transform: translateY(-3px);
}

.share-option svg {
  width: 32px;
  height: 32px;
  transition: transform 0.3s ease-in-out;
}

.share-option:hover svg {
  transform: scale(1.1);
}

.share-option span {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Specific Social Media Colors on Hover */
.share-facebook:hover {
  background-color: rgba(24, 119, 242, 0.1);
  border-color: #1877F2;
}

.share-facebook:hover svg {
  color: #1877F2;
}

.share-twitter:hover {
  background-color: rgba(29, 161, 242, 0.1);
  border-color: #1DA1F2;
}

.share-twitter:hover svg {
  color: #1DA1F2;
}

.share-whatsapp:hover {
  background-color: rgba(37, 211, 102, 0.1);
  border-color: #25D366;
}

.share-whatsapp:hover svg {
  color: #25D366;
}

.share-pinterest:hover {
  background-color: rgba(230, 0, 35, 0.1);
  border-color: #E60023;
}

.share-pinterest:hover svg {
  color: #E60023;
}

.share-linkedin:hover {
  background-color: rgba(0, 119, 181, 0.1);
  border-color: #0077B5;
}

.share-linkedin:hover svg {
  color: #0077B5;
}

.share-email:hover {
  background-color: rgba(212, 175, 55, 0.1);
  border-color: var(--theme-color, #d4af37);
}

.share-email:hover svg {
  color: var(--theme-color, #d4af37);
}

/* Copy Link Section */
.share-copy-link {
  padding-top: 25px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.share-copy-link label {
  display: block;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.copy-link-wrapper {
  display: flex;
  gap: 10px;
}

.copy-link-wrapper input {
  flex: 1;
  padding: 12px 15px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  font-family: monospace;
  transition: all 0.3s ease-in-out;
}

.copy-link-wrapper input:focus {
  outline: none;
  border-color: var(--theme-color, #d4af37);
  background-color: rgba(255, 255, 255, 0.08);
}

.copy-link-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background-color: var(--theme-color, #d4af37);
  color: #111419;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.3s ease-in-out;
  white-space: nowrap;
}

.copy-link-btn:hover {
  background-color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.copy-link-btn.copied {
  background-color: #4caf50;
  color: #fff;
}

.copy-link-btn svg {
  width: 20px;
  height: 20px;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
  /* Ensure share button is visible on tablet/mobile */
  .product-share-beside-cart {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  .product-share-button-styled {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* Modal styling */
  .product-share-modal {
    padding: 15px;
  }
  
  .product-share-modal-content {
    max-width: 100%;
  }
  
  .product-share-modal-header {
    padding: 20px;
  }
  
  .product-share-modal-header h3 {
    font-size: 18px;
  }
  
  .product-share-modal-body {
    padding: 20px;
  }
  
  .share-options {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .share-option {
    padding: 15px 10px;
  }
  
  .share-option svg {
    width: 28px;
    height: 28px;
  }
  
  .share-option span {
    font-size: 12px;
  }
  
  .copy-link-wrapper {
    flex-direction: column;
  }
  
  .copy-link-btn {
    width: 100%;
    justify-content: center;
  }
}

@media screen and (max-width: 480px) {
  .share-options {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .product-share-button {
    width: 100%;
    justify-content: center;
  }
  
  /* Ensure share button is visible and properly sized on mobile */
  .product-share-button-styled {
    display: inline-flex !important;
    width: 65px !important;
    min-width: 65px !important;
    padding: 19px 20px !important;
  }
  
  .product-share-beside-cart {
    display: flex !important;
    flex: 0 0 auto !important;
  }
}

/* Additional responsive adjustments for action buttons */
@media screen and (max-width: 576px) {
  .actions {
    gap: 8px !important;
  }
  
  .product-share-button-styled {
    padding: 19px 20px !important;
    width: 65px !important;
  }
  
  /* Ensure share button container is always visible */
  .product-share-beside-cart {
    display: flex !important;
  }
}

/* Animation for modal opening */
.product-share-modal.show {
  display: flex;
}

/* Force modal to be on top of everything */
body > #productShareModal {
  position: fixed !important;
  z-index: 999999 !important;
}

/* Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden !important;
}

/* Additional modal positioning fixes */
#productShareModal {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.product-share-modal-content {
  max-height: 90vh;
  overflow-y: auto;
}

/* Smooth scrolling for modal content */
.product-share-modal-content::-webkit-scrollbar {
  width: 8px;
}

.product-share-modal-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.product-share-modal-content::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.5);
  border-radius: 4px;
}

.product-share-modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 175, 55, 0.8);
}

/* Smooth scrolling prevention when modal is open */
body.modal-open {
  overflow: hidden;
}
