/* Mobile-friendly text selection sharing styles */

/* Enhanced tooltip styling for mobile */
.sharect {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 9999;
  /* Ensure proper sizing and centering */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  .sharect {
    /* Larger touch targets for mobile */
    min-height: 60px;
    border-radius: 12px;
    padding: 8px;
  }
  
  .sharect__icon {
    width: 28px !important;
    height: 28px !important;
  }
  
  /* Ensure tooltips are always visible on mobile */
  .sharect {
    max-width: calc(100vw - 40px);
    transform: translateZ(0); /* Force hardware acceleration */
  }
}

/* Touch-friendly button states */
@media (hover: none) and (pointer: coarse) {
  .sharect > div {
    /* Larger touch targets */
    min-width: 52px !important;
    min-height: 52px !important;
    margin: 8px !important;
  }
  
  /* Remove hover effects on touch devices */
  .sharect > div:hover {
    transform: none !important;
  }
  
  /* Active state for touch feedback */
  .sharect > div:active {
    transform: scale(0.95) !important;
    background: rgba(255, 255, 255, 0.3) !important;
  }
}

/* Accessibility improvements */
.sharect > div {
  /* Better focus indicators */
  outline: none;
  position: relative;
}

.sharect > div:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5);
  border-radius: 8px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .sharect {
    background-color: #000 !important;
    border: 2px solid #fff !important;
  }
  
  .sharect__icon {
    fill: #fff !important;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .sharect,
  .sharect > div {
    transition: none !important;
    animation: none !important;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .sharect {
    background-color: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
  }
}

/* Landscape orientation adjustments for mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .sharect {
    /* Smaller size in landscape to save vertical space */
    min-height: 50px;
    padding: 6px;
  }
  
  .sharect > div {
    min-width: 44px !important;
    min-height: 44px !important;
    margin: 6px !important;
  }
}

/* Very small screens (phones in portrait) */
@media (max-width: 480px) {
  .sharect {
    /* Ensure tooltip fits on small screens */
    max-width: calc(100vw - 20px);
    left: 10px !important;
  }
}

/* Tablet-specific adjustments */
@media (min-width: 481px) and (max-width: 768px) {
  .sharect > div {
    min-width: 48px !important;
    min-height: 48px !important;
  }
}

/* Animation for tooltip appearance */
@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sharect {
  animation: tooltipFadeIn 0.2s ease-out;
}

/* Prevent text selection on the tooltip itself */
.sharect {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Ensure tooltip appears above other elements */
.sharect {
  position: absolute;
  z-index: 999999;
}

/* Loading state for native share button */
.sharect > div[data-sharing="true"] {
  opacity: 0.7;
  pointer-events: none;
}

.sharect > div[data-sharing="true"]::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
