/**
 * Share Icons Plugin - Frontend Styles
 * Supports both RTL and LTR layouts
 */

/* ─── Wrapper ─────────────────────────────────────────── */
.share-icons-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  flex-wrap: wrap;
}

[dir="rtl"] .share-icons-wrapper,
html[dir="rtl"] .share-icons-wrapper {
  direction: rtl;
}

/* ─── Label ──────────────────────────────────────────── */
.share-icons-label {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
  white-space: nowrap;
}

/* ─── Container ──────────────────────────────────────── */
.share-icons-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ═══════════════════════════════════════════════════════
   VARIANT: ICONS (Circular Icons)
   ══════════════════════════════════════════════════════ */

.share-icons-icons .share-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  background: transparent;
  color: var(--platform-color, #4b5563);
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.share-icons-icons .share-icon-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  pointer-events: none;
}

.share-icons-icons .share-icon-btn:hover,
.share-icons-icons .share-icon-btn:focus-visible {
  background: var(--platform-color, #4b5563);
  color: #ffffff;
  border-color: var(--platform-color, #4b5563);
  transform: scale(1.05);
}

.share-icons-icons .share-icon-btn:active {
  transform: scale(0.95);
  transition-duration: 0.1s;
}

.share-icons-icons .share-icon-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.2);
}

/* ─── Copy button (icons variant) ────────────────────── */
.share-icons-icons .share-icon-copy {
  --platform-color: #4b5563;
}

.share-icons-icons .share-icon-copy .share-check-icon {
  position: absolute;
  inset: 0;
  margin: auto;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s ease;
}

.share-icons-icons .share-icon-copy.is-copied {
  background: #22c55e !important;
  border-color: #22c55e !important;
  color: #ffffff !important;
}

.share-icons-icons .share-icon-copy.is-copied svg:first-of-type {
  opacity: 0;
  transform: scale(0.5);
}

.share-icons-icons .share-icon-copy.is-copied .share-check-icon {
  opacity: 1;
  transform: scale(1);
}

/* ═══════════════════════════════════════════════════════
   VARIANT: BUTTONS (Filled Buttons)
   ══════════════════════════════════════════════════════ */

.share-icons-buttons .share-button-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-width: 160px;
  height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: none;
  background: color-mix(in srgb, var(--platform-color, #4b5563) 8%, transparent);
  color: var(--platform-color, #4b5563);
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.share-icons-buttons .share-button-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  pointer-events: none;
}

.share-icons-buttons .share-button-btn:hover,
.share-icons-buttons .share-button-btn:focus-visible {
  background: var(--platform-color, #4b5563);
  color: #ffffff;
}

.share-icons-buttons .share-button-btn:active {
  transform: scale(0.98);
  transition-duration: 0.1s;
}

.share-icons-buttons .share-button-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.2);
}

/* ─── Copy button (buttons variant) ──────────────────── */
.share-icons-buttons .share-button-copy {
  --platform-color: #4b5563;
}

.share-icons-buttons .share-button-copy .share-check-icon,
.share-icons-buttons .share-button-copy .share-copied-text {
  position: absolute;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.2s ease;
}

.share-icons-buttons .share-button-copy .share-copied-text {
  position: static;
  display: none;
}

.share-icons-buttons .share-button-copy.is-copied {
  background: #22c55e !important;
  color: #ffffff !important;
}

.share-icons-buttons .share-button-copy.is-copied .share-link-svg,
.share-icons-buttons .share-button-copy.is-copied .share-copy-text {
  display: none;
}

.share-icons-buttons .share-button-copy.is-copied .share-check-icon,
.share-icons-buttons .share-button-copy.is-copied .share-copied-text {
  display: inline-flex;
  opacity: 1;
  transform: scale(1);
  position: static;
}

/* ═══════════════════════════════════════════════════════
   POPOVER / PANEL
   ══════════════════════════════════════════════════════ */

.share-icons-popover {
  position: absolute;
  z-index: 9999;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  padding: 20px;
  width: 280px;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.share-icons-popover.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.share-icons-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.share-icons-popover-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
}

.share-icons-popover-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
}

.share-icons-popover-close:hover {
  background: #f3f4f6;
  color: #1a1a1a;
}

.share-icons-popover-close svg {
  width: 14px;
  height: 14px;
}

/* ═══════════════════════════════════════════════════════
   FLOATING BAR
   ══════════════════════════════════════════════════════ */

.share-icons-floating {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 50px;
  padding: 8px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ═══════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════ */

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

.share-icons-wrapper {
  animation: shareIconsFadeIn 0.3s ease-out;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  .share-icons-wrapper {
    gap: 8px;
  }

  .share-icons-buttons .share-button-btn {
    min-width: 100%;
  }

  .share-icons-label {
    font-size: 12px;
  }
}

/* ═══════════════════════════════════════════════════════
   REDUCED MOTION
   ══════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .share-icon-btn,
  .share-button-btn,
  .share-icons-wrapper,
  .share-icons-popover {
    transition: none !important;
    animation: none !important;
  }
}

/* ═══════════════════════════════════════════════════════
   DARK MODE SUPPORT (basic)
   ══════════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
  .share-icons-wrapper {
    color: #e5e7eb;
  }

  .share-icons-label {
    color: #e5e7eb;
  }

  .share-icons-popover {
    background: #1f2937;
    border-color: #374151;
  }

  .share-icons-popover-title {
    color: #f9fafb;
  }

  .share-icons-popover-close {
    border-color: #374151;
    color: #9ca3af;
  }
}
