/**
 * HIGH CONVERSION FLOATING SHARE BAR
 * Mobile-only (max-width: 768px) sticky bottom bar
 * Optimized for exam/job websites - WhatsApp & Telegram focus
 * SEO: semantic HTML, aria-labels, no heavy libraries
 */

/* ===== DESKTOP: Left sidebar (hidden on mobile) ===== */
.floating-share-desktop {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9998;
  display: flex;
  align-items: center;
}

.floating-share-desktop .floating-share-bar {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem 0.35rem;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 0 14px 14px 0;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.12);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-left: none;
}

.floating-share-desktop .floating-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  color: #475569;
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.floating-share-desktop .floating-share-btn:hover {
  background: #f1f5f9;
}

.floating-share-desktop .floating-share-btn svg {
  width: 24px;
  height: 24px;
}

/* Desktop: hide on mobile */
@media (max-width: 768px) {
  .floating-share-desktop {
    display: none !important;
  }
}

/* ===== MOBILE: Bottom sticky bar (visible only on mobile) ===== */
.floating-share-mobile {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: 0.75rem 1rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0));
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.12);
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  transform: translateY(0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-share-mobile.hidden {
  transform: translateY(100%);
}

.floating-share-mobile .share-bar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  max-width: 400px;
  margin: 0 auto;
}

.floating-share-mobile .share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 64px;
  min-width: 64px;
  padding: 0.5rem 0.35rem;
  border-radius: 14px;
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.floating-share-mobile .share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.floating-share-mobile .share-btn:active {
  transform: translateY(0);
}

.floating-share-mobile .share-btn svg {
  width: 28px;
  height: 28px;
}

.floating-share-mobile .share-btn span {
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  line-height: 1.2;
}

/* Facebook - #1877f2 */
.floating-share-mobile .share-btn-facebook {
  background: linear-gradient(135deg, #1877f2 0%, #0d65d9 100%);
  color: #fff;
}

.floating-share-mobile .share-btn-facebook span {
  color: rgba(255, 255, 255, 0.95);
}

.floating-share-mobile .share-btn-facebook:hover {
  box-shadow: 0 4px 20px rgba(24, 119, 242, 0.4);
}

/* WhatsApp - #25D366 */
.floating-share-mobile .share-btn-whatsapp {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: #fff;
}

.floating-share-mobile .share-btn-whatsapp span {
  color: rgba(255, 255, 255, 0.95);
}

.floating-share-mobile .share-btn-whatsapp:hover {
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
}

/* Telegram - #0088cc */
.floating-share-mobile .share-btn-telegram {
  background: linear-gradient(135deg, #0088cc 0%, #0077b5 100%);
  color: #fff;
}

.floating-share-mobile .share-btn-telegram span {
  color: rgba(255, 255, 255, 0.95);
}

.floating-share-mobile .share-btn-telegram:hover {
  box-shadow: 0 4px 20px rgba(0, 136, 204, 0.4);
}

/* Copy Link - neutral gray */
.floating-share-mobile .share-btn-copy {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  color: #fff;
}

.floating-share-mobile .share-btn-copy span {
  color: rgba(255, 255, 255, 0.95);
}

.floating-share-mobile .share-btn-copy:hover {
  box-shadow: 0 4px 20px rgba(100, 116, 139, 0.35);
}

.floating-share-mobile .share-btn-copy.copied {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

/* Native Share - dark gray */
.floating-share-mobile .share-btn-native {
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
  color: #fff;
}

.floating-share-mobile .share-btn-native span {
  color: rgba(255, 255, 255, 0.95);
}

.floating-share-mobile .share-btn-native:hover {
  box-shadow: 0 4px 20px rgba(30, 41, 59, 0.4);
}

/* Copy tooltip */
.floating-share-mobile .share-btn-copy .copy-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 0.35rem 0.75rem;
  background: #1e293b;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.floating-share-mobile .share-btn-copy .copy-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1e293b;
}

.floating-share-mobile .share-btn-copy.show-tooltip .copy-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(-12px);
}

.floating-share-mobile .share-btn {
  position: relative;
}

/* Mobile only - show bottom bar */
@media (min-width: 769px) {
  .floating-share-mobile {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .floating-share-mobile {
    display: block;
  }

  /* Add bottom padding to main so content isn't covered */
  body.has-mobile-share-bar main#main {
    padding-bottom: 90px;
  }
}

/* Dark mode */
html.dark .floating-share-mobile {
  background: rgba(15, 23, 42, 0.98);
  border-top-color: rgba(51, 65, 85, 0.9);
}

html.dark .floating-share-desktop .floating-share-bar {
  background: rgba(30, 41, 59, 0.97);
  border-color: rgba(51, 65, 85, 0.9);
}

html.dark .floating-share-desktop .floating-share-btn {
  color: #94a3b8;
}

html.dark .floating-share-desktop .floating-share-btn:hover {
  background: rgba(51, 65, 85, 0.6);
}
