/* Modal chia sẻ trang — tách từ 02_URL, dùng biến theme 07_QR-ME */

#shareModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100020;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

#shareModal.active {
  display: flex;
}

#shareModal .page-share-modal-content {
  background: var(--card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 100021;
  animation: pageShareSlideUp 0.3s ease;
}

@keyframes pageShareSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

#shareModal .page-share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--border);
}

#shareModal .page-share-modal-header h2 {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
}

#shareModal .page-share-modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--muted);
  cursor: pointer;
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  line-height: 1;
}

#shareModal .page-share-modal-close:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

#shareModal .page-share-modal-body {
  padding: var(--spacing-lg);
  overflow-y: auto;
}

.share-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.share-preview {
  background: var(--bg);
  border-radius: var(--radius);
  padding: var(--spacing-md);
  border: 1px solid var(--border);
}

.share-preview-content {
  display: flex;
  gap: var(--spacing-md);
  align-items: flex-start;
}

.share-preview-image {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: var(--card);
}

.share-preview-info {
  flex: 1;
  min-width: 0;
}

.share-preview-info h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 var(--spacing-xs);
  color: var(--text-primary);
}

.share-preview-info p {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.share-platforms {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: var(--spacing-md);
}

.share-platform-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-md);
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  min-height: 96px;
}

.share-platform-btn:hover {
  border-color: var(--platform-color, var(--accent));
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.share-platform-btn i {
  font-size: 1.75rem;
  color: var(--platform-color, var(--accent));
}

.share-platform-btn img.zalo-icon {
  width: 1.75rem;
  height: 1.75rem;
  object-fit: contain;
}

.share-platform-btn span {
  text-align: center;
  word-break: break-word;
  line-height: 1.2;
}

.share-link-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.share-link-section label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.share-link-input {
  display: flex;
  gap: var(--spacing-sm);
}

.share-link-input input {
  flex: 1;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.share-link-input input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 110, 215, 0.15);
}

.btn-copy-link {
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.btn-copy-link:hover {
  filter: brightness(1.05);
}

#qrCodeShareModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100030;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

#qrCodeShareModal.active {
  display: flex;
}

#qrCodeShareModal .page-share-modal-content {
  max-width: 400px;
  text-align: center;
}

#qrCodeShareModal canvas {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 4px solid rgba(11, 110, 215, 0.25);
  background: #fff;
}

@media (max-width: 768px) {
  .share-platforms {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: var(--spacing-sm);
  }
  .share-platform-btn {
    min-height: 88px;
    padding: var(--spacing-sm);
  }
  .share-platform-btn i {
    font-size: 1.4rem;
  }
  .share-link-input {
    flex-direction: column;
  }
  .btn-copy-link {
    width: 100%;
    justify-content: center;
  }
}
