:root {
  --share-modal-bg: #ffffff;
  --share-modal-overlay: rgba(0, 0, 0, 0.5);
  --share-text-primary: #1a1a2e;
  --share-text-secondary: #6b7280;
  --share-text-muted: #9ca3af;
  --share-border: #e5e7eb;
  --share-border-light: #f3f4f6;
  --share-primary: #6366f1;
  --share-primary-hover: #4f46e5;
  --share-primary-light: #eef2ff;
  --share-success: #10b981;
  --share-error: #ef4444;
  --share-warning: #f59e0b;
  --share-radius-sm: 6px;
  --share-radius-md: 10px;
  --share-radius-lg: 16px;
  --share-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --share-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --share-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --share-shadow-xl: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
  --share-transition: 0.2s ease;
  --share-font: inherit;
}

.share-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--share-modal-overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  font-family: var(--share-font);
}

.share-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.share-modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  background: var(--share-modal-bg);
  border-radius: var(--share-radius-lg);
  box-shadow: var(--share-shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s ease;
}

.share-modal-overlay.active .share-modal {
  transform: translateY(0) scale(1);
}

.share-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--share-border-light);
}

.share-modal-header-text {
  flex: 1;
}

.share-modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--share-text-primary);
  line-height: 1.3;
}

.share-modal-subtitle {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: var(--share-text-secondary);
  line-height: 1.4;
}

.share-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: -4px -4px 0 12px;
  padding: 0;
  border: none;
  border-radius: var(--share-radius-sm);
  background: transparent;
  color: var(--share-text-muted);
  cursor: pointer;
  transition: background var(--share-transition), color var(--share-transition);
}

.share-modal-close:hover {
  background: var(--share-border-light);
  color: var(--share-text-primary);
}

.share-tabs-wrapper {
  padding: 0 20px;
  border-bottom: 1px solid var(--share-border-light);
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--share-modal-bg);
  overflow-x: visible;
}

.share-tabs-wrapper::-webkit-scrollbar {
  display: none;
}

.share-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  min-width: 0;
  padding: 8px 0;
}

.share-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--share-radius-md);
  background: transparent;
  color: var(--share-text-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--share-transition), color var(--share-transition);
}

.share-tab svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.share-tab:hover {
  background: var(--share-border-light);
  color: var(--share-text-primary);
}

.share-tab.active {
  background: var(--share-primary-light);
  color: var(--share-primary);
}

.share-tab.active svg {
  opacity: 1;
}

.share-panels {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.share-panel {
  display: none;
}

.share-panel.active {
  display: block;
}

.share-card {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: var(--share-border-light);
  border-radius: var(--share-radius-md);
  transition: box-shadow var(--share-transition);
}

.share-card + .share-card {
  margin-top: 12px;
}

.share-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: var(--share-modal-bg);
  border-radius: var(--share-radius-sm);
  color: var(--share-text-secondary);
}

.share-card-content {
  flex: 1;
  min-width: 0;
}

.share-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--share-text-primary);
}

.share-card-desc {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  color: var(--share-text-secondary);
  line-height: 1.4;
}

.share-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.share-lock-badge svg {
  width: 10px;
  height: 10px;
}

.share-cards-grid {
  display: grid;
  gap: 12px;
}

.share-cards-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.share-cards-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.share-card-compact {
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.share-card-compact .share-card-icon {
  margin-bottom: 4px;
}

.share-card-compact .share-card-desc {
  margin-bottom: 14px;
}

.share-card-centered {
  justify-content: center;
}

.share-card-mini {
  padding: 14px;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.share-card-mini .share-card-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
  background: transparent;
}

.share-card-mini .share-card-title {
  font-size: 0.8125rem;
  margin-bottom: 10px;
}

.share-card-mini .share-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.share-panel#share-panel-link .share-card {
  align-items: flex-start;
}

.share-panel#share-panel-link .share-card-icon {
  align-self: flex-start;
  margin-top: 6px;
}

.share-panel#share-panel-docs .share-card-content {
  text-align: center;
}

.share-panel#share-panel-docs .share-card-title {
  justify-content: center;
}

.share-panel#share-panel-cloud .share-cards-grid {
  align-items: stretch;
}

.share-panel#share-panel-cloud .share-card {
  height: 100%;
}

.share-panel#share-panel-cloud .share-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: space-between;
  flex: 1;
}

.share-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--share-radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--share-transition), transform 0.1s ease, box-shadow var(--share-transition);
  white-space: nowrap;
}

.share-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.share-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.share-btn-primary {
  background: var(--share-primary);
  color: #fff;
}

.share-btn-primary:hover:not(:disabled) {
  background: var(--share-primary-hover);
}

.share-btn-secondary {
  background: var(--share-modal-bg);
  color: var(--share-text-primary);
  border: 1px solid var(--share-border);
}

.share-btn-secondary:hover:not(:disabled) {
  background: var(--share-border-light);
  border-color: var(--share-border);
}

.share-btn-small {
  padding: 7px 12px;
  font-size: 0.8125rem;
  background: var(--share-modal-bg);
  color: var(--share-text-primary);
  border: 1px solid var(--share-border);
}

.share-btn-small:hover:not(:disabled) {
  background: var(--share-primary-light);
  border-color: var(--share-primary);
  color: var(--share-primary);
}

.share-btn-upgrade {
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 600;
}

