/* =============================================================================
   Enhanced Share Modal Styles for Scorio
   Includes: Native share, QR codes, WhatsApp, LinkedIn, improved layout
   ============================================================================= */

/* -------------------------------------------------------------------------
   Enhanced Modal Container
   ------------------------------------------------------------------------- */
.share-modal-enhanced {
  max-width: 520px;
}

.share-modal-enhanced .share-modal-content {
  padding: 1.5rem;
}

/* -------------------------------------------------------------------------
   Native Share Section (Mobile)
   ------------------------------------------------------------------------- */
.share-native-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border, #1e2530);
}

.share-native-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--accent, #22d3ee) 0%, var(--accent-dim, #0891b2) 100%);
  border: none;
  border-radius: 14px;
  color: #000;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.share-native-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.3);
}

.share-native-btn:active {
  transform: translateY(0);
}

.share-native-btn svg {
  width: 20px;
  height: 20px;
}

/* -------------------------------------------------------------------------
   Quick Actions (Copy Link & QR Code)
   ------------------------------------------------------------------------- */
.share-quick-actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.share-quick-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.75rem;
  background: var(--bg-elevated, #141922);
  border: 1px solid var(--border, #1e2530);
  border-radius: 14px;
  color: var(--text, #e6e9ef);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.share-quick-btn:hover {
  background: var(--bg-page, #080a0e);
  border-color: var(--accent, #22d3ee);
  transform: translateY(-2px);
}

.share-quick-btn:active {
  transform: translateY(0);
}

.share-quick-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  line-height: 1;
}

.share-quick-icon svg {
  width: 20px;
  height: 20px;
}

.share-quick-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text, #e6e9ef);
}

/* -------------------------------------------------------------------------
   QR Code Section
   ------------------------------------------------------------------------- */
.share-qr-section {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-page, #080a0e);
  border: 1px solid var(--border, #1e2530);
  border-radius: 16px;
  text-align: center;
  animation: share-qr-fade-in 0.3s ease;
}

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

.share-qr-container {
  display: flex;
  justify-content: center;
  padding: 1rem;
}

.share-qr-image {
  width: 200px;
  height: 200px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.share-qr-hint {
  margin: 0.75rem 0 0 0;
  font-size: 0.875rem;
  color: var(--text-muted, #64748b);
}

/* -------------------------------------------------------------------------
   Enhanced Preview Section
   ------------------------------------------------------------------------- */
.share-preview-section {
  position: relative;
  margin-bottom: 1.5rem;
  background: var(--bg-page, #080a0e);
  border: 1px solid var(--border, #1e2530);
  border-radius: 16px;
  overflow: hidden;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-preview-image {
  position: relative;
  width: 100%;
  padding: 1rem;
}

.share-preview-image img {
  width: 100%;
  max-width: 340px;
  height: auto;
  border-radius: 12px;
  display: block;
  margin: 0 auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.share-download-btn {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.share-download-btn:hover {
  background: rgba(0, 0, 0, 0.95);
  border-color: var(--accent, #22d3ee);
}

.share-download-btn svg {
  width: 14px;
  height: 14px;
}

/* Retry button for error state */
.share-retry-btn {
  margin-top: 1rem;
  padding: 0.625rem 1.25rem;
  background: var(--accent, #22d3ee);
  border: none;
  border-radius: 10px;
  color: #000;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.share-retry-btn:hover {
  background: var(--accent-dim, #0891b2);
}

/* -------------------------------------------------------------------------
   Enhanced Platform Grid
   ------------------------------------------------------------------------- */
.share-platform-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.share-platform-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 0.875rem 0.5rem;
  background: var(--bg-elevated, #141922);
  border: 1px solid var(--border, #1e2530);
  border-radius: 14px;
  color: var(--text, #e6e9ef);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.share-platform-btn:hover {
  background: var(--bg-page, #080a0e);
  border-color: var(--accent, #22d3ee);
  transform: translateY(-2px);
}

.share-platform-btn:active {
  transform: translateY(0);
}

.share-platform-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  margin-bottom: 0.25rem;
}

.share-platform-icon svg {
  width: 22px;
  height: 22px;
}

.share-platform-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text, #e6e9ef);
}

.share-platform-sublabel {
  font-size: 0.6875rem;
  color: var(--text-muted, #64748b);
}

/* Platform-specific colors */
.share-facebook .share-platform-icon {
  background: #1877F2;
}

.share-twitter .share-platform-icon {
  background: #000000;
  border: 1px solid #333;
}

.share-whatsapp .share-platform-icon {
  background: #25D366;
}

.share-linkedin .share-platform-icon {
  background: #0A66C2;
}

.share-instagram .share-platform-icon {
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.share-threads .share-platform-icon {
  background: #000000;
  border: 1px solid #333;
}

/* -------------------------------------------------------------------------
   Copy Button States
   ------------------------------------------------------------------------- */
.share-copy-btn {
  position: relative;
  overflow: hidden;
}

.share-copy-btn.copied {
  background: #22c55e;
}

.share-copy-btn.copied:hover {
  background: #16a34a;
}

/* -------------------------------------------------------------------------
   Toast Notification (Enhanced)
   ------------------------------------------------------------------------- */
.share-toast-enhanced {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

.share-toast-enhanced svg {
  flex-shrink: 0;
}

/* -------------------------------------------------------------------------
   Section Labels
   ------------------------------------------------------------------------- */
.share-section-label {
  margin: 0 0 0.875rem 0;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted, #64748b);
}

/* -------------------------------------------------------------------------
   Link Section
   ------------------------------------------------------------------------- */
.share-link-section {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border, #1e2530);
}

.share-link-input-group {
  display: flex;
  gap: 0.5rem;
}

.share-link-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--bg-page, #080a0e);
  border: 1px solid var(--border, #1e2530);
  border-radius: 12px;
  color: var(--text, #e6e9ef);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
}

.share-link-input:focus {
  border-color: var(--accent, #22d3ee);
}

.share-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--accent, #22d3ee);
  border: none;
  border-radius: 12px;
  color: var(--bg-page, #080a0e);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
}

.share-copy-btn:hover {
  background: var(--accent-dim, #0891b2);
}

.share-copy-btn svg {
  width: 16px;
  height: 16px;
}

/* -------------------------------------------------------------------------
   Loading Spinner
   ------------------------------------------------------------------------- */
.share-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border, #1e2530);
  border-top-color: var(--accent, #22d3ee);
  border-radius: 50%;
  animation: share-spin 0.8s linear infinite;
}

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

/* -------------------------------------------------------------------------
   Responsive Adjustments
   ------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .share-modal-enhanced {
    max-width: 100%;
  }
  
  .share-modal-enhanced .share-modal-content {
    padding: 1.25rem;
  }
  
  .share-platform-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
  
  .share-platform-btn {
    padding: 0.75rem 0.375rem;
  }
  
  .share-platform-icon {
    width: 36px;
    height: 36px;
  }
  
  .share-platform-icon svg {
    width: 18px;
    height: 18px;
  }
  
  .share-platform-label {
    font-size: 0.75rem;
  }
  
  .share-platform-sublabel {
    display: none;
  }
  
  .share-quick-actions {
    gap: 0.5rem;
  }
  
  .share-quick-btn {
    padding: 0.875rem 0.5rem;
  }
  
  .share-qr-image {
    width: 160px;
    height: 160px;
  }
  
  .share-link-input-group {
    flex-direction: column;
  }
  
  .share-copy-btn {
    justify-content: center;
  }
}

@media (max-width: 360px) {
  .share-platform-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .share-platform-label {
    display: block;
    font-size: 0.8125rem;
  }
  
  .share-preview-image img {
    max-width: 100%;
  }
}

/* -------------------------------------------------------------------------
   Dark Mode Support (if system preference)
   ------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  .share-qr-image {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  }
}

/* -------------------------------------------------------------------------
   Reduced Motion
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .share-native-btn,
  .share-quick-btn,
  .share-platform-btn,
  .share-copy-btn,
  .share-download-btn,
  .share-retry-btn {
    transition: none !important;
    animation: none !important;
  }
  
  .share-native-btn:hover,
  .share-quick-btn:hover,
  .share-platform-btn:hover {
    transform: none !important;
  }
  
  .share-spinner {
    animation: none;
    border-top-color: var(--border, #1e2530);
  }
  
  .share-qr-section {
    animation: none;
  }
}

/* -------------------------------------------------------------------------
   High Contrast Mode
   ------------------------------------------------------------------------- */
@media (prefers-contrast: high) {
  .share-platform-btn,
  .share-quick-btn,
  .share-copy-btn {
    border-width: 2px;
  }
  
  .share-link-input {
    border-width: 2px;
  }
}

/* -------------------------------------------------------------------------
   Focus Styles for Accessibility
   ------------------------------------------------------------------------- */
.share-native-btn:focus-visible,
.share-quick-btn:focus-visible,
.share-platform-btn:focus-visible,
.share-copy-btn:focus-visible,
.share-download-btn:focus-visible,
.share-retry-btn:focus-visible,
.share-modal-close:focus-visible {
  outline: 2px solid var(--accent, #22d3ee);
  outline-offset: 2px;
}

.share-link-input:focus-visible {
  outline: 2px solid var(--accent, #22d3ee);
  outline-offset: 0;
}

/* Player/team redesign share containment */
.share-modal-enhanced {
  width: min(520px, calc(100vw - 1.25rem));
  max-height: min(86vh, 760px);
  overflow: hidden;
}
.share-modal-enhanced .share-modal-content {
  max-height: min(86vh, 760px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.share-preview-section {
  min-height: clamp(170px, 42vw, 240px);
  max-width: 100%;
}
.share-preview-image,
.share-preview-image img,
.share-link-input-group,
.share-quick-actions,
.share-platform-grid {
  min-width: 0;
  max-width: 100%;
}
.share-preview-image img {
  max-height: min(44vh, 360px);
  object-fit: contain;
}
.share-platform-btn,
.share-quick-btn,
.share-copy-btn,
.share-link-input {
  min-width: 0;
}
.share-platform-label,
.share-platform-sublabel,
.share-quick-label,
.share-section-label,
.share-qr-hint {
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.share-download-btn {
  max-width: calc(100% - 2rem);
  white-space: nowrap;
}
@media (max-width: 420px) {
  .share-modal-enhanced .share-modal-content { padding: 1rem; }
  .share-preview-image { padding: 0.75rem; }
  .share-platform-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .share-quick-actions { flex-direction: column; }
  .share-download-btn {
    position: static;
    width: 100%;
    justify-content: center;
    margin-top: 0.75rem;
  }
}
