/**
 * Enhanced styles for a Professional Social Sharing feature.
 *
 * This version introduces CSS variables for easier theming, improved animations,
 * a dedicated "copied" message for the copy button, and an optional floating layout.
 *
 * @version 2.0.0
 */

/* ==========================================================================
   CSS Variables for Theming
   ========================================================================== */
:root {
  /* Light Mode Colors */
  --share-bg-light: #f9fafb;
  --share-border-light: #e5e7eb;
  --share-title-color-light: #111827;

  /* Dark Mode Colors */
  --share-bg-dark: #1f2937;
  --share-border-dark: #374151;
  --share-title-color-dark: #f9fafb;

  /* Universal Settings */
  --share-border-radius: 0.75rem;
  --share-padding: 1.5rem;
  --button-gap: 0.75rem;
  --button-border-radius: 8px;
  --transition-speed: 0.2s;
}

/* ==========================================================================
   Main Container
   ========================================================================== */
.professional-social-share {
  background: var(--share-bg-light);
  padding: var(--share-padding);
  border-radius: var(--share-border-radius);
  margin: 2rem 0;
  text-align: center;
  border: 1px solid var(--share-border-light);
  transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

/* --- Dark Mode Styles --- */
.dark-mode .professional-social-share {
  background: var(--share-bg-dark);
  border-color: var(--share-border-dark);
}

/* ==========================================================================
   Title & Button List
   ========================================================================== */
.professional-social-share .share-title {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--share-title-color-light);
  transition: color var(--transition-speed) ease;
}

.dark-mode .professional-social-share .share-title {
  color: var(--share-title-color-dark);
}

.professional-social-share .share-buttons-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--button-gap);
}

/* A wrapper for list items to contain button and potential tooltips */
.professional-social-share .share-list-item {
    position: relative;
    display: inline-block;
}


/* ==========================================================================
   Share Buttons
   ========================================================================== */
.professional-social-share .share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--button-border-radius);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease, background-color var(--transition-speed) ease;
  -webkit-tap-highlight-color: transparent; /* Prevents flash on mobile tap */
}

/* --- Hover, Focus, and Active States --- */
.professional-social-share .share-button:hover,
.professional-social-share .share-button:focus-visible {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.professional-social-share .share-button:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* --- Icon Styles --- */
.professional-social-share .share-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0; /* Prevents icon from shrinking */
}

.professional-social-share .share-icon svg {
  width: 100%;
  height: 100%;
  vertical-align: middle;
  fill: currentColor;
}

/* --- Brand Colors --- */
.share-facebook  { background-color: #1877f2; }
.share-twitter   { background-color: #1da1f2; }
.share-linkedin  { background-color: #0a66c2; }
.share-whatsapp  { background-color: #25d366; }
.share-pinterest { background-color: #e60023; }
.share-reddit    { background-color: #ff4500; }
.share-telegram  { background-color: #26a5e4; }
.share-email     { background-color: #777; }
.share-copy-link { background-color: #6c757d; }

/* ==========================================================================
   Copy Link Functionality
   ========================================================================== */
.share-copy-link.copied {
  background-color: #28a745; /* Green for success */
}

/* --- "Copied!" Tooltip Message --- */
.copied-message {
    position: absolute;
    bottom: 110%; /* Position above the button */
    left: 50%;
    transform: translateX(-50%);
    background-color: #28a745;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed) ease, visibility var(--transition-speed) ease, bottom var(--transition-speed) ease;
    z-index: 10;
}

.share-copy-link.copied + .copied-message {
    opacity: 1;
    visibility: visible;
    bottom: 120%; /* Animate upwards */
}

/* ==========================================================================
   Optional Floating Layout
   ========================================================================== */
.professional-social-share.is-floating {
    position: fixed;
    left: var(--share-padding);
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    width: auto;
    z-index: 1000;
    padding: var(--button-gap);
}

.professional-social-share.is-floating .share-title {
    display: none; /* Hide title in floating mode */
}

.professional-social-share.is-floating .share-buttons-list {
    flex-direction: column;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */
@media (max-width: 767px) {
    /* Adjust padding for smaller screens */
    .professional-social-share {
        padding: 1.25rem 1rem;
    }
    
    /* Make buttons icon-only and circular on mobile for a cleaner look */
    .professional-social-share .share-button {
        padding: 0.75rem;
        width: 46px;   /* Consistent size for touch targets */
        height: 46px;  /* Consistent size for touch targets */
        border-radius: 50%; /* Perfect circle */
        gap: 0;
    }

    .professional-social-share .share-label {
        display: none; /* Hide text label to save space */
    }

    .professional-social-share .share-icon {
        margin: 0;
    }
    
    /* Reposition floating bar for mobile to avoid overlap */
    .professional-social-share.is-floating {
        left: 50%;
        top: auto;
        bottom: 1rem;
        width: auto;
        transform: translateX(-50%);
        box-shadow: 0 -4px 15px rgba(0,0,0,0.1);
    }
    
    .professional-social-share.is-floating .share-buttons-list {
        flex-direction: row; /* Horizontal layout for bottom bar */
    }
}