.share-btn-upgrade:hover:not(:disabled) {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.share-btn .btn-loader {
  position: absolute;
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: share-spin 0.6s linear infinite;
}

.share-btn.loading .btn-text {
  opacity: 0;
}

.share-btn.loading .btn-loader {
  display: block;
}

@keyframes share-spin {
  to { transform: rotate(360deg); }
}

.share-card.gated {
  opacity: 0.7;
}

.share-card.gated .share-btn {
  background: var(--share-border-light);
  color: var(--share-text-muted);
  border-color: var(--share-border);
}

.share-link-options {
  margin-bottom: 14px;
}

.share-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--share-text-secondary);
}

.share-expiry-toggle,
.share-format-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  background: var(--share-modal-bg);
  border-radius: var(--share-radius-sm);
}

.share-expiry-btn,
.share-format-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--share-text-secondary);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--share-transition), color var(--share-transition);
}

.share-expiry-btn:hover,
.share-format-btn:hover {
  color: var(--share-text-primary);
}

.share-expiry-btn.active,
.share-format-btn.active {
  background: var(--share-primary);
  color: #fff;
}

.share-link-result {
  margin-top: 14px;
}

.share-link-field {
  display: flex;
  gap: 8px;
}

.share-link-field input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--share-border);
  border-radius: var(--share-radius-sm);
  background: var(--share-modal-bg);
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--share-text-primary);
}

.share-link-field input:focus {
  outline: none;
  border-color: var(--share-primary);
  box-shadow: 0 0 0 3px var(--share-primary-light);
}

.share-link-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  flex-shrink: 0;
  border: 1px solid var(--share-border);
  border-radius: var(--share-radius-sm);
  background: var(--share-modal-bg);
  color: var(--share-text-secondary);
  cursor: pointer;
  transition: background var(--share-transition), color var(--share-transition), border-color var(--share-transition);
}

.share-link-copy:hover {
  background: var(--share-primary-light);
  border-color: var(--share-primary);
  color: var(--share-primary);
}

.share-link-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.share-link-action {
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--share-primary);
  cursor: pointer;
  text-decoration: none;
}

.share-link-action:hover {
  text-decoration: underline;
}

.share-link-hint {
  margin: 10px 0 0;
  font-size: 0.75rem;
  color: var(--share-text-muted);
}

.share-email-input-wrap {
  display: flex;
  gap: 8px;
}

.share-email-input-wrap input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--share-border);
  border-radius: var(--share-radius-sm);
  background: var(--share-modal-bg);
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--share-text-primary);
}

.share-email-input-wrap input:focus {
  outline: none;
  border-color: var(--share-primary);
  box-shadow: 0 0 0 3px var(--share-primary-light);
}

.share-email-input-wrap input:disabled {
  background: var(--share-border-light);
  color: var(--share-text-muted);
}

.share-subtitle-options {
  margin-bottom: 14px;
}

.share-panel#share-panel-subtitles .share-cards-grid-2 {
  align-items: stretch;
}

.share-panel#share-panel-subtitles .share-card-mini {
  height: 100%;
}

.share-platform-hint {
  margin-top: 8px;
  font-size: 0.6875rem;
  color: var(--share-text-muted);
  line-height: 1.4;
  max-width: 140px;
}

.share-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--share-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.share-divider::before,
.share-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--share-border);
}

.share-toast-container {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  z-index: 10;
}

.share-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--share-text-primary);
  border-radius: var(--share-radius-sm);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--share-shadow-lg);
  animation: share-toast-in 0.3s ease;
  pointer-events: auto;
}

.share-toast.success {
  background: var(--share-success);
}

.share-toast.error {
  background: var(--share-error);
}

.share-toast.hiding {
  animation: share-toast-out 0.25s ease forwards;
}

@keyframes share-toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes share-toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

.share-upsell-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--share-radius-lg);
  z-index: 5;
  animation: share-fade-in 0.2s ease;
}

.share-upsell-overlay.hidden {
  display: none;
}

@keyframes share-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.share-upsell-dialog {
  position: relative;
  width: 100%;
  max-width: 320px;
  padding: 28px 24px;
  background: var(--share-modal-bg);
  border-radius: var(--share-radius-md);
  box-shadow: var(--share-shadow-lg);
  text-align: center;
}

.share-upsell-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--share-radius-sm);
  background: transparent;
  color: var(--share-text-muted);
  cursor: pointer;
  transition: background var(--share-transition), color var(--share-transition);
}

.share-upsell-close:hover {
  background: var(--share-border-light);
  color: var(--share-text-primary);
}

.share-upsell-title {
  margin: 0 0 8px;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--share-text-primary);
}

.share-upsell-desc {
  margin: 0 0 16px;
  font-size: 0.875rem;
  color: var(--share-text-secondary);
}

.share-upsell-benefits {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  text-align: left;
}

.share-upsell-benefits li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.875rem;
  color: var(--share-text-primary);
}

.share-upsell-benefits li svg {
  flex-shrink: 0;
  color: var(--share-success);
}

@media (max-width: 540px) {
  .share-modal {
    max-width: 100%;
    max-height: calc(100vh - 24px);
    border-radius: var(--share-radius-md);
  }

  .share-modal-header {
    padding: 16px 16px 12px;
  }

  .share-tabs-wrapper {
    padding: 0 16px;
  }

  .share-panels {
    padding: 16px;
  }

  .share-cards-grid-2,
  .share-cards-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .share-card {
    padding: 14px;
  }

  .share-card-mini {
    padding: 12px;
  }

  .share-email-input-wrap {
    flex-direction: column;
  }

  .share-email-input-wrap .share-btn {
    width: 100%;
  }
}

@media (max-width: 400px) {
  .share-cards-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}
