/* Social Share Component CSS - Performance Optimized */

/* CSS Custom Properties for Brand Colors */
:root {
  --share-fb: #1877F2;
  --share-x: #000000;
  --share-li: #0A66C2;
  --share-wa: #25D366;
  --share-copy: #6c757d;
  --share-native: #007bff;
  --share-neutral-icon: #1f1f1f;
  --share-heading-color: #111418; /* High contrast on light background */
  --share-border-radius: 20px;
  --share-button-height: 40px;
  --share-gap: 0.75rem;
  --share-gap-mobile: 0.5rem;
}

/* Main share component container */
.blog-share-bar {
  margin: 2rem 0;
  padding: 1.5rem 0;
  border-top: 1px solid #e9ecef;
  contain: layout style;
}

.share-title {
  font-size: 1rem;
  font-weight: 700; /* Slightly bolder for readability */
  margin-bottom: 1rem;
  color: var(--share-heading-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.share-title i {
  font-size: 1.1em;
  color: var(--share-neutral-icon);
}

/* Share buttons container */
.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--share-gap);
  align-items: center;
  /* Added contrast panel background for better separation from article body */
  background: #f5f7fa;
  padding: 0.75rem 0.75rem;
  border-radius: 18px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.04) inset, 0 2px 4px rgba(0,0,0,0.04);
}

/* Base button styles */
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: var(--share-button-height);
  padding: 0 1rem;
  border: none;
  border-radius: var(--share-border-radius);
  font-size: 0.875rem;
  font-weight: 600; /* Increased for better readability */
  text-decoration: none;
  color: white;
  background-color: transparent;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  position: relative;
  min-width: 44px; /* Accessibility - minimum touch target */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  outline: none;
}

/* Prevent layout shift by reserving icon space */
.share-btn i,
.share-btn__icon-x {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.share-btn__text {
  white-space: nowrap;
}

/* Brand-specific colors with tinted backgrounds */
.share-btn--facebook {
  background: linear-gradient(135deg, rgba(24, 119, 242, 0.12) 0%, rgba(24, 119, 242, 0.08) 100%);
  color: var(--share-fb);
  border: 1px solid rgba(24, 119, 242, 0.2);
}

.share-btn--twitter {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.08) 100%);
  color: var(--share-x);
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.share-btn--linkedin {
  background: linear-gradient(135deg, rgba(10, 102, 194, 0.12) 0%, rgba(10, 102, 194, 0.08) 100%);
  color: var(--share-li);
  border: 1px solid rgba(10, 102, 194, 0.2);
}

.share-btn--whatsapp {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.12) 0%, rgba(37, 211, 102, 0.08) 100%);
  color: var(--share-wa);
  border: 1px solid rgba(37, 211, 102, 0.2);
}

.share-btn--copy {
  background: linear-gradient(135deg, rgba(108, 117, 125, 0.12) 0%, rgba(108, 117, 125, 0.08) 100%);
  color: var(--share-copy);
  border: 1px solid rgba(108, 117, 125, 0.2);
}

.share-btn--native {
  background: linear-gradient(135deg, rgba(0, 123, 255, 0.12) 0%, rgba(0, 123, 255, 0.08) 100%);
  color: var(--share-native);
  border: 1px solid rgba(0, 123, 255, 0.2);
}

/* Hover states */
.share-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.share-btn--facebook:hover {
  background: linear-gradient(135deg, rgba(24, 119, 242, 0.18) 0%, rgba(24, 119, 242, 0.12) 100%);
  border-color: rgba(24, 119, 242, 0.3);
}

.share-btn--twitter:hover {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.18) 0%, rgba(0, 0, 0, 0.12) 100%);
  border-color: rgba(0, 0, 0, 0.3);
}

.share-btn--linkedin:hover {
  background: linear-gradient(135deg, rgba(10, 102, 194, 0.18) 0%, rgba(10, 102, 194, 0.12) 100%);
  border-color: rgba(10, 102, 194, 0.3);
}

.share-btn--whatsapp:hover {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.18) 0%, rgba(37, 211, 102, 0.12) 100%);
  border-color: rgba(37, 211, 102, 0.3);
}

.share-btn--copy:hover {
  background: linear-gradient(135deg, rgba(108, 117, 125, 0.18) 0%, rgba(108, 117, 125, 0.12) 100%);
  border-color: rgba(108, 117, 125, 0.3);
}

.share-btn--native:hover {
  background: linear-gradient(135deg, rgba(0, 123, 255, 0.18) 0%, rgba(0, 123, 255, 0.12) 100%);
  border-color: rgba(0, 123, 255, 0.3);
}

/* Focus states for accessibility (WCAG AA compliant) */
.share-btn:focus {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.share-btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Active states */
.share-btn:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Disabled state */
.share-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.share-btn:disabled:hover {
  transform: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Feedback message styling */
.share-feedback {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: #28a745;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  min-height: 1.2rem; /* Prevent layout shift */
}

/* Responsive Design */

/* Mobile First - Compact spacing on smaller screens */
@media (max-width: 359px) {
  .share-buttons {
    gap: var(--share-gap-mobile);
  }

  /* Icon-only mode for ultra-narrow screens */
  .share-btn__text {
    display: none;
  }

  .share-btn {
    min-width: 44px;
    padding: 0 0.75rem;
    justify-content: center;
  }

  /* Ensure accessibility with visually hidden text */
  .share-btn::after {
    content: attr(aria-label);
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
  }
}

/* Tablet and desktop - full button text */
@media (min-width: 360px) {
  .share-buttons {
    gap: var(--share-gap);
  }

  .share-btn__text {
    display: inline;
  }
}

/* Large screens - slightly larger buttons */
@media (min-width: 768px) {
  .share-btn {
    height: 42px;
    font-size: 0.9rem;
  }

  .blog-share-bar {
    margin: 2.5rem 0;
    padding: 2rem 0;
  }
}

/* Dark mode support (future-proofing) */
@media (prefers-color-scheme: dark) {
  .blog-share-bar {
    border-top-color: #495057;
  }

  /* Keeping share-title color unchanged in dark preference to avoid low contrast on sites without full dark background */
  /* No dark background for share buttons to keep design lighter */

  /* Adjust neutral colors for dark mode */
  .share-btn--copy {
    color: #adb5bd;
  }

  .share-btn--twitter {
    color: #495057; /* Lighter for better contrast on dark backgrounds */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.08) 100%);
    border-color: rgba(255, 255, 255, 0.2);
  }

  .share-btn--twitter:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.12) 100%);
    border-color: rgba(255, 255, 255, 0.3);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .share-btn {
    transition: none;
  }

  .share-btn:hover {
    transform: none;
  }

  .share-btn:active {
    transform: none;
  }

  .share-feedback {
    transition: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .share-btn {
    border-width: 2px;
  }

  .share-btn:focus {
    outline-width: 3px;
  }
}

/* Print styles - hide interactive elements */
@media print {
  .blog-share-bar {
    display: none;
  }
}
